{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-mcp-oauth-token-audience-confusion-from-silently-widening-tool-scope-across-a-session",
  "title": "Which invariants prevent MCP OAuth token audience confusion from silently widening tool scope across a session",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP servers reachable over Streamable HTTP (or SSE) that gate individual tools behind OAuth 2.1 access tokens with RFC 8707 resource indicators. Does not cover stdio transport, which has no bearer-token surface, nor single-token-per-server deployments where every tool shares one audience by design.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-oauth-token-audience-confusion-from-silently-widening-tool-scope-across-a-session.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-oauth-token-audience-confusion-from-silently-widening-tool-scope-across-a-session.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-oauth-token-audience-confusion-from-silently-widening-tool-scope-across-a-session.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1539,
    "python_slice_tokens": 367,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two different things an MCP client believes about a token, and they diverge under load: the *transport binding* (this HTTP session is authenticated, so requests flow) and the *per-tool audience* (this specific token was minted for `mcp://server/tools/write_file`, not for `mcp://server/tools/read_secret`). The transport layer only ever checks the fi...",
    "what_was_observed": "A Streamable HTTP MCP server exposed two tools over one session: `query_metrics` (audience `mcp://obs/metrics`) and `rotate_credentials` (audience `mcp://obs/creds`). The client performed the OAuth flow once, obtaining a token whose `aud` was `mcp://obs/metrics`, and opened a session. The first `tools/call` for `query_metrics` succeeded. The second `tools/call` for `rotate_credentials` **also succeeded** — despite th...",
    "condition_of_validity": "The per-tool audience invariant holds **only if** the audience check is performed at dispatch time against the token material that authorizes *that specific call*, not against a principal cached at session establishment. Concretely: - The `aud` claim MUST be re-evaluated for every `tools/call`, comparing the token's resource indicator to the tool's declared ...",
    "decision_boundary": "The boundary is: **does the dispatcher hold the raw (or faithfully cached) `aud` at the moment it decides to execute the tool?** - If yes → compare `aud` to the tool's `resource_indicator`; mismatch is a hard reject (`401`/`403`, never a silent fallthrough). - If no (only a session principal) → the server MUST either (a) force per-call token presentation and...",
    "operational_effect": "Downstream, the effect is that a token scoped to a read-only observability resource can drive a credential-rotation tool within the same session, provided the principal's coarse scopes happen to cover it. This is a privilege-escalation-by-transport-reuse: the OAuth grant was correct, the resource indicator was correct, and the server still executed the wrong..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "398bfe81a8089220380c6792b9ad5602cc85157a8be5fd742920ac270b252c65",
    "verified_classes": [
      "AudienceMismatchError",
      "Token",
      "SessionPrincipal",
      "ToolSpec"
    ],
    "verified_functions": [
      "dispatch_tool_call"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "AudienceMismatchError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
