Repository navigation
fix(mcp): revoke oauth grants of deleted users (backport 2.0 #36699) - #36779
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 |
Code Review ✅ Approved🔴 High risk · Revoking MCP OAuth grants on user deletion and in the 2.0.8 migration could invalidate active client sessions and disrupt access. Backports the fix that revokes MCP OAuth codes, access tokens, and refresh tokens when a user is deleted, so a restored user must sign in to MCP again. The revoke runs in 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 |
Describe your changes:
Backport of #36699 to
2.0.2.0.8post-data migration ends grants left by users deleted earlier.2.0has no consent step and no delete lifecycle hook, so the revoke runs inUserRepository.preDelete, which every delete path calls, and the queries sit inCollectionDAO.JwtFiltercheck them against the store.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 is gone; after a soft delete and restore the refresh is still refused.McpGrantMigrationIT: the2.0.8statements end grants of missing and deleted users only and change nothing on a second run.2.0with the six MCP backports applied together; integration tests on MySQL + Elasticsearch and Postgres + OpenSearch.McpServiceResourceITon2.0does not compile today (supportsEntityStatusis not on2.0); that line was removed locally for the run.