Repository navigation
fix(mcp): ask before SSO authorizes a client (backport 2.0 #36172) - #37674
Conversation
Require approval before SSO issues an MCP authorization code. Store single-use consent in the database and add its columns in 2.0.8. Adapt #36172 to CollectionDAO and retain user grant revocation.
Code Review ✅ Approved 🔴 High riskAdding consent-gated MCP SSO code issuance changes authorization; a misbound approval could grant a client access to a user's account. Adds a user consent step to MCP SSO sign-in so the registered client, signed-in account, and redirect host are shown and must be approved before an authorization code is issued, with denial returning VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
❌ PR checklist incompleteThis 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 |
Describe your changes:
Backports #36172 to
2.0, resolving the failed automated backport manually.MCP SSO sign-in now asks the user to approve the registered client before issuing an authorization code. The page identifies the client, the signed-in account, and the redirect host. Deny returns
access_deniedwithout issuing a code.Type of change:
High-level design:
CollectionDAO, where the2.0branch keeps its DAOs.ADD COLUMN IF NOT EXISTS; MySQL uses a guarded Java migration step that tolerates reruns.ADR:2026-10-23-mcp-sso-asks-consent-after-the-idp-round-trip.This backport adds client consent. It does not disable dynamic registration or remove existing clients and tokens.
Tests:
Use cases covered
BASE_PATH.Unit and database tests
46 focused cases passed; none skipped. Saved reports were reused because publication did not change the tested behavior or environment.
UserSSOConsentTestUserSSOOAuthProviderTestMcpPendingAuthRequestRepositoryTestOAuthHttpStatelessServerTransportProviderTestMcpPendingConsentSqlTestMcpGrantRevocationSqlTestWorkflowRedeployEntryPointTestThe SQL tests ran against disposable MySQL 8.3 and PostgreSQL 15 databases.
Successful final reactor command:
The six service cases passed in the preceding combined
verifyrun, withMcpPendingConsentSqlTest,McpGrantRevocationSqlTest,WorkflowRedeployEntryPointTestadded to the same test selection. That run then stopped at MCP test compilation because the port duplicated an existing helper; the duplicate was removed before the successful final run. An initialtest-phase attempt stopped before tests because the shaded search dependencies require thepackagephase;verifybuilds them correctly.Merge-readiness follow-up (2026-11-12): all 595 MCP tests passed, with no failures, errors, or skips, on the unchanged PR head
67991f80157269ef7890f2b8bb3d7fdf0d8f1c83. This includes the existing callback, login, registration, token, and revocation regressions as well as the consent tests.mvn -B -pl openmetadata-mcp -am verify \ '-Dtest=%regex[org/openmetadata/mcp/.*Test.class]' \ -Dsurefire.failIfNoSpecifiedTests=false -DonlyBackendService unit CI also passed: 9,416 cases, zero failures/errors, one skip. The two consent SQL cases, two grant-revocation SQL cases, and two migration entry-point cases all passed without skips.
Also passed:
mvn -B -pl openmetadata-mcp,openmetadata-service spotless:applygit diff --check0ebc9e054166ca8b3d17a04acac1c62e14a63ad6Self-review: reviewed
67991f80157269ef7890f2b8bb3d7fdf0d8f1c83againstREVIEW.md, including the SSO callback, servlet routing, consent SQL, migrations, and user-deletion/password-change consumers. An independent review of all 18 files found no material security or correctness issues and no material code blocker.Line coverage was not measured. This release branch has no affected-test planner or decision-record validation target; focused checks were selected from the changed behavior and its consumers.
Backend integration tests
The full PostgreSQL integration runs failed with cases already failing before this backport. The MySQL integration lane was still running at the last check. A real OIDC/SAML round trip remains pending; the tests above cover servlet dispatch and real database behavior but do not replace an end-to-end identity-provider check.
CI baseline comparison (2026-11-12)
Compared against the earlier runs for #37650, head
3d1a824fea46d089092ca7727f3de971563e119b, which was merged as this PR's base0ebc9e054166ca8b3d17a04acac1c62e14a63ad6. A direct tree diff confirms their backend, migrations, integration tests, and backend CI workflows are identical; their only difference isplaywright/utils/searchSettingUtils.ts.Every failing test case in these two PR runs was already failing before the backport: connection cleanup, ODCS email-format import/export, disabled-policy enforcement, API endpoint field tags in search, glossary CSV relationships, quoted-term rename, and glossary status in search. No new failing test case was found.
The external Collate compatibility check also failed on the earlier baseline, with the same published build command as this PR:
mvn -B clean install -DskipTests -pl '!collate-ui,!collate-dist'. Its underlying Maven error is not published on GitHub, so the exact compatibility root cause remains unverified.The PR metadata check separately requires a linked GitHub issue. The original #36172 is a PR and has no linked issue; the tracking issue is still to be supplied.
Playwright and manual testing
No Playwright run or live SSO browser check was performed. The changed consent page is server-rendered HTML; no React bundle changes are included.
UI screen recording / screenshots:
Pending. The PR is ready for review; a consent-screen capture and a live SSO check have not been performed.
Checklist: