fix(client): handle ACL GETUSER null reply for nonexistent users - #3413
Open
abhijeet117 wants to merge 1 commit into
Open
fix(client): handle ACL GETUSER null reply for nonexistent users#3413abhijeet117 wants to merge 1 commit into
abhijeet117 wants to merge 1 commit into
Conversation
Contributor
|
@abhijeet117 Thanks for the PR. We’ll review it when we have capacity. |
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.
Summary
ACL GETUSER replies null when the user does not exist, but the declared reply type claimed a non-null object shape and the RESP2 transformer crashed indexing into the null reply (
TypeError: Cannot read properties of null (reading '1')), as reported in #2745.The RESP2 transformer now passes a null reply through unchanged, and
NullReplyis part of the declared reply type for both protocols, following the existing FUNCTION_STATS pattern.Testing
Reproduced the crash by calling the RESP2 transformer with a null reply on master; it throws the exact TypeError from #2745. Added a unit assertion that the transformer returns null unchanged, plus compile-time regression tests asserting null is part of the client-facing reply type for both protocols (
npm run test:types -w @redis/clientfails before this change, passes after).Checklist
Note
Low Risk
Narrow reply-transform and type fix for one command; no auth, protocol, or data-path changes beyond correctly returning null.
Overview
Fixes
ACL GETUSERcrashing on RESP2 when the user does not exist (TypeErrorfrom indexing intonull), and types the reply as nullable for both RESP2 and RESP3 (#2745).The RESP2 transformer now returns
nullunchanged viaisNullReply. Adds a unit check for that path and a compile-time types test thatnullis part of the client-facing reply.Reviewed by Cursor Bugbot for commit dc4cedc. Bugbot is set up for automated code reviews on this repo. Configure here.