Skip to content

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
apache:mainfrom
janhoy:SOLR-18268-fix-bin-solr-auth-enable
Open

SOLR-18233 Strengthen Basic Authentication password policy and harden template users created by bin/solr auth enable#4477
janhoy wants to merge 9 commits into
apache:mainfrom
janhoy:SOLR-18268-fix-bin-solr-auth-enable

Conversation

@janhoy
Copy link
Copy Markdown
Contributor

@janhoy janhoy commented May 29, 2026

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 enable cleanup: The command previously uploaded a bundled security.json template containing four undocumented accounts with weak default credentials. With this change:

  • The superadmin template account is removed from the bundled template
  • The remaining template accounts ship with no password set rather than a default one
  • The command will prompt the operator to set passwords for any template accounts at enable-time
  • Documentation for bin/solr auth enable is updated to clearly describe all accounts it creates

These changes collectively strengthen the security posture of both new and existing Solr installations using Basic Authentication.

@github-actions github-actions Bot added documentation Improvements or additions to documentation admin-ui cat:cli cat:security labels May 29, 2026
@janhoy janhoy requested a review from Copilot May 29, 2026 21:49

This comment was marked as resolved.

Comment thread solr/core/src/java/org/apache/solr/security/Sha256AuthenticationProvider.java Outdated
Comment thread solr/core/src/resources/security.json
Comment thread solr/webapp/web/js/angular/controllers/security.js
Copy link
Copy Markdown
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this hard thing @janhoy!

janhoy added 5 commits May 30, 2026 22:33
…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.
@github-actions github-actions Bot added the tests label May 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread solr/core/src/java/org/apache/solr/cli/AuthTool.java Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

admin-ui cat:cli cat:security documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants