Repository navigation
fix(mcp): ask before sso sign-in authorizes a client - #36172
Conversation
❌ 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 |
🚦 Removed from the merge queue —
|
Code Review ✅ Approved🔴 High risk · Moving MCP SSO code issuance behind consent changes authorization decisions; a mishandled approval could grant unintended client access. Adds a consent step to MCP SSO sign-in so the user approves the client before an authorization code is issued, with Deny 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 |
|
🤖 Backport to |
|
🤖 Backport to |
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.
Describe your changes:
Part of a larger set of MCP and auth fixes.
access_denied. Basic and LDAP already asked on/mcp/login.mcp_pending_auth_requestsrow (2.0.7 addsconsent_token_hashandconsent_user_name: Postgres inschemaChanges.sql, MySQL in the guarded Java step, also run from 2.1.0), so any server can answer the POST. Only the first sign-in for a request is recorded and the approval can be used once.ADR:2026-10-23-mcp-sso-asks-consent-after-the-idp-round-trip.Type of change:
High-level design:
Consent is asked after the IdP round trip, not before it, because SAML resolves the pending request from
RelayStatealone and the OIDC round-trip state lives in the database. The approval lives on the pending request row rather than theHttpSession(per node) or a token signed with a server key (defaults ship inconf/). Details in the decision record.Tests:
Unit tests
UserSSOOAuthProviderTest: consent page instead of a code, approve, deny, wrong or missing token, second sign-in for the same request, client removed before approval.McpPendingConsentSqlTest: runs the consent SQL on MySQL 8.3 and Postgres 15 (Testcontainers) against the table built from the shipped migrations, including 2.0.7 (on MySQL the guarded Java step, run twice). Store once, claim once, wrong token, expiry, no re-arm after a decision. It fails if the store guard is removed.McpPendingAuthRequestRepositoryTest: the row gets the token hash, the claim uses the same hash, a missing token claims nothing.OAuthHttpStatelessServerTransportProviderTest: renders the consent page, then posts that form's own action and fields throughdoPostunder a base path. Approve issues the code for the signed-in user, Deny returnsaccess_denied, and a client removed meanwhile gets a 400. They fail if the route is removed or the form's field names drift from the server's.openmetadata-mcpunit tests (811) and the migration workflow tests pass locally.Backend integration tests
Not run locally (the selection is 210 classes); the merge queue runs them.
Manual testing performed
/mcp/authorize,/callbackand/mcp/consentservlets against a stub OIDC provider: with a live IdP session the browser stops on the consent page and no code reaches the client; Approve issues a code for the signed-in user; Deny returnsaccess_denied.Checklist:
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.Reviewed
f3ed188. One 🔴: the consent SQL, repository and route had no real test. Fixed in8e663e5with the two tests above; that commit adds only tests and one decision-record sentence. The/mcp/consentroute is covered by the transport tests above and was also exercised end to end locally. 🟡 left for a follow-up:/mcp/login(Basic/LDAP) does not show the redirect host, andhandleSSOErrorCallbackkeeps its own copies of the client check and cleanup.ADR:2026-10-23-mcp-sso-asks-consent-after-the-idp-round-trip.

Confidence Score: 5/5
The PR appears safe to merge; no new blocking issue was found.Summary
MCP SSO sign-in now asks the user to approve the client before issuing an authorization code.
No new actionable issues were found. The earlier test-length finding is excluded by the current review guide.
Diagram
sequenceDiagram participant Browser participant Server participant IdP participant DB participant Client Browser->>Server: Start MCP authorization Server->>IdP: Sign in IdP->>Server: Return authenticated user Server->>DB: Store first pending approval Server-->>Browser: Show client, user, and redirect host Browser->>Server: POST decision and page token Server->>DB: Claim token once alt Approve Server-->>Client: Authorization code and original state else Deny Server-->>Client: access_denied and original state endReviews (6) · Last reviewed commit: "resolved conflict" · Reviewed by Greptile