Skip to content

fix(mcp): revoke oauth grants of deleted users (backport 2.0 #36699) - #36779

Merged
Vishnuujain merged 2 commits into
mcp-token-revoke-2.0from
mcp-revoke-on-user-delete-2.0
Nov 2, 2026
Merged

Vishnuujain merged 2 commits into
mcp-token-revoke-2.0from
mcp-revoke-on-user-delete-2.0

Conversation

@Vishnuujain

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of #36699 to 2.0.

  • Deleting a user, soft or hard, ends its MCP codes, access tokens and refresh tokens on every client; a restored user signs in to MCP again. SSO grants are stored under the account's own name, and names compare ignoring case for older rows. A 2.0.8 post-data migration ends grants left by users deleted earlier.
  • Adapted, not cherry-picked: 2.0 has no consent step and no delete lifecycle hook, so the revoke runs in UserRepository.preDelete, which every delete path calls, and the queries sit in CollectionDAO.
  • Builds on the fix(mcp): tool error codes and access token revoke #36498 backport (fix(mcp): access token revoke (backport 2.0 #36498) #36778), which this PR is based on: access tokens end at the delete only because that one makes JwtFilter check them against the store.

Type of change:

  • Bug fix

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: the 2.0.8 statements end grants of missing and deleted users only and change nothing on a second run.
  • Ran locally on 2.0 with the six MCP backports applied together; integration tests on MySQL + Elasticsearch and Postgres + OpenSearch. McpServiceResourceIT on 2.0 does not compile today (supportsEntityStatus is not on 2.0); that line was removed locally for the run.

@Vishnuujain
Vishnuujain requested a review from a team as a code owner November 1, 2026 10:52
@Vishnuujain
Vishnuujain requested review from IceS2 and removed request for a team November 1, 2026 10:52
@github-actions

github-actions Bot commented Nov 1, 2026

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.

@gitar-bot

gitar-bot Bot commented Nov 1, 2026

Copy link
Copy Markdown
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 UserRepository.preDelete and a 2.0.8 migration ends grants left by previously deleted users. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

Compact
gitar display:verbose         

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

@Vishnuujain
Vishnuujain merged commit 4d85260 into mcp-token-revoke-2.0 Nov 2, 2026
59 of 62 checks passed
@Vishnuujain
Vishnuujain deleted the mcp-revoke-on-user-delete-2.0 branch November 2, 2026 09:04
Vishnuujain added a commit that referenced this pull request Nov 2, 2026
* fix(mcp): access token revoke (backport 2.0 #36498)

* fix(mcp): revoke oauth grants of deleted users (backport 2.0 #36699) (#36779)

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant