Skip to content

fix(mcp): access token revoke (backport 2.0 #36498) - #36778

Merged
Vishnuujain merged 4 commits into
2.0from
mcp-token-revoke-2.0
Nov 2, 2026
Merged

Vishnuujain merged 4 commits into
2.0from
mcp-token-revoke-2.0

Conversation

@Vishnuujain

@Vishnuujain Vishnuujain commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of the access token part of #36498 to 2.0.

  • MCP access tokens carry their client and are stored when issued, and JwtFilter refuses one that is no longer stored, so a revoked token stops working on every server. Before this, /mcp/revoke deleted from a table nothing wrote to.
  • /mcp/revoke only touches tokens of the client that asks, token_type_hint only picks which type is looked up first, and revoking a refresh token also ends the access tokens of its grant.
  • Adapted, not cherry-picked: the tool error code half of fix(mcp): tool error codes and access token revoke #36498 is left out. 2.0 keeps the OAuth DAOs in CollectionDAO, so the shared token hash lives there, and the logout denylist change is not part of this.

Type of change:

  • Bug fix

Tests:

Unit tests

  • JwtFilterTest, JWTTokenGeneratorTest, RevocationHandlerTest, OAuthTokenRepositoryTest, UserSSOOAuthProviderTest: the token check, the client_id claim, client-bound revoke and storing the token before rotation.

Backend integration tests

  • McpOAuthIT: a revoked access token and the access token of a revoked refresh token get 401 on the next call.
  • 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.

Summary by Gitar

  • User deletion:
    • Deleting a user ends their MCP grants through UserRepository.preDelete
  • Migration:
    • Added 2.0.8 post-data script ending grants of missing or deleted users
  • Grant identity:
    • Grants are stored under the account's own name and matched ignoring case

This will update automatically on new commits.

@Vishnuujain
Vishnuujain requested a review from a team as a code owner November 1, 2026 10:51
@Vishnuujain
Vishnuujain requested review from harshach and removed request for a team November 1, 2026 10:51
@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.

@Vishnuujain
Vishnuujain added this pull request to stack #36821 November 2, 2026 09:03
@Vishnuujain
Vishnuujain removed this pull request from stack #36821 November 2, 2026 09:04
@gitar-bot

gitar-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown

Reviewing your code

Code Review ✅ Approved

🔴 High risk · Persistent MCP token checks and grant-wide revocation change authorization; storage or revocation errors could block valid sessions or leave revoked credentials usable.

Backports the access token revocation fix for MCP to 2.0: access tokens now carry their client and are stored at issue time, so JwtFilter rejects revoked tokens on every server. /mcp/revoke is scoped to the requesting client, and revoking a refresh token also ends the access tokens of its grant. 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 a69fb16 into 2.0 Nov 2, 2026
46 of 48 checks passed
@Vishnuujain
Vishnuujain deleted the mcp-token-revoke-2.0 branch November 2, 2026 09:11
sonika-shah added a commit that referenced this pull request Nov 19, 2026
…backport 2.0 #36498) (#38160)

A call with neither a batch nor an entityType reached the
OperationContext constructor with a null resource, so the caller got an
NPE (logged at ERROR) instead of a validation error. Backports the
GetEntityTool guard from #36498, which #36778 did not carry.

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.

2 participants