Repository navigation
fix(mcp): revoke oauth grants of deleted users - #36699
Conversation
Code Review ✅ Approved 1 closed / 1 findings🔴 High risk · Revoking MCP OAuth grants on user deletion changes token authorization; failures to match a user name could leave deleted users’ access active. Deleting a user, soft or hard, now ends their MCP codes, access tokens, refresh tokens, and pending consents, and a 2.1.0 migration revokes grants left by previously deleted users. Resolved the finding where pending MCP consents could still issue a code after user deletion. ✅ 1 closed✅ Bug: User delete leaves pending MCP consents, so a code can still be issued
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:
Part of a larger set of MCP and auth fixes.
ADR:2026-10-26-an-mcp-oauth-grant-ends-30-days-after-sign-in(v2 amendment).Type of change:
Tests:
Unit tests
UserSSOOAuthProviderTest: an SSO sign-in stores the grant under the account's name, not the provider's casing.Backend integration tests
McpOAuthIT: after a hard delete and same-name signup the old access token gets 401, the refresh 400, and the code and waiting consent are gone; after a soft delete and restore the refresh is still refused. Fails without the change (old access token 200).McpGrantMigrationIT: the migration ends grants of missing and deleted users only, keeps a live user's grant under another casing, and changes nothing on a second run.Manual testing performed