Repository navigation
Validate CLIENT SETINFO attribute values - #2124
Merged
Vasileios Zois (vazois) merged 2 commits intoSep 14, 2026
Merged
Vasileios Zois (vazois) merged 2 commits into
Vasileios Zois (vazois) merged 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The invalid-value error path currently echoes the client-provided attribute casing (contradicting the PR’s stated “matched constant” behavior) and one new assertion is brittle to formatting/order changes.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR hardens CLIENT SETINFO by validating LIB-NAME / LIB-VER values before storing and echoing them via CLIENT LIST / CLIENT INFO, preventing CRLF/control-byte injection into administrative output.
Changes:
- Added byte-level validation for
CLIENT SETINFOvalues (printable ASCII range 33–126) and a Redis-matching error message on rejection. - Updated attribute matching to be case-insensitive (e.g.,
lib-veraccepted) while keeping unknown attributes on the existing syntax-error path. - Documented the new error behavior and added regression tests covering invalid bytes/injection attempts and value-preservation semantics.
File summaries
| File | Description |
|---|---|
| website/docs/commands/client.md | Documents the new CLIENT SETINFO error reply behavior for invalid attribute values. |
| test/standalone/Garnet.test.acl/Resp/ACL/BasicTests.cs | Adds regression tests for invalid CLIENT SETINFO values and output cleanliness in CLIENT INFO/CLIENT LIST. |
| libs/server/Resp/CmdStrings.cs | Introduces a reusable formatted error string for invalid client attribute values. |
| libs/server/Resp/ClientCommands.cs | Implements case-insensitive attribute dispatch and raw-byte validation of attribute values before storing. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
Tristan Su (@foobar), please address the copilot comments. |
CLIENT SETINFO stored LIB-NAME/LIB-VER values without validation and echoed them verbatim into CLIENT LIST, so a client could inject arbitrary reply lines into the administrative output. Values are now validated as printable ASCII (33-126) on the raw bytes, matching Redis validateClientAttr, and rejected with 'ERR <attr> cannot contain spaces, newlines or special characters.' mirroring Redis's addReplyErrorFormat wording. Attribute dispatch precedes value validation, so unknown attributes keep the syntax error path and the echoed attribute is always a matched constant. Signed-off-by: Tristan Su <[email protected]>
Tristan Su (foobar)
force-pushed
the
fix/client-setinfo-validation
branch
from
September 11, 2026 23:43
e007e1a to
4997f4f
Compare
Vasileios Zois (vazois)
approved these changes
Sep 14, 2026
Vasileios Zois (vazois)
merged commit Sep 14, 2026
cd35bf4
into
microsoft:main
166 of 169 checks passed
x@01 (x-at-01)
added a commit
to webc-fork/garnet
that referenced
this pull request
Sep 20, 2026
…#2112), Validate CLIENT SETINFO (microsoft#2124), Fix HLL Validation (microsoft#2133)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLIENT SETINFO stored LIB-NAME/LIB-VER values without validation and echoed them verbatim into CLIENT LIST/CLIENT INFO, so a client could inject arbitrary reply lines into administrative output.
validateClientAttr, and rejected withERR <attr> cannot contain spaces, newlines or special characters.mirroring Redis's wording.lib-nameaccepted), matching Redis subcommand lookup.Regression tests cover CRLF injection, control/high bytes, boundary bytes 33/126, failed-SETINFO preservation, empty-value clearing, case-insensitive matching, and CLIENT LIST line-cleanliness. Command docs updated accordingly.
Signed-off-by: Tristan Su [email protected]