Repository navigation
Fix user/password split for percent-encoded Redis URI credentials - #4617
Merged
Merged
Conversation
Collaborator
|
Thanks for the fix β we'll take a closer look shortly. |
Contributor
Author
|
Filed #4728 with the repro so this has a tracked issue. Also merged master in: the red SDR job was the |
atakavci
reviewed
Sep 16, 2026
| @@ -53,9 +56,9 @@ public static HostAndPort getHostAndPort(URI uri) { | |||
| * @return the user as a String, or null if user is empty or {@link URI#getUserInfo()} info is missing | |||
Contributor
There was a problem hiding this comment.
javadoc remains to reference to getUserInfo
ggivo
approved these changes
Sep 16, 2026
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.
Fixes #4728
getUser/getPasswordreaduri.getUserInfo(), which percent-decodes the userinfo before theuser:passwordsplit. A%3Ain the username decodes to a literal:first, sosplit(":", 2)lands on it and the credentials are cut at the wrong point, sending the wrong ACL identity toAUTH.Splitting
uri.getRawUserInfo()keeps the encoded colon as%3A, so only the real separator is a literal:, and each half is decoded after the split.+is kept literal since userinfo is not form data, so passwords already containing+are unaffected.Note
Medium Risk
Changes how URI credentials are parsed for Jedis client setup and AUTH; behavior shifts only for percent-encoded userinfo edge cases, but incorrect parsing previously sent wrong ACL identities.
Overview
Fixes incorrect user/password extraction when Redis connection URIs contain percent-encoded characters in the userinfo segment (e.g.
%3Ain a username).getUserandgetPasswordnow split ongetRawUserInfo()instead ofgetUserInfo(), so encoded colons do not become literal:before the split and move the boundary. Each side is UTF-8 percent-decoded after the split via a newdecodehelper;+is treated as literal (not form-style space) by escaping it beforeURLDecoder.Tests cover encoded colons in usernames and encoded specials / plus signs in passwords.
Reviewed by Cursor Bugbot for commit 0b20113. Bugbot is set up for automated code reviews on this repo. Configure here.