SOLR-18233 Strengthen Basic Authentication password policy and harden template users created by bin/solr auth enable#4477
Open
janhoy wants to merge 9 commits into
Open
Conversation
Clean up bin/solr auth enable template accounts
epugh
reviewed
May 30, 2026
epugh
reviewed
May 30, 2026
epugh
reviewed
May 30, 2026
epugh
reviewed
May 30, 2026
…er.authenticate() username.equals(password) threw NPE when username was null. The previous code handled null usernames safely via credentials.get(null), so this was a regression introduced by the new equality check.
… and set-user Adds two test methods to TestSha256AuthenticationProvider: - testAuthenticateRejectsUsernameEqualPassword: verifies that authenticate() returns false when username==password even if the hash is stored - testSetUserRejectsUsernameEqualPassword: verifies that the set-user edit command rejects entries where username==password
If an operator runs 'bin/solr auth enable --credentials admin:admin' with --block-unknown (the default), the created account will never authenticate, immediately locking them out. Fail early with a clear error message instead.
…son top level The --block-unknown flag was writing blockUnknown to the top level of security.json, but Solr reads it from security.json.authentication.blockUnknown. This meant the option had no effect and the template's value (false) was always used, a security-relevant bug since operators believed auth was mandatory when it was not.
The bullet describing what 'bin/solr auth enable' does pointed to solr/core/resources/security.json (missing src/). The correct path is solr/core/src/resources/security.json, matching the link added earlier in the same section.
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.
https://issues.apache.org/jira/browse/SOLR-18233
Password policy (affects all Basic Auth installations): Solr's Basic Authentication has had minimal password requirements. While the Admin UI enforced a few rules, it still permitted passwords identical to the username (e.g. admin/admin). This change disallows username/password equality both at login and at account creation, via the API and Admin UI alike. As a side effect, any existing installation retaining the well-known template credentials will have those accounts silently disabled until the passwords are changed.
bin/solr auth enablecleanup: The command previously uploaded a bundled security.json template containing four undocumented accounts with weak default credentials. With this change:These changes collectively strengthen the security posture of both new and existing Solr installations using Basic Authentication.