Repository navigation
Authentication fails when password configured in spring.elasticsearch.uris contains a colon - #52047
Merged
snicoll merged 1 commit intoOct 12, 2026
Conversation
snicoll
force-pushed
the
fix/elasticsearch-uri-password-colon
branch
from
October 12, 2026 13:06
51ab3e6 to
bc7b3d1
Compare
PropertiesElasticsearchConnectionDetails split the URI user info on every colon and only used the first two components, so a password such as 'pass:with:colon' was truncated to 'pass'. Split the user info at the first colon only, keeping the remainder as the password, which is consistent with how the credentials provider already handles user info. See spring-projectsgh-52047 Signed-off-by: lavinhoque33 <caspianprince33@yahoo.com>
snicoll
force-pushed
the
fix/elasticsearch-uri-password-colon
branch
from
October 12, 2026 13:07
bc7b3d1 to
006d6d5
Compare
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.
When
spring.elasticsearch.uriscontains user info,PropertiesElasticsearchConnectionDetailssplits it on every:and keeps only the first two parts. A password that contains a colon is therefore truncated: withhttp://user:pass:with:colons@localhost:9200, the REST client is configured with passwordpassand authentication fails.The user info is now split at the first colon only, and everything after it is the password. This matches
createUserInfoCredentialsin the same class, and RFC 3986, where the user name is everything before the first colon. URIs with no password (user@) or an empty one (user:@) behave as before.Tests:
configureUriWithUsernameAndPasswordContainingColonsinElasticsearchRestClientAutoConfigurationTestschecks the credentials registered for the node on theRest5Client. Without the change it fails withExpecting actual: ['p', 'a', 's', 's'] to contain exactly ... ['p', 'a', 's', 's', ':', 'w', 'i', 't', 'h', ...].checkFormatandcheckstylepass for the module.