Skip to content

Fixes #37056: Sign the SAML configuration check and show the IdP's error reason - #37436

Merged
mohityadav766 merged 4 commits into
mainfrom
fix/37056-saml-signed-probe
Nov 11, 2026
Merged

mohityadav766 merged 4 commits into
mainfrom
fix/37056-saml-signed-probe

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #37056

Saving or validating a SAML configuration checks the IdP SSO Login URL by sending it a sign-in request, and blocks the save when the IdP rejects it. That check had two problems, on 2.0.7 and on main alike:

  1. It never signed the request. It built its own AuthnRequest and sent it unsigned, even with Send Signed Auth Request on. A Microsoft Entra application that requires signed requests answers that with AADSTS76021: The request sent by client is not signed while the application requires signed requests, so a configuration that does sign could not be saved. This is the SAML config: “SSO URL returned error (HTTP 400)” on Entra IdP SSO Login URL when signed-request options are enabled #37056 scenario.
  2. It hid the IdP's reason. It read the first 500 bytes of the reply and showed SSO URL returned error (HTTP 400). Please verify the URL is correct. Entra renders its error page from a $Config script, so the AADSTS code sits past byte 500 (byte 1417 on a live AADSTS90002 page) and never reached the admin.

What changes in SamlValidator:

  • The check sends the request the live login sends. OneLogin builds it from the candidate configuration with SamlSettingsHolder.buildSettings and signs it when request signing is on. Its RelayState is openmetadata-configuration-check.
  • A rejection carries the IdP's reason. The new IdpErrorResponse reads Entra's strServiceExceptionMessage (JSON- and HTML-unescaped), or for other IdPs the first 300 characters of the page's visible text. At most 64 KiB of the reply is read. For example: The identity provider rejected the SAML sign-in request (HTTP 400): AADSTS76021: The request sent by client is not signed while the application requires signed requests.
  • A 4xx whose first bytes mention "saml" or "invalid" no longer passes as a warning. The request is now the real one, so its rejection is the live login's rejection.
  • An SP private key OneLogin cannot load, such as a PKCS#1 BEGIN RSA PRIVATE KEY, is reported on the SP private key field. The live login could not start with it either. The request is built before the outbound URL policy is asked, so this also holds for an IdP the policy does not let the server probe, such as one on a private network; nothing is sent to it.
  • Unchanged:
    • the 404 and 405 messages;
    • an IdP the server cannot reach is still a warning;
    • the outbound URL policy (isProbeAllowed) still decides whether the request is sent.

The rule is recorded in ADR:2026-11-09-the-saml-configuration-check-sends-the-live-sign-in-request. The 2.0 backport, for 2.0.8, is #37437.

Login (ACS). The same Entra setup hid a second reason. When java-saml rejected a posted response, the ACS threw SAML authentication failed before reading java-saml's reason, so the browser got {"error":"SAML authentication failed"}. The branch meant to report getLastErrorReason() could never run, because java-saml records errors only when it does not authenticate.

  • The login now fails with SAML response rejected: <java-saml's reason>, the form SamlResponseValidator already uses for its own checks. An SP in strict mode that wants signed messages, behind an Entra application that signs only the assertion, now answers SAML response rejected: The Message of the Response is not signed and the SP requires it.
  • The acceptance check moved into SamlResponseValidator. Test Login shares it now instead of keeping its own copy.

The settings form offers only the security switches that apply. Checking the form against the backend found two gaps:

  • Want Messages Signed and Want Assertions Signed are separate switches, but java-saml checks them only in strict mode, so with Strict Mode off they did nothing. The form now shows them only while Strict Mode is on (useSsoConfiguration). The backend is unchanged: they still apply only in strict mode, so no login that works today stops working. Values stored while the switches are hidden are kept and apply once Strict Mode is on.
  • Enforcing the two switches without Strict Mode was in an earlier commit of this PR and is reverted. It would stop a working login on upgrade wherever the IdP does not sign the element a switch names (Keycloak's default client signs the Response but not the Assertion), and with SAML as the only login the admin could not reach the form to turn the switch off.
  • The SP certificate and key from the form reached java-saml only when Send Signed Auth Request (or the hidden Want Assertion Encrypted) was on. Entra encrypts assertions once token encryption is on, so with request signing off the assertion could not be decrypted. They now go to java-saml whenever they are filled in; the keystore is still read only when signing or encryption needs it.
  • Recorded in ADR:2026-11-10-saml-security-settings-mean-what-the-form-shows.

Type of change:

  • Bug fix

High-level design:

N/A — small change: one validator, one new helper class, one settings-form rule, tests and two decision records.

Tests:

Use cases covered

  • Strict Mode off: the SAML form hides Want Messages Signed and Want Assertions Signed. Turning Strict Mode on shows them.
  • SP key filled in with request signing off: java-saml gets the key, so assertions Entra encrypts can be decrypted.
  • Strict mode with signed messages wanted, and an IdP that signs only the assertion: the login fails with java-saml's reason, not SAML authentication failed.
  • Request signing on, and the IdP requires signed requests (Entra "Require verification certificates"): validation passes, and the IdP verified the HTTP-Redirect signature with the SP certificate.
  • Request signing off, against the same IdP: the error carries the IdP's AADSTS76021 reason instead of the generic text.
  • An SP private key OneLogin cannot load: the error is on the SP private key field, also for an IdP the URL policy does not let the server probe.
  • Settings OneLogin cannot build (encrypted assertions without SP credentials): reported, not passed.
  • 4xx and 5xx with and without a readable body, an unreachable IdP (still a warning), a malformed SSO Login URL (rejected before any request), Entra JSON and HTML escaping, long Entra messages.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files:
    • SamlValidatorTest: a fake IdP that verifies the signature, the Entra rejection reason, the unloadable SP key (validateIdpConnectivityReportsAnUnusableSpKeyForAnIdpItMayNotProbe for an IdP on a private network), the 4xx and 5xx reasons, the unreachable IdP.
    • New IdpErrorResponseTest.
    • SamlAuthServletHandlerTest.handleCallback_showsWhyJavaSamlRejectedTheResponse: a strict SP that wants signed messages receives a MockSamlIdp response whose assertion alone is signed.
    • SamlSettingsHolderTest (buildSettingsGivesJavaSamlTheSpKeyWithoutRequestSigning, buildSettingsReadsTheKeyStoreWithItsPassword).
    • useSsoConfiguration.test.ts: "offers the SAML signing switches only while Strict Mode is on".
  • RED on the unchanged main validator: 10 tests failed, including:
    • expected: <The identity provider rejected the SAML sign-in request (HTTP 400): AADSTS76021: …> but was: <SSO URL returned error (HTTP 400). Please verify the URL is correct.>
    • with signing on: expected: <null> but was: <FieldError[… error=SSO URL returned error (HTTP 400). Please verify the URL is correct.]>
  • RED for the ACS on the unchanged handler: the new handler test failed (1 of 26), with {"error":"SAML authentication failed"} on the wire.
  • RED for the SP key on the unchanged SamlSettingsHolder: the SP-key test found getSPkey() null.
  • RED for the review fixes, each on the commit before it:
    • the private-network test got no error: expected: not <null>;
    • on the unchanged hook, the form test found Want Messages Signed offered with Strict Mode off: expected {"ui:hideError": true, "ui:widget": "hidden"}, received {"ui:title": "Want Messages Signed"}.
  • GREEN:
    • backend: 127 passed: SamlValidatorTest 71, IdpErrorResponseTest 10, SamlAuthServletHandlerTest 26, SamlResponseValidatorTest 5, TestLoginSamlHandlerTest 4, MockSamlIdpTest 3, SamlSettingsHolderTest 3, SystemRepositorySecurityConfigValidationTest 5 (mvn -o package -pl openmetadata-service -am -Dtest=...);
    • UI: jest src/components/SettingsSso: 210 passed in 12 suites.
  • Coverage on changed lines (JaCoCo, same run): 110/110 changed executable lines (100%): SamlValidator 58/58, SamlSettingsHolder 22/22, IdpErrorResponse 20/20, SamlResponseValidator 6/6, TestLoginSamlHandler 3/3, SamlAuthServletHandler 1/1.

Backend integration tests

  • Not applicable (no backend API changes).
  • SamlSecurityConfigIT and the SSO mock-IdP ITs post SAML configurations to /system/security/validate and /system/security/config. Their SSO Login URLs are .invalid hosts and request signing is off, so the check stays a connection warning there. They run in the merge queue.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not added. The UI change is one uiSchema rule, covered by the hook's Jest test. On main, SSOConfiguration.spec.ts keeps only the metadata-upload flow and does not check these switches. The settings-sso-saml visual baseline ends at IdP Entity ID, above the security switches, so it does not change.
  • Not run locally. make playwright_affected reports impact-map gaps for the changed files, so the merge queue runs the full suite.

Manual testing performed

  1. Strict mode and Want Messages Signed on, behind Entra's default signing (assertion only): the login answered {"error":"SAML authentication failed"}, while the server log carried The Message of the Response is not signed and the SP requires it. With Want Messages Signed off, the same Entra application logged in.
  2. On 2.0.7, an Entra application that requires signed requests showed SSO URL returned error (HTTP 400). Please verify the URL is correct. on the SSO Login URL field, while Entra's error page carried AADSTS76021 in its $Config script.
  3. Sent an unsigned AuthnRequest to Entra for an unknown tenant. It answered HTTP 400 with strServiceExceptionMessage at byte 1417, its quotes escaped as &#39;. reasonOfDecodesHtmlEntitiesInTheEntraMessage covers that page.
  4. Sent the same request to login.microsoftonline.com/common/saml2. It answered HTTP 200 with the sign-in page, so the check passes there, as before.
  5. Pending: a signed check request against a real Entra application with a verification certificate.

UI screen recording:

Not applicable — a standalone bug fix. The only UI change is that the SAML form hides Want Messages Signed and Want Assertions Signed while Strict Mode is off; the Jest test above covers both states.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation>

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: not applicable, no schema changes.

  • For a UI feature or feature task: not applicable, a bug fix; see "UI screen recording".

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md. It led me to log only the message for request-building failures, drop a guard for an SSO URL basic validation already rejects, and remove a null check for a stream the contract never returns.

  • Decision check: docs/decisions/2026-11-09-the-saml-configuration-check-sends-the-live-sign-in-request.md and docs/decisions/2026-11-10-saml-security-settings-mean-what-the-form-shows.md.

  • I have added a test that covers the exact scenario we are fixing (validateSamlConfigurationSignsTheCheckRequestWhenRequestSigningIsOn, validateSamlConfigurationShowsTheIdpReasonWhenItRejectsAnUnsignedRequest).

🤖 Generated with Claude Code

…ason

The SAML validator checked the IdP SSO Login URL with a hand-built
AuthnRequest that was never signed. It read the first 500 bytes of the
reply, let a 4xx pass when those bytes mentioned "saml" or "invalid", and
otherwise said "SSO URL returned error (HTTP 400). Please verify the URL
is correct." A Microsoft Entra application that requires signed requests
answers an unsigned request with AADSTS76021, so a configuration with
Send Signed Auth Request on could not be saved, and Entra's reason, which
sits in the page's $Config script past byte 500, was never shown.

- The check sends the request the live login sends: OneLogin builds it
  from the candidate configuration with SamlSettingsHolder.buildSettings
  and signs it when request signing is on.
- A rejection carries the IdP's own reason: Entra's AADSTS message from
  $Config, otherwise the page's visible text (IdpErrorResponse).
- A 4xx that mentions "saml" or "invalid" no longer passes as a warning,
  since the check request is now the real one.
- An SP private key OneLogin cannot load is reported on the SP private
  key field, because the live login cannot start with it either.
- Recorded in
  ADR:2026-11-09-the-saml-configuration-check-sends-the-live-sign-in-request.
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

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 self-assigned this Nov 9, 2026
The ACS threw "SAML authentication failed" as soon as java-saml did not
accept a response, before reading its reason, so the person signing in
never learned the cause. The branch that was meant to report
getLastErrorReason() could not run: java-saml only records errors when
it does not authenticate.

The login now fails with "SAML response rejected: <java-saml's reason>",
as SamlResponseValidator already reports its own checks. For example, an
SP in strict mode that wants signed messages, behind an Entra
application that signs only the assertion, now answers "SAML response
rejected: The Message of the Response is not signed and the SP requires
it". SamlResponseValidator holds the acceptance check, which Test Login
now shares instead of keeping its own copy.
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSO Login Nightly — PASSED

View workflow run · Commit 3674b27

Provider Status Pass Fail Flaky Skip Duration
basic ✅ pass 28 0 0 0 6m 08s
ldap ✅ pass 7 0 0 0 0m 43s
keycloak-oidc-confidential ✅ pass 12 0 0 0 1m 40s
keycloak-oidc-public ✅ pass 11 0 0 0 1m 26s
msal-mock ✅ pass 7 0 0 0 0m 57s
auth0-mock ✅ pass 6 0 0 0 0m 57s
okta ⏩ skipped - - - - -
keycloak-azure-saml ✅ pass 23 0 0 0 6m 24s
keycloak-azure-saml-crosssite ⏩ skipped - - - - -

Totals: 94 passed · 0 failed · 0 flaky · 0 skipped · duration 18m 18s

The settings form offers Want Messages Signed and Want Assertions Signed
as switches of their own, but java-saml checks them only in strict mode,
so with strict mode off they did nothing. SamlResponseValidator, which
already applies java-saml's strict-only checks to every response, now
also rejects a response whose Response or Assertion element lacks the
signature the switch asks for, in java-saml's wording.

The SP certificate and private key from the form reached java-saml only
when the SP signed requests or required encrypted assertions, and the
form hides the encryption switch. Microsoft Entra encrypts assertions
once token encryption is on, so with request signing off the assertion
could not be decrypted even though the key was filled in. The
certificate and key now go to java-saml whenever they are configured;
the keystore is still read only when signing or encryption needs it.

Recorded in
ADR:2026-11-10-saml-security-settings-mean-what-the-form-shows.
Comment on lines +114 to +122
private static void requireRequestedSignatures(
Saml2Settings settings, List<String> signedElements) {
if (settings.getWantMessagesSigned() && !signedElements.contains(SIGNED_RESPONSE)) {
throw rejected(UNSIGNED_MESSAGE);
}
if (settings.getWantAssertionsSigned() && !signedElements.contains(SIGNED_ASSERTION)) {
throw rejected(UNSIGNED_ASSERTION);
}
}

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.

Turning these two switches on with Strict Mode off used to do nothing, and now it rejects the login. So a deployment that turned one on, behind an IdP that doesn't sign that element, stops logging in right after the upgrade. Keycloak's default client is one example: it signs the Response but not the Assertion, so with Want Assertions Signed on, every login fails with "The Assertion of the Response is not signed and the SP requires it".

If SAML is the only way to log in, the admin can't open the settings form to turn the switch off. The decision record covers the change, but the PR has nothing that reaches the people upgrading, like a release or upgrade note.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed, reverted in 70087c4. SamlResponseValidator no longer applies Want Messages Signed / Want Assertions Signed, so java-saml applies them only in strict mode, as before this PR, and no working login changes on upgrade. Instead the settings form shows the two switches only while Strict Mode is on, so it no longer offers a switch that does nothing; stored values are kept. The ADR now records that, and why enforcing them was rejected (your Keycloak example).

Comment on lines 319 to 321
if (!isProbeAllowed(samlConfig.getIdp().getSsoLoginUrl())) {
return null;
}

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.

When the outbound URL policy refuses the SSO Login URL, validateIdpConnectivity returns before buildSignInUrl runs. So for an IdP on a private network, such as an on-premises ADFS, a configuration OneLogin can't turn into a sign-in request still saves. One example is Send Signed Auth Request on with a PKCS#1 SP key. The live login then fails on it, whatever the URL policy says. The decision record says a configuration like this fails the check. Gitar raised the same point and it's still open.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 70087c4. validateIdpConnectivity builds the sign-in request first and asks isProbeAllowed only before sending it. validateIdpConnectivityReportsAnUnusableSpKeyForAnIdpItMayNotProbe covers it: request signing with a PKCS#1 key, behind 169.254.169.254, gets the SP-key field error, and openConnection is never called.

…ng them

The previous commit made Want Messages Signed and Want Assertions Signed
hold with strict mode off. That would stop a working login on upgrade
wherever the identity provider does not sign the element a switch names
(Keycloak's default client signs the Response but not the Assertion),
and an admin whose only login is SAML could not reach the form to turn
the switch off. SamlResponseValidator no longer applies the two
switches; java-saml applies them in strict mode, as before.

The settings form now shows the two switches only while Strict Mode is
on, so it no longer offers a switch that does nothing. Values stored
while they are hidden are kept and take effect once Strict Mode is on.
The SP certificate and key still go to java-saml whenever they are
configured.

The configuration check now builds the sign-in request before it asks
the outbound URL policy whether it may send it. Building needs no
network, so a configuration the live login cannot turn into a request,
such as request signing with a PKCS#1 SP key, fails the check even for
an identity provider on a private network that the policy does not let
the server probe.

ADR:2026-11-10-saml-security-settings-mean-what-the-form-shows is
updated to match.
@mohityadav766
mohityadav766 requested a review from a team as a code owner November 10, 2026 19:30
@gitar-bot

gitar-bot Bot commented Nov 10, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Enforcing SAML message and assertion signatures changes login acceptance and could lock users out when an IdP omits a configured signature.

Makes the SAML configuration check sign its probe request when request signing is on and surface the IdP's rejection reason, and enforces Want Messages/Assertions Signed with or without Strict Mode. One resolved item: an unloadable SP private key no longer passes when the URL policy refuses the probe. No open issues remain.

✅ 1 closed
✅ Edge Case: Unloadable SP key passes when the URL policy refuses the probe

📄 openmetadata-service/src/main/java/org/openmetadata/service/security/auth/validator/SamlValidator.java:318-332 📄 docs/decisions/2026-11-09-the-saml-configuration-check-sends-the-live-sign-in-request.md:29-30
validateIdpConnectivity returns null as soon as isProbeAllowed refuses the SSO URL, so buildSignInUrl never runs. Building the request needs no network access. The result is that a configuration OneLogin cannot turn into a sign-in request still saves: for example, sendSignedAuthRequest on with a PKCS#1 SP key, or an unreadable keystore path. That only happens when the IdP URL is one the outbound policy blocks, such as an IdP on a private network. The new ADR says "A configuration OneLogin cannot turn into that request fails the check, because the live login cannot start either", and the PR description says the same. Live login breaks on these configurations however the URL policy answers. The fix is to build the sign-in URL first and apply the outbound policy only to the HTTP request.

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 8d0a6ab into main Nov 11, 2026
74 of 76 checks passed
@mohityadav766
mohityadav766 deleted the fix/37056-saml-signed-probe branch November 11, 2026 07:09
mohityadav766 added a commit that referenced this pull request Nov 11, 2026
…ror reason (backport 2.0 #37436) (#37437)

* Fixes #37056: sign the SAML configuration check and show the IdP's reason

The SAML validator checked the IdP SSO Login URL with a hand-built
AuthnRequest that was never signed. It read the first 500 bytes of the
reply, let a 4xx pass when those bytes mentioned "saml" or "invalid", and
otherwise said "SSO URL returned error (HTTP 400). Please verify the URL
is correct." A Microsoft Entra application that requires signed requests
answers an unsigned request with AADSTS76021, so a configuration with
Send Signed Auth Request on could not be saved, and Entra's reason, which
sits in the page's $Config script past byte 500, was never shown.

- The check sends the request the live login sends: OneLogin builds it
  from the candidate configuration and signs it when request signing is
  on. SamlSettingsHolder.buildSettings is extracted from
  initDefaultSettings for this, as on main, and closes the keystore
  stream it opens.
- A rejection carries the IdP's own reason: Entra's AADSTS message from
  $Config, otherwise the page's visible text (IdpErrorResponse).
- A 4xx that mentions "saml" or "invalid" no longer passes as a warning,
  since the check request is now the real one.
- An SP private key OneLogin cannot load is reported on the SP private
  key field, because the live login cannot start with it either.

* Show why java-saml rejected a SAML response at the ACS

The ACS threw "SAML authentication failed" as soon as java-saml did not
accept a response, before reading its reason, so the person signing in
never learned the cause. The branch that was meant to report
getLastErrorReason() could not run: java-saml only records errors when
it does not authenticate.

The login now fails with "SAML response rejected: <java-saml's reason>".
For example, an SP in strict mode that wants signed messages, behind an
Entra application that signs only the assertion, now answers "SAML
response rejected: The Message of the Response is not signed and the SP
requires it".

* Make the SAML security switches mean what the settings form shows

The settings form offers Want Messages Signed and Want Assertions Signed
as switches of their own, but java-saml checks them only in strict mode,
so with strict mode off they did nothing. The ACS now also rejects a
response whose Response or Assertion element lacks the signature the
switch asks for, in java-saml's wording, whether or not strict mode is
on.

The SP certificate and private key from the form reached java-saml only
when the SP signed requests or required encrypted assertions, and the
form hides the encryption switch. Microsoft Entra encrypts assertions
once token encryption is on, so with request signing off the assertion
could not be decrypted even though the key was filled in. The
certificate and key now go to java-saml whenever they are configured;
the keystore is still read only when signing or encryption needs it.

* Show the SAML signing switches only in strict mode instead of enforcing them

The previous commit made the ACS apply Want Messages Signed and Want
Assertions Signed with strict mode off. In a patch release that would
stop a working login wherever the identity provider does not sign the
element a switch names, and an admin whose only login is SAML could not
reach the form to turn the switch off. The ACS no longer applies the
two switches; java-saml applies them in strict mode, as before.

The settings form now shows the two switches only while Strict Mode is
on, as on main. Values stored while they are hidden are kept and take
effect once Strict Mode is on. The SP certificate and key still go to
java-saml whenever they are configured. The Playwright check of the
SAML form's fields moves the two switches to a test that turns Strict
Mode on.

2.0 has no outbound URL policy in front of the configuration check, so
its SSO Login URL can name any address the server reaches. The field
error now carries only a reason in Microsoft Entra's own error format;
for any other page it gives the HTTP status, and the page text goes to
the server log.
mohityadav766 added a commit that referenced this pull request Nov 16, 2026
…ion (#37741)

* fix(sso): return a failed OIDC sign-in to the sign-in page with its reason

The confidential OIDC callback answered a provider that refused the
sign-in, a code exchange that failed or never answered (a wrong client
secret among them) and a user the deployment may not provision with a
raw 500 page. It now redirects to /signin?error=<code> with one of three
fixed codes, and the reported detail stays in the server log. The
sign-in page shows a translated message for the code and does not
auto-redirect to the provider while it shows one. A sign-in started by
an MCP client keeps the error status its callback reads.

Release testing, SSO row: OC-07, OC-14, OC-17, ID-13.
ADR:2026-11-12-a-failed-sso-sign-in-returns-to-the-sign-in-page

* fix(sso): keep the server's own tokens valid when the provider algorithm changes

tokenValidationAlgorithm names the identity provider's signing
algorithm, but the server also signed and verified its own bot,
personal access, session and MCP tokens with it, so changing it (to
RS512, say) made all of them fail at once. The server now signs its
own tokens with RS256 and verifies them with the RSA algorithm they
name; the setting applies to the provider's tokens only. MCP discovery
advertises RS256 for the tokens the server issues.

Release testing, SSO row: OP-13.
ADR:2026-11-12-openmetadata-signs-its-own-tokens-with-rs256

* fix(sso): save SSO settings only when the server can apply them

- A configuration the server cannot apply (a failing LDAP bind, a
  keystore it cannot read, LDAPS without a trust store) is put back to
  the previous one and refused with 400 and the reason, instead of
  staying stored behind a 500 or a 401.
- A PUT also refuses, without contacting the provider, a client
  authentication method the server cannot perform, and SAML request or
  metadata signing without the SP certificate and key. Full validation
  also checks the method against the provider's discovery document.
- LDAPS without a trust store type fails with a readable reason.
- A PATCH is filtered by the provider it leaves in place, so it can
  switch provider, and a PATCH that only sets values the provider does
  not use is refused instead of answering 204.

Release testing, SSO row: OC-15, SA-11, CF-02, CF-03, LD-12.
ADR:2026-11-12-a-security-configuration-save-applies-in-full-or-is-refused

* fix(sso): handle concurrent first SAML sign-ins and posts that are no SAML response

Two first SAML sign-ins of one new user raced to create the account and
the loser got a 500. It now signs in to the account the winner created,
as the OIDC sign-in already does, through a helper both now share in
UserUtil. A post to the assertion consumer service that is no SAML
response is refused with 400 instead of a 500.

Release testing, SSO row: the SAML first-login race and SA-17. Adds
tests for SA-03, which #37436 already fixed.

* fix(sso): preserve valid legacy RSA bot tokens during stale rotation

* fix(sso): accept SAML request signing with a keystore when saving

A PUT, and a PATCH before it, refused SAML request signing whose SP key
and certificate come from a keystore (keyStoreFilePath, keyStoreAlias
and keyStorePassword, the SAML_KEYSTORE_* route in conf/openmetadata.yaml)
with "SP X509 certificate is required when request signing is enabled",
although sign-in signs with that keystore. A GET and then a PUT of such a
deployment's configuration answered 400.

The save check now asks SamlSettingsHolder.readsSpCredentialsFromKeyStore,
which sign-in uses to choose its credentials, and needs the PEM values
only where sign-in reads no keystore: an incomplete keystore, or metadata
signing on its own.

* test(sso): make the SAML keystore save case reach the put-back

The case set request signing with a keystore on a configuration without
SP PEM values, so the check made before anything is written refused it
and the store, apply and put-back path never ran.

It now names a file that exists but is not a keystore. The save passes
the check, is stored, and fails when the server loads the keystore. The
case checks that the 400 says the configuration could not be applied,
and that the stored, running and read configurations are the previous
ones. With the put-back removed it fails on "the refused save was
stored".

* fix(sso): put a refused security save back only over itself, and report a failed put-back

When the server could not apply a saved security configuration, it wrote
the previous one back with createOrUpdate, which answers a failed write
with a 500 Response that was ignored, and it wrote it whatever the rows
held by then.

- Putting the previous configuration back is a compare-and-set against
  the JSON the refused save wrote, which the write now returns. A save
  made meanwhile, for example by another admin while this one waited on
  a slow LDAP bind, is kept and the refused save is answered 412.
- A put-back that fails is logged and answered 500, saying the refused
  configuration may still be stored, instead of 400 "it was not saved".
- PUT writes with the same compare-and-set as PATCH, over the rows it
  read, so what it puts back is what it replaced; a PUT racing another
  save is answered 412, as a PATCH is. Its writes throw instead of
  returning an ignored error response.
- After a 412 the server applies what is stored with
  reloadIfStoredChanged; if that fails it is logged, so the caller still
  gets the 412.

* docs(adr): amend MCP discovery to advertise the server's own signing algorithm

The 2026-10-19 MCP discovery record said id_token_signing_alg_values_supported
is the configured tokenValidationAlgorithm, while the 2026-11-12 RS256 record
says the server signs its own tokens with RS256 whatever that setting is, and
discovery advertises RS256. The code already does the latter: discovery
advertises JWTTokenGenerator.SIGNING_ALGORITHM, which every token the server
issues, MCP access tokens included, is signed with.

The older record gets a v2 amendment that replaces that clause, and the RS256
record points at it. A unit test checks that discovery advertises the
algorithm of the tokens the server issues while the provider is on RS512.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAML config: “SSO URL returned error (HTTP 400)” on Entra IdP SSO Login URL when signed-request options are enabled

4 participants