Skip to content

Fixes #5183: configurable trusted redirect URIs for browser-extension login - #30287

Merged
mohityadav766 merged 3 commits into
mainfrom
guangzhou
Jul 28, 2026
Merged

mohityadav766 merged 3 commits into
mainfrom
guangzhou

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes open-metadata/openmetadata-collate#5183.

GET /api/v1/auth/login?redirectUri=<uri> returns 400 Bad Request for browser-extension redirect URIs (e.g. Chrome extension https://<extension-id>.chromiumapp.org/...), blocking extension-based OIDC/SAML login.

Root cause: #26314 added an exact-match redirect-URI allowlist. The allowlist was built only from authenticationConfiguration.callbackUrl, serverUrl + /auth/callback, and serverUrl + /mcp/callback, with no way to register any other destination — so browser-extension redirects can never match and are rejected.

Fix: add an optional authenticationConfiguration.additionalTrustedRedirectUris (list of strings) and merge it into the allowlist in both the OIDC (AuthenticationCodeFlowHandler.requireRedirectUri) and SAML (SamlAuthServletHandler.trustedSamlRedirects) handlers — the two shared points every login-flow caller routes through.

  • Exact-match semantics preserved — each entry must match scheme, host, port, path, and query exactly, so this does not reopen the open-redirect hole Feature #21971: Session Management in Multiple Server Pods #26314 closed.
  • Wildcard host matching (*.chromiumapp.org) was intentionally not used: it would let any browser extension receive an OM token.
  • Defaults to empty ([]) — existing deployments are unchanged and must explicitly opt in.

Configure via env var:

AUTHENTICATION_ADDITIONAL_TRUSTED_REDIRECT_URIS: '["https://<extension-id>.chromiumapp.org/auth0"]'

No DB migration required — this is a configuration schema, not a stored-entity schema.

Type of change:

  • Bug fix

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • For JSON Schema changes: not needed — configuration schema only, no stored entity/migration.
  • I have added a test that covers the exact scenario we are fixing (see AuthenticationCodeFlowHandlerTest: configured extension redirect is allowed, unconfigured one is still rejected).

🤖 Generated with Claude Code

Greptile Summary

This PR adds configurable redirect destinations for browser-extension login flows. The main changes are:

  • Adds additionalTrustedRedirectUris to the authentication schema and default YAML configuration.
  • Extends the OIDC and SAML redirect allowlists with configured exact-match URIs.
  • Updates generated TypeScript configuration types.
  • Adds tests for configured and unconfigured extension redirects.

Confidence Score: 5/5

This looks safe to merge.

  • The optional list is handled safely when absent.
  • OIDC and SAML continue to use strict URI matching.
  • No blocking issue remains in the changed code.

Important Files Changed

Filename Overview
conf/openmetadata.yaml Adds an empty-by-default environment-backed list of extra redirect destinations.
openmetadata-service/src/main/java/org/openmetadata/service/security/AuthenticationCodeFlowHandler.java Adds configured destinations to the OIDC redirect allowlist before exact-match validation.
openmetadata-service/src/main/java/org/openmetadata/service/security/auth/SamlAuthServletHandler.java Adds configured destinations to the SAML redirect allowlist used during login and callback handling.
openmetadata-spec/src/main/resources/json/schema/configuration/authenticationConfiguration.json Defines the optional list of additional trusted redirect URIs.
openmetadata-service/src/test/java/org/openmetadata/service/security/AuthenticationCodeFlowHandlerTest.java Tests acceptance of a configured extension redirect and rejection of an unconfigured redirect.
openmetadata-ui/src/main/resources/ui/src/generated/configuration/authenticationConfiguration.ts Exposes the new optional configuration property in the generated UI type.

Reviews (3): Last reviewed commit: "Merge branch 'main' into guangzhou" | Re-trigger Greptile

Context used (3)

  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)

…ension login

PR #26314 added an exact-match redirect-URI allowlist to /api/v1/auth/login
built only from callbackUrl and the server's /auth/callback and /mcp/callback.
Browser-extension logins redirect to https://<extension-id>.chromiumapp.org/<path>,
which cannot be registered anywhere, so login returned 400 "Redirect URI must
exactly match a trusted redirect URI".

Add an optional authenticationConfiguration.additionalTrustedRedirectUris list
and merge it into the allowlist in both the OIDC (requireRedirectUri) and SAML
(trustedSamlRedirects) handlers. Exact-match semantics are preserved, so this
does not reopen the open-redirect hole; wildcard host matching was intentionally
avoided as it would let any extension receive a token. Defaults to empty, so
existing deployments are unchanged and must opt in.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 21, 2026 12:56
@mohityadav766
mohityadav766 requested a review from a team as a code owner July 21, 2026 12:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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.

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

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (21 flaky)

✅ 4542 passed · ❌ 0 failed · 🟡 21 flaky · ⏭️ 95 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 436 0 4 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 825 0 6 8
🟡 Shard 4 817 0 3 18
🟡 Shard 5 829 0 4 5
🟡 Shard 6 832 0 1 46
🟡 Shard 7 792 0 3 2
🟡 21 flaky test(s) (passed on retry)
  • Flow/TestConnectionModal.spec.ts › modal opens with gate card and capability checks sections (shard 1, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: chart (shard 1, 1 retry)
  • Pages/SearchSettings.spec.ts › Latest preview config wins when a superseded request resolves late (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a fully denied user sees neither asset type when browsing (shard 1, 1 retry)
  • Features/ColumnBulkOperations.spec.ts › should restore filters from URL on page load (shard 3, 1 retry)
  • Features/ColumnBulkOperations.spec.ts › should search columns with server-side API call (shard 3, 1 retry)
  • Features/ColumnBulkOperations.spec.ts › should clear individual filter and update URL (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/DataQuality/BundleSuiteBulkOperations.spec.ts › Add test case to existing Bundle Suite (shard 3, 1 retry)
  • Features/Glossary/GlossaryAdvancedOperations.spec.ts › should change domain on glossary (shard 3, 1 retry)
  • Features/Glossary/GlossaryP3Tests.spec.ts › should create glossary with unicode characters in name (shard 4, 1 retry)
  • Features/Glossary/LargeGlossaryPerformance.spec.ts › should handle drag and drop for term reordering (shard 4, 1 retry)
  • Features/SearchExport.spec.ts › Export queues a background job and downloads from the jobs tray (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Should search custom properties for metric in right panel (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Number (shard 5, 1 retry)
  • Pages/DataContractInheritance.spec.ts › Delete Asset Contract - Falls back to showing inherited contract from Data Product (shard 5, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Description Rule Is_Not_Set (shard 5, 1 retry)
  • Pages/Entity.spec.ts › Inactive Announcement create & delete (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 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

@github-actions

Copy link
Copy Markdown
Contributor

✅ TypeScript Types Auto-Updated

The generated TypeScript types have been automatically updated based on JSON schema changes in this PR.

Copilot AI review requested due to automatic review settings July 21, 2026 13:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 65%
65.49% (76386/116626) 49.33% (45659/92550) 50.2% (13809/27503)

Copilot AI review requested due to automatic review settings July 23, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 9 changed files in this pull request and generated 3 comments.

Comment on lines +657 to +661
Set<String> trusted =
org.openmetadata.service.security.SecurityUtil.trustedRedirects(
authConfig.getCallbackUrl(), samlSpCallback(), samlAuthCallback());
trusted.addAll(listOrEmpty(authConfig.getAdditionalTrustedRedirectUris()));
return trusted;
Comment on lines +74 to +76
"additionalTrustedRedirectUris": {
"title": "Additional Trusted Redirect URIs",
"description": "Additional redirect URIs allowed for the login flow, beyond the callback URL and the server's own callbacks. Each entry must exactly match the requested redirect URI (scheme, host, port, path, query). Use this to allow browser-extension login redirects such as 'https://<extension-id>.chromiumapp.org/<path>'.",
Comment thread conf/openmetadata.yaml
Comment on lines +454 to +456
# Additional redirect URIs allowed for the login flow (beyond callbackUrl and the server callbacks).
# Each entry must exactly match the requested redirect URI. Use for browser-extension logins,
# e.g. ["https://<extension-id>.chromiumapp.org/auth0"].
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@mohityadav766 mohityadav766 self-assigned this Jul 28, 2026
@mohityadav766
mohityadav766 merged commit 2e4af5d into main Jul 28, 2026
104 of 110 checks passed
@mohityadav766
mohityadav766 deleted the guangzhou branch July 28, 2026 05:46
@gitar-bot

gitar-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds optional additionalTrustedRedirectUris to the authentication configuration schema, enabling browser-extension OIDC and SAML login flows. No issues found.

Options

Display: compact → Showing less information.

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

Compact
gitar display:verbose         

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

mohityadav766 added a commit that referenced this pull request Jul 28, 2026
… login (#30287)

* Fixes #5183: allow configurable trusted redirect URIs for browser-extension login

PR #26314 added an exact-match redirect-URI allowlist to /api/v1/auth/login
built only from callbackUrl and the server's /auth/callback and /mcp/callback.
Browser-extension logins redirect to https://<extension-id>.chromiumapp.org/<path>,
which cannot be registered anywhere, so login returned 400 "Redirect URI must
exactly match a trusted redirect URI".

Add an optional authenticationConfiguration.additionalTrustedRedirectUris list
and merge it into the allowlist in both the OIDC (requireRedirectUri) and SAML
(trustedSamlRedirects) handlers. Exact-match semantics are preserved, so this
does not reopen the open-redirect hole; wildcard host matching was intentionally
avoided as it would let any extension receive a token. Defaults to empty, so
existing deployments are unchanged and must opt in.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Update generated TypeScript types

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 2e4af5d)

This branch was previously deployed

1 inactive deployment
test — b8e80a6a Deployed Jul 23, 2026 by mohityadav766 via playwright-ci-postgresql (1, 7) #57972
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.

5 participants