← Back to Pull requests

[ZEPPELIN-6731] Fix LdapRealm login failure caused by unsupported SHA-1 hashing after Shiro 2.0.6 upgrade #5585

Closed
unknown closed this pull request without merging on Oct 24, 2026 01:59 UTC
View on GitHub
unknown unknown commented on Oct 21, 2026 14:40 UTC
Author

What is this PR for?


Since the Shiro 2.0.6 upgrade (ZEPPELIN-6528), logging in through LdapRealm fails with HTTP 403 even with the correct password, because createAuthenticationInfo() hashes the credentials with SHA-1, which Shiro 2's SimpleHashProvider no longer supports (only SHA-256/384/512).

Switching the algorithm alone is not enough. In Shiro 2, DefaultHashService defaults to 50,000 iterations with a random salt, while HashedCredentialsMatcher defaults 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:

  • Switches HASHING_ALGORITHM from SHA-1 to SHA-256.

  • Introduces HASH_ITERATIONS (Shiro's SimpleHashProvider.Parameters.DEFAULT_ITERATIONS) and uses it on both sides: the hash request in createAuthenticationInfo() and the HashedCredentialsMatcher.

  • Adds unit tests covering the createAuthenticationInfo() → credentials matcher path, which previously had no test coverage.
  • What type of PR is it?


    Bug Fix

    Todos


    [x] Switch LdapRealm hashing algorithm from SHA-1 to SHA-256
    [x] Align hash iterations between DefaultHashService and HashedCredentialsMatcher
    [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#testCreateAuthenticationInfoMatchesSubmittedCredentials

  • LdapRealmTest#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-256 only | Match test fails: expected: <true> but was: <false> (iteration mismatch) |
    | This PR | All tests in LdapRealmTest, RoleMappingLdapRealmTest, LdapRealmFilterInjectionTest, LdapRealmDnInjectionTest pass |

    Manual test, following the reproduction steps in the Jira issue (389 Directory Server in Docker, LdapRealm in shiro.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
  • Does this needs documentation? No
  • Diff: 316 lines (+237 / -79) across 3 files Reviewer: jongyoul Review duration: 3559m
    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
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.0% · Safe to merge
    16.0%