Skip to content

fix(saml): accept repeated attribute names, so Keycloak users with roles can sign in - #38080

Merged
mohityadav766 merged 1 commit into
mainfrom
fix/saml-allow-repeated-attribute-names
Nov 18, 2026
Merged

mohityadav766 merged 1 commit into
mainfrom
fix/saml-allow-repeated-attribute-names

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Problem (2.1 SSO release testing, Phase 2 → SAML (Keycloak) 1, High): with Keycloak's default realm settings, a normal user can't sign in through SAML. POST /api/v1/saml/acs → 400 {"error":"SAML response could not be read"}, and the server logs "Found an Attribute element with duplicated Name". Most real Keycloak SAML users are affected.

Cause: Keycloak's default role-list mapper sends one Role Attribute element per role, and every Keycloak user has default-roles-<realm> (offline_access, uma_authorization…). java-saml rejects a repeated attribute name unless allowRepeatAttributeName is enabled, and OpenMetadata never enabled it.

CI misses this because the CI realm's imported user has no roles, so Keycloak sends no Role attributes.

Reproduced on main: I ran the repo's docker/local-sso/keycloak-saml and a SAML Test Login.

  • A new Keycloak user gets 6 Role attributes and fails at "Token validated" with Found an Attribute element with duplicated Name.
  • The imported role-less user passes.

Fix: set onelogin.saml2.security.allow_duplicated_attribute_name=true in SamlSettingsHolder.buildSettings, the one builder used by live sign-in, Test Login and SamlValidator. java-saml then adds a repeated attribute's values to the existing list, so Role becomes one attribute with every role.

Type of change:

  • Bug fix

Tests:

  • New SamlSettingsHolderTest.buildSettingsMergesRepeatedAttributeNames parses a response with two Role attributes through the built settings. It fails on main with ValidationError: Found an Attribute element with duplicated Name and passes with the fix (Role = [offline_access, uma_authorization]).
  • All SAML unit tests (SamlAuthServletHandlerTest, SamlSettingsHolderTest, MockSamlIdpTest, SamlAssertionConsumerServletTest, TestLoginSamlHandlerTest, SsoRedirectBoundaryTest, SamlValidatorTest): 123/123 pass.
  • Worth a follow-up: give the CI realm's user a realm role so the Keycloak nightly covers this.

Needs a 2.1 backport.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

Fixes SAML sign-in for identity providers that send repeated attribute names, including Keycloak users with multiple roles.

  • SAML sign-in accepts repeated attributes from identity providers.

No actionable issues found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "fix(saml): accept repeated attribute nam..." · Reviewed by Greptile

…les can sign in

Keycloak's default role mapper sends one Attribute element per role, all named
"Role", and every Keycloak user has default roles. java-saml rejects a repeated
attribute name unless allowRepeatAttributeName is on, so SAML sign-in and Test
Login failed with "Found an Attribute element with duplicated Name". Turn it on
in the shared settings builder; java-saml then merges the values into one
multi-valued attribute.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chirag-madlani
chirag-madlani requested a review from a team as a code owner November 18, 2026 06:29
@chirag-madlani
chirag-madlani requested review from sonika-shah and a balanced review from Copilot November 18, 2026 06:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Enabling repeated SAML attributes changes the authentication boundary; unexpected merged IdP role claims could affect account access.

Sets onelogin.saml2.security.allow_duplicated_attribute_name=true in SamlSettingsHolder.buildSettings so SAML responses with repeated Role attributes from Keycloak users with realm roles are accepted instead of failing with a 400. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@mohityadav766
mohityadav766 merged commit 656fdaf into main Nov 18, 2026
54 of 56 checks passed
@mohityadav766
mohityadav766 deleted the fix/saml-allow-repeated-attribute-names branch November 18, 2026 12:33
manerow added a commit that referenced this pull request Nov 23, 2026
…ith roles can sign in (backport #38080) (#38447)

* fix(saml): accept repeated attribute names, so Keycloak users with roles can sign in

* Use a text block and named URLs in the repeated SAML attribute test

---------

Co-authored-by: Chirag Madlani <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants