Skip to content

[2.1] Fixes #37056: backport SAML and Test Login fixes; align migration to 2.0.10 - #38302

Merged
manerow merged 20 commits into
2.1from
fix/2.1-sso-test-login-migration
Nov 23, 2026
Merged

manerow merged 20 commits into
2.1from
fix/2.1-sso-test-login-migration

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Describe your changes

Fixes #37056.

Backport all application fixes from main #38219 to 2.1 and retain the Test Login migration correction to 2.0.10. All eight application commits cherry-picked cleanly; no branch-specific code adaptations were needed. All 61 changed files match main's final content at 539da72.

Type of change

  • Bug fix

High-level design

  • Preserve IdP signing/unspecified-use certificates, validate active rollover keys, retain future keys, and enforce explicitly required SAML assertion encryption independently of Strict Mode.
  • Align Test Login account admission, Basic email confirmation, confidential OIDC identity/subject binding, and completion/secret cleanup with live sign-in.
  • Include query-cost access fields and search mappings. Existing query-cost indexes require recreate/reindex as documented in the included decision record.
  • Preserve development SSO URLs and callback routing, support namespaced principal claims, and allow custom SAML SP entity IDs and ACS URLs.
  • Move existing MySQL and PostgreSQL session-table DDL unchanged from 2.1.0 to 2.0.10. Existing rows and indexes are preserved.

Counterparts: main #38219; 2.0 migration correction #38301 following merged feature backport #38197.

Jest follow-up (eaffe1b)

The CI failure was a stale English-label expectation after translating Require Encrypted Assertions. Both Strict Mode assertions now expect the translation key returned by the shared Jest mock. No production code changed.

  • All 9 tests in useSsoConfiguration.test.ts passed locally using shared dependencies and a temporary mapping to this checkout's actual icon sources.
  • Changed-file import organization, ESLint, Prettier, diff checks and independent review passed.
  • Full Jest/coverage suite left to CI; the preceding run had 26,805 passing tests and this single failure.

Tests

At 2ca6127:

  • Maven reactor package and 251 focused Java tests passed across 14 classes: BasicAuthenticatorConfirmationTest, EmailFirstUserProvisionerTest, MigrationWorkflowReprocessingTest, MigrationWorkflowTest, PrincipalClaimMappingSchemaTest, QueryCostRecordIndexTest, SamlResponseValidatorTest, SamlSettingsHolderTest, SamlValidatorTest, TestLoginAccountChecksTest, TestLoginCredentialHandlerTest, TestLoginOidcHandlerTest, TestLoginRoundTripTest, TestLoginServiceTest.
  • 342 UI tests passed across SSOUtils, SSOURLUtils, SSOConfigurationForm and useSsoConfiguration.
  • Development callback test passed: node --test scripts/sso-dev-server.test.mjs.
  • Java Spotless, changed-file organize-imports/ESLint/Prettier, impact-map completeness and git diff --check passed without source changes.
  • UI tests reused local dependencies on Node 22.23.4 and a temporary Jest mapping to this checkout's actual core icon sources after the initial dependency resolver failure. No environment workaround is committed.
  • Earlier isolated MySQL 8.0/PostgreSQL 16 checks passed table creation, repeat execution, preservation of an inserted session, primary key and both secondary indexes. Migration SQL is unchanged by this backport.
  • Full backend integration, Playwright, TypeScript checking, coverage measurement and manual IdP acceptance were not run for this backport. No further testing requested.

Local Java test run: PASSED

  • Commit: 2ca612721663 (base origin/2.1)
  • Finished: 2026-11-20 12:11 UTC · 1.7 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 8 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (14 classes) 14 251 0 0 1.7 passed
  • Impacted, not run locally: 17 classes (listed in the details)

Ingestion integration tests

Not applicable — no ingestion changes.

UI screen recording

Not applicable — clean backport of existing correctness fixes.

Checklist

  • Related issue and counterpart PRs linked.
  • Independent review of 2ca6127 confirmed complete clean backport and no blocking compatibility findings.
  • Source schemas, generated TypeScript, regression tests and decision records included unchanged.
  • Focused validation completed; broader checks explicitly pending.

Review follow-up (e0ed059)

Addresses Adria/manerow's review findings and the related bot comments:

  • Keep explicitly configured IdP signing keys at runtime, preserving the pre-upgrade behavior when saved certificates expire. Static configuration validation still requires an active certificate. The new decision record supersedes runtime expiry filtering.
  • Preserve the browser callback separately from a legacy /api/v1/saml/acs assertion endpoint; keep the first usable saved callback, otherwise derive /callback next to the ACS, keeping any base path. A callback that an earlier save set to the ACS URL (equal to it, or ending in /api/v1/saml/acs) counts as unusable and is replaced on the next save; the saved snapshot no longer changes with the form, so the repair reaches the PATCH, and a custom authorizer class and request filter are no longer reset (main: Repair a SAML browser callback saved as the ACS URL #38488). Custom /callback ACS URLs continue to work.
  • Translate Require Encrypted Assertions in all 21 locale catalogs, record the namespaced principal-claim mapping contract, separate certificate decoding, and add final to new unchanged Java locals.
  • Added regression cases for expired-certificate startup settings and legacy ACS/browser redirects. Tests intentionally not rerun at the user's request; earlier passing counts apply to the preceding revision.
  • Java formatting, changed-file UI import organization/lint/formatting, decision-record validation, impact-map completeness (2.1), diff checks and independent code review passed. No new blocking findings in code review.
  • The idpX509Certificate description now says expired keys are kept at runtime, matching the decision record. Jest for SettingsSso and SSOUtils: 13 suites, 467 tests passing after these changes.

RetriggerView in GreptileConfidence Score: 4/5

The remaining SAML help text must use translation keys before merging to satisfy the repository requirement.

Findings

  1. P2 SAML text stays in English ▶

Summary

This PR backports SAML and Test Login fixes to 2.1 and moves the session-table migration to 2.0.10.

  • SAML sign-in enforces encryption rules and keeps configured rollover keys.
  • SAML settings keep the SP endpoints and encryption choice clear.
  • Test Login checks whether a candidate account can sign in.
  • Query-cost search applies the parent query’s access fields.
  • Identity-provider claim mappings accept namespaced claim names.
  • The Test Login session table is created during the 2.0.10 migration.

Reviews (15) · Last reviewed commit: "Keep a configured authorizer class and r..." · Reviewed by Greptile

@mohityadav766
mohityadav766 marked this pull request as ready for review November 20, 2026 12:11
@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.

@mohityadav766
mohityadav766 requested review from a team as code owners November 20, 2026 12:12
@mohityadav766
mohityadav766 requested review from karanh37 and yan-3005 and removed request for a team November 20, 2026 12:12
@mohityadav766 mohityadav766 changed the title [2.1] Fixes #37056: align Test Login migration with 2.0.10 [2.1] Fixes #37056: backport SAML and Test Login fixes; align migration to 2.0.10 Nov 20, 2026
Comment on lines +584 to +598
const resolveSamlBrowserCallback = (
acs: string,
configuredCallback: string | undefined
): string | undefined => {
try {
const url = new URL(acs);

return url.pathname.endsWith('/callback')
? acs
: configuredCallback || `${url.origin}/callback`;
} catch {
return configuredCallback;
}
};

@gitar-bot gitar-bot Bot Nov 20, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Quality: SAML ACS/browser-callback split rule has no decision record

This commit changes the sp.acs / sp.callback / callbackUrl payload that the backend reads. SamlSettingsHolder takes relayState from sp.callback and uses sp.acs as the java-saml ACS URL. cleanupSamlSp no longer forces all three to the same value. It keeps a non-/callback ACS (such as the legacy /api/v1/saml/acs) as its own endpoint and resolves the browser callback in this order: the ACS when it ends in /callback, otherwise the configured root callbackUrl, otherwise sp.callback, otherwise ${origin}/callback. The description states the rule ("The browser callback is kept separate from a legacy /api/v1/saml/acs assertion endpoint, and origin plus /callback is derived only when no browser callback is configured"), but none of docs/decisions/ records it. The repo squash-merges, so the rule would survive only in code. The two ADRs this PR adds or amends cover certificate trust and claim mappings, not this. A record should state: "For SAML, sp.acs is the IdP assertion endpoint and sp.callback/callbackUrl is the browser landing URL. They are equal only when the ACS path ends in /callback. Otherwise the saved browser callback is kept, and <acs origin>/callback is used only when none is configured."

Add an amendment to the 2026-11-19 SAML ADR, or write a new record, that states the ACS/callback precedence rule.:

## Amendment v3 — ACS and browser callback are distinct
`sp.acs` is the IdP assertion endpoint; `sp.callback` and `callbackUrl` are the browser landing URL.
They are equal only when the ACS path ends in `/callback`. Otherwise the configured browser
callback (root `callbackUrl`, then `sp.callback`) is kept, and `<acs origin>/callback` is derived
only when none is configured. A legacy `/api/v1/saml/acs` ACS is never used as the browser callback.

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 🔴 High risk 2 closed / 3 findings

SAML trust and assertion checks and query-cost access controls could alter sign-in and SQL-record visibility; moving session-table DDL changes upgrade schema timing.

Preserves SAML IdP signing certificates, enforces required assertion encryption, aligns Test Login admission and OIDC subject binding, and moves the session-table migration to 2.0.10. Changes requested: the new ACS/browser-callback resolution rule in SSOUtils.ts has no decision record under docs/decisions/, so the rule exists only in code. Expired-only IdP certificates now fail startup and SAML logins, which was resolved in this review.

⚠️ Quality: SAML ACS/browser-callback split rule has no decision record

📄 openmetadata-ui/src/main/resources/ui/src/utils/SSOUtils.ts:584-598 📄 openmetadata-ui/src/main/resources/ui/src/utils/SSOUtils.test.ts:712-726

This commit changes the sp.acs / sp.callback / callbackUrl payload that the backend reads. SamlSettingsHolder takes relayState from sp.callback and uses sp.acs as the java-saml ACS URL. cleanupSamlSp no longer forces all three to the same value. It keeps a non-/callback ACS (such as the legacy /api/v1/saml/acs) as its own endpoint and resolves the browser callback in this order: the ACS when it ends in /callback, otherwise the configured root callbackUrl, otherwise sp.callback, otherwise ${origin}/callback. The description states the rule ("The browser callback is kept separate from a legacy /api/v1/saml/acs assertion endpoint, and origin plus /callback is derived only when no browser callback is configured"), but none of docs/decisions/ records it. The repo squash-merges, so the rule would survive only in code. The two ADRs this PR adds or amends cover certificate trust and claim mappings, not this. A record should state: "For SAML, sp.acs is the IdP assertion endpoint and sp.callback/callbackUrl is the browser landing URL. They are equal only when the ACS path ends in /callback. Otherwise the saved browser callback is kept, and <acs origin>/callback is used only when none is configured."

Add an amendment to the 2026-11-19 SAML ADR, or write a new record, that states the ACS/callback precedence rule.
## Amendment v3 — ACS and browser callback are distinct
`sp.acs` is the IdP assertion endpoint; `sp.callback` and `callbackUrl` are the browser landing URL.
They are equal only when the ACS path ends in `/callback`. Otherwise the configured browser
callback (root `callbackUrl`, then `sp.callback`) is kept, and `<acs origin>/callback` is derived
only when none is configured. A legacy `/api/v1/saml/acs` ACS is never used as the browser callback.
✅ 2 closed
✅ Bug: Expired-only IdP certificate now fails startup and all SAML logins

📄 openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java:130-141 📄 openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlCertificates.java:48-58 📄 docs/decisions/2026-11-19-saml-encryption-policy-and-rollover-certificates.md:33-45
buildSettings now goes through SamlCertificates.parseUnexpiredIdpCertificates, which throws CertificateException when every configured IdP certificate is past notAfter. Before this change the PEM went to java-saml unchanged, and java-saml checks signatures without looking at certificate validity, so deployments whose IdP still signs with an expired cert (common with self-signed ADFS/Keycloak keys) were working. After this 2.1 patch upgrade, initDefaultSettings is called from OpenMetadataApplication while servlets are registered at startup, the exception propagates, and the server does not start. If the server does start, every live SAML login and Test Login fails. The new ADR's upgrade procedure covers wantAssertionEncrypted but says nothing about this lockout. Either fall back to the configured certificates with a loud warning when none are unexpired, keeping the strict check in the static validator, or catch the error at startup and document the upgrade step in the ADR.

✅ Quality: jwtPrincipalClaimsMapping pattern contract widened with no decision record

📄 openmetadata-spec/src/main/resources/json/schema/configuration/authenticationConfiguration.json:96 📄 openmetadata-ui/src/main/resources/ui/src/jsons/configuration/authenticationConfiguration.json:128
The JSON Schema pattern for jwtPrincipalClaimsMapping items changes from ^(username|email):[a-zA-Z0-9_-]+$ to ^(username|email):[^\s]+$. That changes a schema contract shared by the generated Java, TypeScript and Python clients, and by any stored configuration validated against it. The description calls this "support namespaced principal claims", but none of the records in docs/decisions/ (including the two added here, which cover query-cost access fields and SAML encryption/rollover) states the rule. A record should assert something like: "A principal claim mapping is username: or email: followed by any non-whitespace claim name, including URN and URI claim names such as urn:oid:… and http://schemas.xmlsoap.org/…/emailaddress."

🤖 Prompt for agents
Code Review: Preserves SAML IdP signing certificates, enforces required assertion encryption, aligns Test Login admission and OIDC subject binding, and moves the session-table migration to 2.0.10. Changes requested: the new ACS/browser-callback resolution rule in SSOUtils.ts has no decision record under `docs/decisions/`, so the rule exists only in code. Expired-only IdP certificates now fail startup and SAML logins, which was resolved in this review.

1. ⚠️ Quality: SAML ACS/browser-callback split rule has no decision record
   Files: openmetadata-ui/src/main/resources/ui/src/utils/SSOUtils.ts:584-598, openmetadata-ui/src/main/resources/ui/src/utils/SSOUtils.test.ts:712-726

   This commit changes the `sp.acs` / `sp.callback` / `callbackUrl` payload that the backend reads. `SamlSettingsHolder` takes `relayState` from `sp.callback` and uses `sp.acs` as the java-saml ACS URL. `cleanupSamlSp` no longer forces all three to the same value. It keeps a non-`/callback` ACS (such as the legacy `/api/v1/saml/acs`) as its own endpoint and resolves the browser callback in this order: the ACS when it ends in `/callback`, otherwise the configured root `callbackUrl`, otherwise `sp.callback`, otherwise `${origin}/callback`. The description states the rule ("The browser callback is kept separate from a legacy /api/v1/saml/acs assertion endpoint, and origin plus /callback is derived only when no browser callback is configured"), but none of `docs/decisions/` records it. The repo squash-merges, so the rule would survive only in code. The two ADRs this PR adds or amends cover certificate trust and claim mappings, not this. A record should state: "For SAML, `sp.acs` is the IdP assertion endpoint and `sp.callback`/`callbackUrl` is the browser landing URL. They are equal only when the ACS path ends in `/callback`. Otherwise the saved browser callback is kept, and `<acs origin>/callback` is used only when none is configured."

   Fix (Add an amendment to the 2026-11-19 SAML ADR, or write a new record, that states the ACS/callback precedence rule.):
   ## Amendment v3 — ACS and browser callback are distinct
   `sp.acs` is the IdP assertion endpoint; `sp.callback` and `callbackUrl` are the browser landing URL.
   They are equal only when the ACS path ends in `/callback`. Otherwise the configured browser
   callback (root `callbackUrl`, then `sp.callback`) is kept, and `<acs origin>/callback` is derived
   only when none is configured. A legacy `/api/v1/saml/acs` ACS is never used as the browser callback.

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

@manerow
manerow merged commit 172de8b into 2.1 Nov 23, 2026
57 of 62 checks passed
@manerow
manerow deleted the fix/2.1-sso-test-login-migration branch November 23, 2026 14:04
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.

2 participants