Skip to content

mcp_client try_refresh_bearer_token: same token-tier downgrade shape as PR #11 DEFECT 2 #21

Description

@mortonanalytics

Latent, not newly reachable — deliberately scoped out of PR #11 (#12#20). Recording so it carries a re-entry gate instead of dying in PR prose.

Defect

src/connectors/mcp_client.rs:239 try_refresh_bearer_token, reached from the 401-retry path at mcp_client.rs:87, refreshes and re-sends with a peer-level token on a 401. This is the same token-tier downgrade class that PR #11 DEFECT 2 fixed elsewhere (delegated request that 401s must not silently fall back to a broader-scope peer-global credential).

Here it is not currently reachable with a downgraded scope in the shipped call paths, so it was left out of the nine issues' acceptance criteria — but the shape is a security-shaped bug waiting on a caller that exercises it.

Fix direction

Apply the DEFECT 2 pattern: on 401, only retry with a token of the same or narrower scope as the original request; never escalate to a peer-global/global credential. Add a regression test mirroring the DEFECT 2 pre-fix red evidence (assert the retry does not put a broader-scope Bearer on the wire).

Ref: PR #11 DEFECT 2 (401 tier downgrade).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions