[ZEPPELIN-6731] Fix LdapRealm login failure caused by unsupported SHA-1 hashing after Shiro 2.0.6 upgrade #5585
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 316 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.345
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5585"
general
weight: 0.35
jongyoul
What is this PR for?
Since the Shiro 2.0.6 upgrade (ZEPPELIN-6528), logging in through
LdapRealmfails with HTTP 403 even with the correct password, becausecreateAuthenticationInfo()hashes the credentials withSHA-1, which Shiro 2'sSimpleHashProviderno longer supports (only SHA-256/384/512).Switching the algorithm alone is not enough. In Shiro 2,
DefaultHashServicedefaults to 50,000 iterations with a random salt, whileHashedCredentialsMatcherdefaults to 1 iteration. With only the algorithm changed, the exception disappears but the hashes never match, so login still fails silently with 403.This PR:
HASHING_ALGORITHMfromSHA-1toSHA-256.HASH_ITERATIONS(Shiro'sSimpleHashProvider.Parameters.DEFAULT_ITERATIONS) and uses it on both sides: the hash request increateAuthenticationInfo()and theHashedCredentialsMatcher.createAuthenticationInfo()→ credentials matcher path, which previously had no test coverage.What type of PR is it?
Bug Fix
Todos
[x] Switch
LdapRealmhashing algorithm fromSHA-1toSHA-256[x] Align hash iterations between
DefaultHashServiceandHashedCredentialsMatcher[x] Add unit tests for the
createAuthenticationInfo()→ credentials matcher path[x] Verify login manually against a real LDAP server (389 Directory Server)
What is the Jira issue?
ZEPPELIN-6731
How should this be tested?
Unit tests:
LdapRealmTest#testCreateAuthenticationInfoMatchesSubmittedCredentialsLdapRealmTest#testCreateAuthenticationInfoRejectsDifferentCredentials| Code state | Result |
|---|---|
| Before fix (
SHA-1) | Both tests error:UnsupportedOperationException: Cannot create a hash with the given algorithm: SHA-1|| Algorithm changed to
SHA-256only | Match test fails:expected: <true> but was: <false>(iteration mismatch) || This PR | All tests in
LdapRealmTest,RoleMappingLdapRealmTest,LdapRealmFilterInjectionTest,LdapRealmDnInjectionTestpass |Manual test, following the reproduction steps in the Jira issue (389 Directory Server in Docker,
LdapRealminshiro.ini):| Password | Before | After |
|---|---|---|
|
alice123(correct) | HTTP 403 + SHA-1 exception in server log | HTTP 200 ||
wrong-pw| HTTP 403 | HTTP 403 |Questions:
Does the license files need to update? No
Is there breaking changes for older versions? No