Skip to content

Fixes 28619: Accept Okta SAML certificates whose CN is the org name - #33446

Merged
ShaileshParmar11 merged 5 commits into
mainfrom
fix/28619-okta-saml-certificate-validation
Sep 19, 2026
Merged

ShaileshParmar11 merged 5 commits into
mainfrom
fix/28619-okta-saml-certificate-validation

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #28619

SamlValidator rejected valid Okta SAML configurations because it required the IdP certificate's
Common Name to equal the Entity ID host. Okta Entity IDs are always http://www.okta.com/{appId}
— a format validateBasicSamlConfig itself enforces — so the host is always the literal
www.okta.com, while Okta issues application signing certificates with CN=<org short name>. The
two are different namespaces by Okta's design, so the branch was unsatisfiable and every
legitimate Okta configuration was rejected on save with:

IdP certificate validation failed: Okta certificate validation failed.
Certificate CN '<org>' does not match Entity ID domain 'www.okta.com'

The only value that could pass was a CN of literally *.okta.com, which Okta never issues — and
which was the sole case the existing unit test covered. That is why this shipped.

The check had no security value. The IdP certificate is a trust anchor the admin copies out of
the IdP's own metadata; it is handed to OneLogin's SettingsBuilder.IDP_X509CERT_PROPERTY_KEY
(SamlSettingsHolder.java) and used to verify assertion signatures against its public key. SAML
performs no PKIX name validation, so the CN is never consulted at authentication time. The rule was
a guess about vendor naming conventions, not a control.

The same defect was armed in the sibling branches, so all of them are fixed together:

Branch Rule Breaks on
Okta CN == entityIdDomain || CN == "*.okta.com" every Okta configuration
Auth0 CN == entityIdDomain exactly Auth0 custom domains
Azure CN.contains("Microsoft Azure") any change to Microsoft's cert naming
non-Azure reject any CN containing Microsoft Azure legitimate reuse

Changes

  1. SamlValidator — the four throwing branches collapse into the warn-and-continue path that
    already existed for generic providers. A CN that differs from the Entity ID host is logged at
    INFO (not WARN: it is the expected shape for Okta, Auth0 custom domains and Azure, so warning
    on every valid configuration would just train operators to ignore warnings). The checks that
    carry meaning are untouched — the certificate must still parse as X.509 and be inside its
    validity window. Net −107/+61 lines, and the method now fits the repo's nesting/complexity rules.

  2. SystemResource.updateSecurityConfig — scopes bean validation to the active provider.
    @Valid cascades into every nested block present in the payload regardless of provider, so an
    instance carrying a partially-filled ldapConfiguration could not save a SAML configuration; it
    was rejected over required LDAP fields the active provider never reads. That also made GET
    responses un-resubmittable, since GET omits fields the cascade demanded:

    400 [mailAttributeName must not be null, port must not be null,
         host must not be null, dnAdminPassword must not be null]
    

    Validation now runs against a deep copy with inactive providers' blocks nulled, so everything
    else is still enforced and only the bug changes. oidcClientConfig has required fields too, so
    all three blocks are scoped, not just LDAP. IllegalArgumentException is rethrown ahead of the
    method's blanket catch (Exception) so an invalid configuration answers 400, not 500.

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • An admin uploads an Okta metadata.xml in SSO settings and saves: the configuration is accepted
    instead of being rejected on the IdP certificate field.
  • An Auth0 tenant using a custom domain saves its SAML configuration.
  • An expired or malformed IdP certificate is still rejected, with the error on the certificate field.
  • An instance carrying a partial configuration block for a provider it is not using can still save.
  • An incomplete block of the active provider is still rejected, as a 400.

Why the existing tests missed this. All three layers already covered the metadata.xml upload
and all three stopped one step short of the failure, which is in the save that follows the upload:

Layer Gap
Jest OKTA_METADATA had the right entityID, but a 28-char fake certificate asserted only with toBeDefined() — never parseable, never had a CN
Playwright Uploaded and asserted the form populated, then stopped — never saved, so never reached the backend. Its fixture's Entity ID never hit the Okta branch and its certificate was unparseable
Backend IT Only ever posted provider=BASIC with no SAML block, and asserted only that the response had a status, not that it was SUCCESS

Every new test below was confirmed red before the corresponding change and green after.

Unit tests

  • Added.
  • openmetadata-service/.../security/auth/validator/SamlValidatorTest.java — added the SAML config save fails: Okta IdP certificate wrongly rejected (validator requires cert CN to equal okta.com domain) #28619
    regression (Okta Entity ID + org-name CN) and an Auth0 custom-domain case, at both the full
    validateSamlConfiguration path and the validateIdpCertificateAgainstConfig unit level.
    Inverted the three tests that encoded the bug. Certificates are self-signed fixtures valid to
    2036, matching the existing GENERIC_CERT convention — no new dependency.
  • 62/62 pass. Wider org.openmetadata.service.security.** sweep: 774/774, no regressions.

Backend integration tests

  • Added.
  • openmetadata-integration-tests/.../SamlSecurityConfigIT.java (new, 7 tests) — drives
    POST /v1/system/security/validate with the exact payload parseSamlMetadataXml produces from
    real Okta metadata, and asserts both status == success and that no error targets
    authenticationConfiguration.samlConfiguration.idp.idpX509Certificate. Also covers the Auth0
    custom-domain case, that expired and malformed certificates are still rejected, the GET → PUT
    round trip, and both sides of the provider-scoped validation.
  • The validate endpoint is side-effect free; the two PUT tests write back only what they just
    read, never change the active provider, and restore the original in a finally.
  • 7/7 pass. SystemResourceIT (39) and ConfigResourceIT (12) re-run clean — 58/58.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Added.
  • playwright/e2e/Features/SSOConfiguration.spec.ts + new playwright/test-data/saml-metadata-okta.xml
    — an Okta-shaped fixture with a real, parseable certificate, and a test that carries the upload
    through to submit and asserts the IdP certificate is not rejected. It intercepts the persist call
    so the run never repoints the instance at the fixture's IdP.
  • yarn lint:playwright reports 0 errors; the spec is type-clean under tsc:playwright.
  • Not executed — it needs the full stack (backend + UI dev server + auth setup), which was not
    available here. The same regression is covered at the layer where it actually fails by
    SamlSecurityConfigIT, so this is belt-and-braces rather than the primary guard. Worth a run in CI.

Manual testing performed

Not performed — the backend integration tests exercise the same API path the SSO form calls
(POST /v1/system/security/validate) with the same payload, end to end against a real server via
Testcontainers.

UI screen recording / screenshots:

Not applicable — no user-facing UI change. The UI files touched are tests and a test fixture.

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: no schema changes in this PR.

  • For UI changes: not applicable, no user-facing UI change.

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

  • I have added a test that covers the exact scenario we are fixing. Issue SAML config save fails: Okta IdP certificate wrongly rejected (validator requires cert CN to equal okta.com domain) #28619 is referenced in
    SamlValidatorTest, SamlSecurityConfigIT and the SamlValidator javadoc for future reference.

🤖 Generated with Claude Code

RetriggerConfidence Score: 4/5

The PR is not ready to merge because the Playwright regression can still time out without exercising validation, and the new backend integration class still violates the repository’s concurrency requirement.

Findings

  1. P1 Real GET Makes Test Stateful ▶
  2. P2 Integration Tests Run Serially ▶
Summary

Fixes SAML configuration validation by allowing provider-specific certificate naming conventions while retaining X.509 parsing and validity checks.

  • Scopes bean validation to the active authentication provider.
  • Adds backend, unit, and Playwright regression coverage for Okta and Auth0 certificates.
  • Adds round-trip and inactive-provider validation coverage.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Admin submits security configuration] --> B[Preserve masked secrets]
    B --> C[Temporarily detach inactive provider blocks]
    C --> D[Run bean validation]
    D --> E[Restore detached blocks]
    E --> F{Configuration valid?}
    F -->|No| G[Return 400]
    F -->|Yes| H[Validate active SAML settings]
    H --> I[Parse X.509 certificate]
    I --> J[Check certificate validity window]
    J --> K[Log certificate naming differences]
    K --> L[Save and reload security configuration]
Loading

Reviews (5) · Last reviewed commit: "Merge branch 'main' into fix/28619-okta-..."

SamlValidator required the IdP certificate's CN to equal the Entity ID
host. Okta Entity IDs are always http://www.okta.com/{appId} — a format
validateBasicSamlConfig itself enforces — so the host is always the
literal www.okta.com, while Okta issues signing certificates with
CN=<org short name>. The branch was unsatisfiable, so every legitimate
Okta configuration was rejected on save. The only passing value was a CN
of literally *.okta.com, which Okta never issues and which was the sole
case the existing test covered.

The check had no security value: the certificate is a trust anchor taken
from the IdP's own metadata and handed to OneLogin's
IDP_X509CERT_PROPERTY_KEY, and SAML verifies signatures against its
public key without PKIX name validation, so the CN is never consulted.

The Auth0, Azure and non-Azure branches encoded the same assumption and
broke on Auth0 custom domains and on any change to Microsoft's
certificate naming, so all four collapse into the warn-and-continue path
that already existed for generic providers. A CN differing from the
Entity ID host logs at INFO — it is the expected shape for these
providers, so warning would train operators to ignore warnings. Parsing
and the validity window are still enforced.

Also scopes bean validation on PUT /system/security/config to the active
provider. @Valid cascaded into every nested block present, so an instance
carrying a partial ldapConfiguration could not save a SAML configuration
and a GET response was not accepted by PUT unchanged. Validation now runs
against a copy with inactive providers' blocks nulled, and
IllegalArgumentException is rethrown ahead of the blanket catch so an
invalid configuration answers 400 rather than 500.

Co-Authored-By: Claude Opus 5 <[email protected]>
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 17, 2026
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 72%
72.9% (102393/140453) 57.89% (62351/107703) 58.92% (20370/34571)

Scope provider validation on the validate endpoint too, key the OIDC block
on clientType, and close the gaps the review found in the tests.

- POST /system/security/validate dropped @Valid and now runs the same
  provider-scoped validation as PUT. It is the first call the SSO form makes
  on save, so the inactive-block cascade still rejected the request there
  before PUT was ever reached.
- oidcConfiguration is not only the OIDC providers' block but the
  confidential client's, so clearing it now tests clientType alongside the
  usesOidcConfiguration check added in the previous commit. A partial block
  left behind by an earlier confidential setup no longer blocks a
  public-client save.
- Validation runs against the instance that is persisted rather than a
  Jackson deep copy. The round trip re-applied the schema defaults
  jsonschema2pojo emits as field initializers, leaving a @NotNull field that
  has a default unenforced on the object actually saved — `provider` is
  @NotNull and defaults to `basic`, so a payload sending it as null was
  accepted and stored.
- Narrowed the rethrow to BadRequestException, so a failure from the writes
  that follow is not reported to the admin as a 400.
- SamlValidator guards a null Entity ID instead of relying on an NPE into a
  catch-all.
- The Playwright route stubs only the PUT; the page's own GET reaches the
  server again, which enableSSOEditMode branches on.
- SamlSecurityConfigIT restores the configuration in a finally in the
  active-provider rejection test, covers the saml and oidc scoping branches,
  stops destroying the LDAP password its restore depends on, and uses an
  Auth0 certificate in the Auth0 custom-domain test.
- Jest covers a line-wrapped certificate, the shape real Okta metadata
  publishes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Comment on lines +939 to +943
await page.route('**/api/v1/system/security/config', (route) =>
route.request().method() === 'PUT'
? route.fulfill({ status: 200, json: {} })
: route.fallback()
);

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.

P1 Real GET Makes Test Stateful

When the test server already has a security configuration, allowing this GET to reach the real server makes the form use its existing-configuration PATCH path. That path does not call /security/validate, but the test unconditionally waits for that POST, so it times out instead of testing the Okta certificate flow. Keep the initial state deterministic or wait for the request associated with the selected save path.

@gitar-bot

gitar-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk

Fixes SAML certificate validation to accept valid Okta, Auth0, and Azure configurations by removing provider-specific CN checks that had no security value and broke legitimate deployments. Also scopes bean validation to the active authentication provider so configurations carrying inactive LDAP, SAML, or OIDC blocks can be saved without false rejections. Includes unit tests, backend integration tests, and Playwright coverage for the regression and related cases. No issues found.

Review coverage

Rules No rules evaluated

Functional validation Not enabled · Set up

Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-19T06:25:34Z)

Blocked the queue: playwright-summary

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport to 1.13 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.0 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Backport to 2.0 opened as #33625 (clean cherry-pick). It merges itself once the checks pass.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Backport to 1.13 failed. The conflict could not be resolved, so this change is not on that branch. Resolver run.

This branch was previously deployed

1 inactive deployment
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 To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAML config save fails: Okta IdP certificate wrongly rejected (validator requires cert CN to equal okta.com domain)

4 participants