StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.84k stars 1.5k forks source link

Feature proposal: high integrity mode #2706

Closed mgravell closed 1 week ago

mgravell commented 2 months ago

This is a client-library alternative suggestion to https://github.com/redis/redis/issues/13240, to address the issue of protocol desync going undetected for at least "some" commands, and causing mayhem.

Proposal: "high integrity mode"

Note that in comparison to the attribute version (redis/redis), this isn't much different at the bytes level:

|1\r\n
+cid\r\n
$10\r\n
1029f737sd\r\n
{actual command here}
...
|1\r\n
+cid\r\n
$10\r\n
1029f737sd\r\n
{actual response here}

vs

*2\r\n
$4\r\n
ping\r\n
$10\r\n
1029f737sd\r\n
{actual command here}
...
*10\r\n
1029f737sd\r\n
{actual response here}

request is 4 bytes larger, response is 10 bytes smaller (vs attribute version)

this has the advantage that it would work on virtually every server version, and could be implemented right now