SOLR-18233 Strengthen Basic Authentication password policy (backport branch_9x)#4519
Open
janhoy wants to merge 3 commits into
Open
SOLR-18233 Strengthen Basic Authentication password policy (backport branch_9x)#4519janhoy wants to merge 3 commits into
janhoy wants to merge 3 commits into
Conversation
Contributor
Author
|
Set this to draft since I reverted the main/10x commits. Once a new PR is ready and merged for main, I'll update this PR again.. |
dfb8b0d to
a1ed2bd
Compare
… template users created by bin/solr auth enable (apache#4534) Backport of the take2 PR (apache#4534) to branch_9x. - Reject password equal to username at login and at set-user time (API, Admin UI, CLI), with escape hatch system property solr.security.auth.basicauth.allowuseraspassword (env SOLR_SECURITY_AUTH_BASICAUTH_ALLOWUSERASPASSWORD). - bin/solr auth enable: ship template users (admin/index/search) with empty credentials, remove superadmin, only override blockUnknown when explicitly passed, and print a reminder to set passwords. - SecurityConfHandler now returns HTTP 400 on command errors via ApiBag.ExceptionWithErrObject (9x equivalent of main's SolrErrorWrappingException). - Admin UI security panel surfaces detailed command errors in its dialog. - Ref-guide: upgrade note added under "Solr 9.11"; control-script and basic-auth docs updated.
a1ed2bd to
673ce3e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Backport of SOLR-18233 to branch_9x to strengthen Basic Authentication by rejecting passwords equal to the username, adding a temporary escape-hatch system property/env var for upgrades, and aligning CLI/UI/docs/tests with the new policy and updated security.json template behavior.
Changes:
- Enforce
username != passwordin Basic Auth login andset-user, with an escape-hatch viasolr.security.auth.basicauth.allowuseraspassword(EnvUtils-enabled). - Harden
bin/solr auth enableby relying on a best-practicesecurity.jsontemplate with template users that have no password set by default, and improve CLI messaging/behavior. - Improve Admin UI Security panel error surfacing by routing security API errors to the panel dialog (instead of the global banner) and updating docs and tests accordingly.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| solr/webapp/web/js/angular/controllers/security.js | Improve Security panel error parsing/display and listen for security-specific interceptor broadcasts. |
| solr/webapp/web/js/angular/app.js | Route /api/cluster/security/* errors to Security panel and suppress unhandled rejection console noise. |
| solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java | Update test credentials so passwords differ from usernames. |
| solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-9.adoc | Add upgrade note about the strengthened Basic Auth password policy and escape hatch. |
| solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc | Document updated bin/solr auth enable behavior, template users, and blockUnknown defaulting to the template. |
| solr/solr-ref-guide/modules/deployment-guide/pages/basic-authentication-plugin.adoc | Document cloud-mode enablement via CLI and the new password constraint. |
| solr/core/src/test/org/apache/solr/security/TestSha256AuthenticationProvider.java | Add unit tests for username==password rejection and escape-hatch behavior. |
| solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java | Update test password and credential hash. |
| solr/core/src/test/org/apache/solr/security/AuthWithShardHandlerFactoryOverrideTest.java | Update test password and credential hash. |
| solr/core/src/test/org/apache/solr/handler/admin/SecurityConfHandlerTest.java | Adapt test to new error handling behavior (ExceptionWithErrObject / 400). |
| solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java | Update test password and credential hash to avoid username==password. |
| solr/core/src/test/org/apache/solr/cli/AuthToolTest.java | Add CLI tests for rejecting username==password and honoring escape hatch; reset ZK security state between tests. |
| solr/core/src/resources/security.json | Update distributed template: remove preset password hashes and adjust role mappings for template users. |
| solr/core/src/java/org/apache/solr/security/Sha256AuthenticationProvider.java | Enforce username!=password at login and set-user, with escape hatch via EnvUtils-based property. |
| solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandler.java | Throw structured BAD_REQUEST errors (ExceptionWithErrObject) when command processing fails. |
| solr/core/src/java/org/apache/solr/cli/AuthTool.java | Enforce username!=password in CLI, respect template blockUnknown unless explicitly overridden, and report template users. |
| changelog/unreleased/SOLR-18233-Strengthen-Basic-Authentication-password-policy.yml | Add unreleased changelog entry for SOLR-18233. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
This backports the main/10x code in #4534 to 9x. In 9x there are quite some differences in CLI land and some defaults have changed etc. So the cherry-pick was not clean without adaptation. Therefore I use a PR for the backport...
The backport is AI assisted, but manually reviewed. I also ran the manual verification tests below and tested correct response in Admin UI.
How to test manually
Build this branch locally, then: