StackExchange / StackExchange.Redis

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

client library metadata should validate contents #2653

Closed mgravell closed 4 months ago

mgravell commented 4 months ago

The client setinfo lib-name and client setinfo lib-ver sub-commands are picky:

127.0.0.1:6379> client setinfo lib-name "a b"
(error) ERR lib-name cannot contain spaces, newlines or special characters.
127.0.0.1:6379> client setinfo lib-name "a-b"
OK

and

127.0.0.1:6379> client setinfo lib-ver "a b"
(error) ERR lib-ver cannot contain spaces, newlines or special characters.
127.0.0.1:6379> client setinfo lib-ver "a-b"
OK

This causes the library metadata to not be set at all; suggestion: fix this at the library level. We already perform client setname validation, removing invalid characters; however, I propose to replace any groups of invalid characters with a single - instead, to retain semantic grouping. I do not currently propose to change how client setname sanitizes anything, although that could also be considered.