Skip to content

Fixes #26311: Trust the SSO login landing page on the configured callback host - #33978

Merged
mohityadav766 merged 20 commits into
mainfrom
fix/28870-multiple-sso-callback-urls
Oct 5, 2026
Merged

mohityadav766 merged 20 commits into
mainfrom
fix/28870-multiple-sso-callback-urls

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #26311

Until 2026-10-04 this PR also carried #28870 (multiple SSO callback URLs for multi-hostname/DR deployments). Per review, that is not a supported use case, so that work has been removed and this PR now only fixes #26311. #33764 was closed into this PR earlier.

The regression. Since 2.0.0, the login redirect allow-list trusted /auth/callback only on oidcConfiguration.serverUrl. The frontend asks to land on <its own origin>/auth/callback, and matching is exact, so any deployment whose serverUrl was not byte-identical to the browser's origin was rejected with Redirect URI must exactly match a trusted redirect URI, with no config-only remedy. Behind an ingress, serverUrl is routinely left at http://localhost:8585.

The fix.

  • /auth/callback is also trusted on the host of the configured OIDC callback URL (oidcConfiguration.callbackUrl). That URL has to be right for login to work at all, since the IdP rejects any other redirect_uri, so it names the deployment's real host even when serverUrl is stale.
  • Logout and the two /signin fallbacks (no pending session; silent-auth errors) are built from the callback URL's base (the URL minus its trailing /callback), so they no longer bounce the user to a stale serverUrl. A base path survives. A callback URL that is not the /callback servlet's keeps serverUrl.
  • Nothing is read from the request, so no X-Forwarded-* or Host header can add a trusted target. /mcp/callback stays anchored on serverUrl.
  • A rejected redirect now logs the trusted targets at WARN; the wire-facing 400 deliberately omits them.
  • Docs: the SSO form's callback placeholders advertised /auth/callback, and conf/openmetadata.yaml pointed at a non-existent /api/v1/callback. Both now say /callback, and the YAML explains which callbackUrl/responseType fields apply to public vs confidential clients. /auth/callback is the UI route the server redirects to after the code exchange and must not be registered with the IdP.

Type of change:

  • Bug fix

High-level design:

N/A — small fix (8 files).

Tests:

Use cases covered

  • OIDC callback returns 404 after auth code exchange with Azure AD (confidential client) #26311: serverUrl left at http://localhost:8585 and the callback URL on the real host — the login lands (real HTTP).
  • With serverUrl stale, the /signin fallback stays on the callback host (real HTTP).
  • A forged X-Forwarded-Host cannot make a login land on itself: 400, and no session is persisted.
  • The callback URL's port and base path are preserved; any other path, and /mcp/callback, on the callback host stay rejected.

Unit tests

  • I added unit tests for the new/changed logic.
  • AuthenticationCodeFlowHandlerTest (7 new), SecurityUtilTest (4 new, originOf), SsoRedirectBoundaryTest (3 new, over real HTTP through embedded Jetty and the production servlets).
  • The OIDC callback returns 404 after auth code exchange with Azure AD (confidential client) #26311 tests fail without the fix.
  • mvn package -pl :openmetadata-service -am -Dtest='org.openmetadata.service.security.**,ConfigResourceTest,SystemRepositoryTokenValidityTest,SystemRepositoryLdapConfigTest' → 1,039 tests, 0 failures. UI: ESLint and Prettier clean on the two changed files.

Backend integration tests

  • Not applicable — no API surface change; covered by the boundary tests above.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable — the UI change is placeholder text only.

Manual testing performed

Not performed: reproducing needs an identity provider behind a proxy. The failure path is pinned by tests that fail without the fix.

UI screen recording / screenshots:

Not applicable — placeholder example text only (.../auth/callback → .../callback).

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 change.
  • For UI changes: placeholder text only, noted above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Bug fix:

Note for maintainers:

🤖 Generated with Claude Code

mohityadav766 and others added 12 commits September 24, 2026 00:19
…irect

SSO login has been unusable since 2.0.0 on any deployment whose
oidcConfiguration.serverUrl is not byte-identical to the browser's origin
- the normal case behind an ingress, where serverUrl is often left at its
http://localhost:8585 default.

The frontend asks to land on <its own origin>/auth/callback, but the
redirect allow-list added in 2.0.0 only ever derived its /auth/callback
entry from serverUrl. Exact scheme+host+port+path matching then rejected
the login with "Redirect URI must exactly match a trusted redirect URI"
and a 400 that named no candidate. There was no config-only remedy: a
root-relative redirect canonicalizes against the same stale config origin.

Derive the origin the client actually reached the deployment on and trust
it for OpenMetadata's own two fixed callback paths. X-Forwarded-Proto and
X-Forwarded-Host are read first (Jetty's scheme/host only reflect the
external hop when useForwardedHeaders is on, which is off by default and
not surfaced by the shipped Docker or Helm configs), falling back to the
connector's own view for a direct deployment.

The derived origin is client-influenced, so it is only ever concatenated
with /auth/callback and /mcp/callback, the scheme is restricted to
http/https, and an origin carrying user-info, a path, a query or a
fragment is discarded. A forged X-Forwarded-Host therefore buys nothing:
the token rides the response back to whoever made the request, so the
forger can only redirect themselves. Any other target still has to match a
configured entry. An unparseable header is dropped rather than aborting
validation of a legitimately configured candidate.

Rejections now log the trusted candidate set at WARN, which the
wire-facing 400 deliberately omits.

Also corrects the callback documentation that sent reporters down the
wrong path in the first place: the SSO settings placeholders advertised
/auth/callback while the field's own default is /callback, and
conf/openmetadata.yaml pointed at /api/v1/callback, which is not a route
at all. The IdP redirect_uri is /callback (the server endpoint that
performs the code exchange); /auth/callback is the UI route the server
redirects to afterwards and must not be registered with the IdP. The
two same-named responseType and callbackUrl fields are now documented as
public-client vs confidential-client, including that
GET /api/v1/system/config/auth reports the top-level one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two defects in the origin lookup added by the previous commit, both found
by asking whether X-Forwarded-Host can actually be relied on. It cannot:
the repository ships no nginx config, Helm chart or ingress template, so
the proxy layer is entirely the operator's choice.

Read the closest hop, not the furthest. These headers are normally
replaced rather than appended, but a proxy that appends leaves the
caller's own value left-most - so reading from the left let a caller
sending "X-Forwarded-Host: evil.example.com, om.example.org" choose the
derived origin. Each further hop appends to the right, so the right-most
value is the one written by the most trusted proxy. The previous comment
justified the left-most read as "the original client hop", which is the
correct rule for X-Forwarded-For and the opposite of what is wanted here.

Resolve scheme and authority independently. AWS ALB sets
X-Forwarded-Proto and X-Forwarded-Port but never X-Forwarded-Host, passing
the client's Host through untouched; hand-rolled nginx behaves the same
way, since X-Forwarded-Host there is opt-in. Reading the scheme only
alongside a forwarded host resolved those deployments to the internal
http hop and rejected their own login - the very bug this was meant to
fix. Host is now also preferred over the connector's view, because
getServerPort() reports the local listener when the header carries no
explicit port and would otherwise graft :8585 onto a public origin.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…e SSO (#28870)

A deployment reachable at more than one hostname (load balancer, DR site)
needs the IdP-facing callback to follow the host the browser arrived on.
Add the two config lists that carry the extra registered URLs:

- authenticationConfiguration.additionalCallbackUrls: extra OIDC redirect_uri
  values. Top-level rather than inside oidcConfiguration because
  ConfigResource strips oidcConfiguration from the browser-facing auth
  config, and public clients build redirect_uri in the browser.
- samlConfiguration.sp.additionalAcsUrls: extra Assertion Consumer Service
  URLs. sp.entityId stays single-valued.

Both default to [], so single-hostname deployments are unaffected. Wire the
env vars in conf/openmetadata.yaml and conf/openmetadata-h2-test.yaml (the
latter also gains the missing additionalTrustedRedirectUris), and regenerate
the TypeScript types and the dereferenced UI schema.
Add SecurityUtil.sameOriginCallbackUrl(requestOrigin, primary, additional):
the configured additional callback URL on the origin the request arrived
on, or null to keep the primary. An entry qualifies only when it shares
the primary's path, so selection changes the host the identity provider
returns to but never the endpoint, and it is returned exactly as
configured because the token request must repeat redirect_uri byte for
byte. The request origin is client-influenced, so a forged host can only
pick a URL the operator already registered; a malformed entry is skipped
rather than failing the login.

Extract sameOrigin(URI, URI) out of sameRedirect so both comparisons share
one scheme/host/port normalization.
The callback that completes a login arrives as a separate request, so the
redirect_uri sent to the identity provider has to be remembered on the
pending session for the token request to repeat it exactly.

- UserSession gains idpRedirectUri. It is written only when set, and the
  class now ignores unknown properties: JsonUtils reads with a mapper that
  rejects them, so without both an older pod reading a newer pod's session
  mid rolling upgrade would fail. Sessions are a JSON blob in both stores,
  so no migration is needed.
- SessionService.createPendingSession takes a PendingLoginState record
  instead of seven positional arguments.

No behavior change yet: nothing sets idpRedirectUri until the OIDC handler
starts selecting callback URLs.
A deployment answering on several hostnames sent every identity provider
the single oidcConfiguration.callbackUrl, so logins from any other host
failed at the IdP.

- Web logins now send the additionalCallbackUrls entry registered for the
  host the request arrived on, falling back to the primary. The choice is
  recorded on the pending session and the token exchange reuses it, so the
  authorization and token requests carry the same redirect_uri even when
  the callback comes back through a different ingress.
- MCP logins keep the primary: that flow is anchored to serverUrl end to
  end, so it is left exactly as it was.
- The signin and logout redirects stay on the request host when it has a
  registered callback URL, instead of sending a secondary site's users to
  serverUrl. An unregistered or forged host still gets serverUrl.

With no additional callback URLs configured, nothing reads the request's
origin and every redirect is unchanged.
Public clients build the redirect_uri in the browser, so the server-side
selection alone left them sending the primary callback URL from every host.

- GET /api/v1/system/config/auth now returns additionalCallbackUrls.
- getRedirectUri picks the additional callback URL registered for the host
  the page is served from, with the server's rules: same path as the
  primary, the primary wins on its own origin, and the configured string
  is returned untouched. Login, the auth config, and the SSO test-login
  popup all use it.
- The SSO settings form gets an editable "Additional Callback URLs" list
  for OIDC providers; SAML and LDAP drop it with the other OIDC-only
  fields. The SAML additionalAcsUrls field stays hidden until the SAML
  side supports it.

New strings are translated for every locale.
Login skips an additional callback URL that is malformed or points at a
different endpoint, so a typo there only shows up as a login that quietly
keeps the primary. Validate the list when the SSO configuration is saved:
each entry must be an absolute http(s) URL, without user-info or a
fragment, on the same path as the callback URL the identity provider is
actually sent (the OIDC one for confidential clients, the top-level one
for public clients).

The rule lives in SecurityUtil.isAlternativeCallbackUrl, shared with the
runtime selection, so the two cannot drift apart. The live identity
provider probes still use only the primary: a disaster-recovery host is
often unreachable from the primary site when the config is saved.
The SAML side had one static Saml2Settings, so every AuthnRequest carried
the single sp.acs and logins from any other hostname failed at the IdP.

- SamlSettingsHolder builds one Saml2Settings per configured ACS (sp.acs
  plus sp.additionalAcsUrls) and publishes them in a single snapshot, so
  a reload never mixes old and new entries. Entries are keyed by
  configured URL, never by request input. The entityId stays the same
  across all of them.
- Login picks the additional ACS registered for the request host, using
  the same rule as OIDC, and records it on the pending session. The ACS
  callback validates against that recorded ACS instead of re-deriving it
  from headers. MCP logins keep the primary.
- The ACS callback now checks Destination and Recipient against the ACS
  URL the login sent, via onelogin's SamlMessageFactory hook, rather than
  the URL the container saw. In strict mode behind a load balancer that
  URL is the internal hop, so the check failed even with a single ACS.
  That pre-existing bug is fixed here too.
- The redirect allow-list trusts /auth/callback on the host of every
  configured ACS, and logs the trusted set when it rejects a redirect.

Also removes the dead relayState field and setSaml2Settings.
The SP metadata advertised only sp.acs, so an identity provider that
imports it would reject AuthnRequests from the other hostnames. It now
lists each additional ACS as another AssertionConsumerService, all under
the one entityID. Per-host metadata would be wrong here: IdPs key the SP
on entityID, so two documents with the same entityID conflict.

onelogin's template holds a single ACS and runs postProcessXml inside the
Metadata constructors, before a subclass could hold the extra URLs. So the
endpoints are added to the rendered document and the result is signed
afterwards, which keeps them covered by the signature. With no additional
ACS URLs the servlet serves exactly what getSPMetadata() returned before,
so existing IdP registrations see no change.
- SamlValidator rejects an additional ACS URL that login could never
  select: it must be an absolute http(s) URL on the same path as sp.acs,
  the same rule the OIDC list is held to. At most 20 are accepted, since
  each one gets its own Saml2Settings. The error names the entry and is
  reported against sp.additionalAcsUrls.
- The SSO settings form shows an editable "Additional ACS URLs" list in
  the Service Provider section. The primary ACS is still auto-filled from
  the admin's origin, so the help text explains these are for the other
  hostnames and must also be registered with the identity provider.

New strings are translated for every locale.
Changed-line coverage was 83.9%; these tests bring it to 98.8%.

- The SAML ACS callback validates with the ACS recorded at login and
  installs the destination-checking message factory. No unit test reached
  that part of handleCallback before.
- SamlSettingsHolder: initialization from the live auth config, the
  uninitialized guard, and the SP-key, keystore and missing-key-material
  branches of the signing setup.
- The SP metadata servlet over real HTTP: every ACS under one entityID.
- Logout from a registered secondary host stays on that host.
- The additional-URL checks run inside the SAML validator's entry point
  and the base authentication-field validation.
- SecurityUtil: an unparseable primary, and a hostless trusted entry.

The two token-exchange boundary tests now report the callback's status
and body when they fail.
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 3 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 3 warning(s) across 1 changed file(s).

Count Rule
3 react-hooks/exhaustive-deps
All findings
Location Rule Message
🟡 src/components/SettingsSso/SSOConfigurationForm/SSOConfigurationForm.tsx:334:30 react-hooks/exhaustive-deps React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead.
🟡 src/components/SettingsSso/SSOConfigurationForm/SSOConfigurationForm.tsx:435:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'scrollToFirstError'. Either include it or remove the dependency array. Outer scope values like 'parseValidatio
🟡 src/components/SettingsSso/SSOConfigurationForm/SSOConfigurationForm.tsx:694:6 react-hooks/exhaustive-deps React Hook useMemo has an unnecessary dependency: 'hideBorder'. Either exclude it or remove the dependency array.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSO Login Nightly — PASSED

View workflow run · Commit b6f731d

Provider Status Pass Fail Flaky Skip Duration
basic ✅ pass 28 0 0 0 6m 42s
ldap ✅ pass 7 0 0 0 0m 45s
keycloak-oidc-confidential ✅ pass 12 0 0 0 1m 35s
keycloak-oidc-public ✅ pass 11 0 0 0 1m 21s
msal-mock ✅ pass 7 0 0 0 0m 54s
auth0-mock ✅ pass 6 0 0 0 1m 04s
okta ⏩ skipped - - - - -
keycloak-azure-saml ✅ pass 23 0 0 0 6m 40s
keycloak-azure-saml-crosssite ⏩ skipped - - - - -

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

@mohityadav766 mohityadav766 self-assigned this Sep 25, 2026
…28870)

With #26311 and #28870 in one change, the OIDC and SAML redirect
allow-lists no longer have a reason to follow different rules.

The OIDC allow-list trusted /auth/callback on whatever origin the request
claimed via X-Forwarded-Host or Host. A forged host could make a login
land on itself: SsoRedirectBoundaryTest encoded exactly that ("a forged
host can make the login land on itself"). It also left #26311 unfixed
for any deployment whose request did not happen to name its public
origin.

The landing page is now trusted on the host of every configured OIDC
callback URL: the primary oidcConfiguration.callbackUrl and each
additionalCallbackUrls entry. Those have to be right for login to work at
all, since the identity provider rejects any other redirect_uri, so they
name the deployment's real hosts even when serverUrl is left at its
localhost default. SAML already applied this rule to its configured ACS
URLs; both now share SecurityUtil.originOf. Nothing on the redirect path
reads the request any more, so the parameter #26311 threaded through
requireRedirectUri and sendRedirectWithToken is gone again.

ownUrl, used for the /signin and /logout redirects, now copies the origin
from the configured callback URL that matched rather than from the
headers that selected it. That resolves the three CodeQL
java/unvalidated-url-redirection alerts on it.

requestOrigin keeps its one legitimate job: choosing among URLs the
operator registered with the identity provider, where a forged host can
select nothing that was not already configured.
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit fff4d42cc2ac40c2745734211504a63c54eb30a3 in Playwright run 37202350147, attempt 1.

✅ 3408 passed · ❌ 0 failed · 🟡 5 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 49m 48s

⏱️ Max setup 4m 22s · max shard execution 19m 15s · max shard-job elapsed before upload 22m 34s · reporting 17s

🌐 212.06 requests/attempt · 2.02 app boots/UI scenario · 36.71% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 36.71% (convergence target: at most 15%).
  • Browser traffic was 212.06 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.02 per UI scenario (7307 boots / 3617 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard advanced-search-01 66 0 0 0 0 0
✅ Shard advanced-search-02 64 0 0 0 0 0
✅ Shard chromium-01 152 0 0 0 0 0
✅ Shard chromium-02 143 0 0 0 0 0
✅ Shard chromium-03 184 0 0 0 0 0
🟡 Shard chromium-04 188 0 1 0 0 0
✅ Shard chromium-05 207 0 0 0 0 0
✅ Shard chromium-06 205 0 0 0 0 0
🟡 Shard chromium-07 205 0 1 0 0 0
✅ Shard chromium-08 171 0 0 1 0 0
✅ Shard chromium-09 189 0 0 0 0 0
🟡 Shard chromium-10 157 0 1 0 0 0
🟡 Shard chromium-11 199 0 1 0 0 0
✅ Shard chromium-12 160 0 0 0 0 0
✅ Shard chromium-13 176 0 0 0 0 0
✅ Shard chromium-14 171 0 0 0 0 0
✅ Shard chromium-15 182 0 0 0 0 0
✅ Shard chromium-16 163 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard global-state-01 67 0 0 0 0 0
✅ Shard import-export-01 97 0 0 0 0 0
✅ Shard import-export-02 55 0 0 0 0 0
🟡 Shard ingestion-01 41 0 1 0 0 0
✅ Shard ingestion-02 51 0 0 0 0 0
✅ Shard reindex-01 41 0 0 0 0 0
✅ Shard search-rbac-01 9 0 0 0 0 0
🟡 5 flaky test(s) (passed on retry)
  • Pages/Entity.spec.ts › DisplayName Add, Update and Remove for child entities (shard chromium-04, 1 retry)
  • Pages/AppStopRunModal.spec.ts › should close stop modal when cancel is clicked (shard chromium-07, 1 retry)
  • Features/ActivityFeed.spec.ts › emoji reactions can be added and toggled off on a feed card (shard chromium-10, 1 retry)
  • Flow/Metric.spec.ts › Metric creation flow should work (shard chromium-11, 1 retry)
  • Features/DataQuality/Dimensionality.spec.ts › Dimensionality Tests (shard ingestion-01, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Comment thread conf/openmetadata-h2-test.yaml Resolved
ownUrl kept the request's host only when an *additional* callback URL
matched it, because sameOriginCallbackUrl returns null on the primary's
own origin. A request on the primary callback host therefore always got
serverUrl. In the #26311 setup this PR targets - serverUrl left at
http://localhost:8585, oidcConfiguration.callbackUrl on the real host -
login now worked, but logout and the missing-pending-session and
silent-auth fallbacks still sent the browser to localhost:8585.

SecurityUtil.registeredCallbackUrl now returns the configured callback
URL on the request's host, primary or additional. ownUrl builds the
redirect from that URL's base: the callback URL minus its trailing
/callback. The suggested fix rebuilt it from the origin instead, but
these redirects used serverUrl before, and serverUrl carries a base path
that an origin would drop (https://host/openmetadata/callback must give
https://host/openmetadata/logout). A callback URL that is not the
/callback servlet's keeps serverUrl. The request origin still only
selects among configured URLs, so an unregistered host keeps serverUrl.

Reported by gitar-bot on #33978.
@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

Review on #33978: multi-hostname/DR deployments are not a supported use
case ("this is not a use-case. Lets not add edge-cases into the code").
This removes #28870's work entirely - the additionalCallbackUrls and
sp.additionalAcsUrls settings, their generated types, form fields and
translations, the per-ACS SAML settings and SP metadata, the recorded IdP
redirect URI on the pending session, and the save-time validation - and
leaves this PR as the #26311 fix only.

Without additional hostnames nothing needs the request's host, so the
#26311 fix no longer reads the request at all:

- /auth/callback is also trusted on the host of the configured OIDC
  callback URL. That URL has to be right for login to work - the identity
  provider rejects any other redirect_uri - so it names the deployment's
  real host even when serverUrl is left at its localhost default. No
  forwarded or Host header can add a trusted target; requestOrigin and
  its X-Forwarded parsing are gone.
- Logout and the two /signin fallbacks are built from the callback URL's
  base (the URL minus its trailing /callback), so they no longer bounce
  the user to a stale serverUrl. A base path survives; a callback URL that
  is not the /callback servlet's keeps serverUrl.
- A rejected redirect logs the trusted targets at WARN.
- The callback documentation fixes stay: the SSO form placeholders and
  conf/openmetadata.yaml now point at /callback, not /auth/callback or
  the non-existent /api/v1/callback.
@gitar-bot

gitar-bot Bot commented Oct 4, 2026 •

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

🔴 High risk · Expands trusted OIDC landing redirects and changes authentication fallback destinations

Fixes #26311 by trusting /auth/callback on the configured OIDC callback host, allowing SSO login to land correctly even when serverUrl is stale. Login, logout, and signin fallbacks now use the callback URL's base instead of the outdated server URL, with comprehensive unit and boundary tests confirming the fix.

✅ 1 closed
✅ Edge Case: ownUrl ignores the primary callback host and falls back to stale serverUrl

📄 openmetadata-service/src/main/java/org/openmetadata/service/security/AuthenticationCodeFlowHandler.java:573-582 📄 openmetadata-service/src/main/java/org/openmetadata/service/security/AuthenticationCodeFlowHandler.java:600 📄 openmetadata-service/src/main/java/org/openmetadata/service/security/AuthenticationCodeFlowHandler.java:620 📄 openmetadata-service/src/main/java/org/openmetadata/service/security/AuthenticationCodeFlowHandler.java:743
ownUrl only keeps the request host when additionalCallbackUrlFor picks an additional entry. sameOriginCallbackUrl returns null on the primary's own origin, so a request on the primary callback host always gets serverUrl. Take the #26311 setup this PR targets: serverUrl is left at http://localhost:8585 and oidcConfiguration.callbackUrl is https://om.example.org/callback. Login now succeeds there, but every logout, plus the missing-pending-session and silent-auth fallbacks, still redirects the browser to http://localhost:8585/logout or /signin. That contradicts the stated rule that these redirects stay on any host with a registered callback URL. Fix: when the request origin matches the primary callback URL's origin, use originOf(client.getCallbackUrl()) too.

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

sonarqubecloud Bot commented Oct 4, 2026

Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OIDC callback returns 404 after auth code exchange with Azure AD (confidential client)

6 participants