danielealbano / cachegrand

cachegrand - a modern data ingestion, processing and serving platform built for today's hardware
BSD 3-Clause "New" or "Revised" License
975 stars 34 forks source link

Validate the set, mset, setrange and similar refuse to create empty keys #201

Closed danielealbano closed 2 years ago

danielealbano commented 2 years ago

This PR introduces some constraints on the minimum length of keys, patterns and short strings handled by the Redis command parser to ensure that if an argument of that type is zero-length will be rejected.

Tests are introduced as well to validate the rejection.

On a side, the PR also changes some code to take into account the returned value of module_redis_connection_error_messageprintf*

Closes #199

codecov[bot] commented 2 years ago

Codecov Report

Merging #201 (f8e7a01) into main (6ce1c1d) will increase coverage by 0.08%. The diff coverage is 46.43%.

@@            Coverage Diff             @@
##             main     #201      +/-   ##
==========================================
+ Coverage   80.76%   80.84%   +0.08%     
==========================================
  Files         129      129              
  Lines        7759     7760       +1     
==========================================
+ Hits         6266     6273       +7     
+ Misses       1493     1487       -6     
Impacted Files Coverage Δ
...c/module/redis/command/module_redis_command_mset.c 88.89% <0.00%> (+8.89%) :arrow_up:
...module/redis/command/module_redis_command_msetnx.c 84.62% <0.00%> (+4.13%) :arrow_up:
src/module/redis/module_redis_command.c 82.14% <47.06%> (+1.05%) :arrow_up:
src/module/redis/module_redis_connection.c 72.93% <62.50%> (+0.20%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.