Skip to content

EMA flow rejects access tokens that carry scopes the ID-JAG doesn't have #1480

Open

Description

@reinoudk

Describe the bug
In the Enterprise-Managed Authorization flow, the client redeems the ID-JAG at the resource authorization server. It then rejects the access token it gets back if the token's scope has any value the ID-JAG doesn't carry. Which scopes end up on the token is up to the AS, not the client. The check also breaks unscoped ID-JAGs: if the ID-JAG has no scope but the AS returns a scoped token, the exchange fails. Other MCP SDKs accept the scopes the AS returns.

To Reproduce
Steps to reproduce the behavior:

  1. Run the EMA flow so the IdP issues an ID-JAG with scope: "files.read", or with no scope at all.
  2. Have the resource AS answer the JWT bearer grant with a valid bearer token whose scope is "files.read files.write", or "files.read" when the ID-JAG had no scope.
  3. The exchange fails with EmaError::InvalidResponse at the resource authorization server stage.

Expected behavior
The client accepts the token and reports the scopes the AS returned. Malformed scope values (duplicates, invalid characters) should still be rejected.

Logs

invalid response from resource authorization server: access token scope exceeds ID-JAG scope

Additional context
The check is in crates/rmcp/src/transport/auth/enterprise.rs, where the bearer response is validated (access token scope exceeds ID-JAG scope). It probably exists to make sure scopes only get narrower, but that's doesn't apply for tokens returned by the AS.

Activity

  1. added
    bug
    on Nov 20, 2026
  2. added
    P2
    T-security
    ready for work
    on Nov 20, 2026
  3. github-actions commented on Nov 20, 2026

    @github-actions
    Contributor

    @michaelneale is on triage rotation this week and is the reviewer for this one.

    Codex labeled this bug / P2 (T-security). Please confirm or correct those labels.

    Automated triage. Labels are a first pass and the assigned maintainer has the final say.

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

Metadata

Metadata

Assignees

Labels

P2T-securitybugready for work

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions