{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-sse-resumption-from-re-binding-a-stale-mcp-session-to-a-rotated-oauth-2-1-resource-token",
  "title": "Which invariants prevent SSE resumption from re-binding a stale MCP session to a rotated OAuth 2.1 resource token",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP servers using the Streamable HTTP transport (JSON-RPC over POST + optional GET SSE stream, `Mcp-Session-Id` header, `Last-Event-ID` resumption) fronted by an OAuth 2.1 resource server that validates bearer tokens with short TTLs. Does not cover stdio transport, nor servers that pin a single static token per process lifetime.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-resumption-from-re-binding-a-stale-mcp-session-to-a-rotated-oauth-2-1-resource-token.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-resumption-from-re-binding-a-stale-mcp-session-to-a-rotated-oauth-2-1-resource-token.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-resumption-from-re-binding-a-stale-mcp-session-to-a-rotated-oauth-2-1-resource-token.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2079,
    "python_slice_tokens": 449,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two independent identity axes on a Streamable HTTP MCP connection, and they are *not* the same axis: 1. **Session identity** — the opaque `Mcp-Session-Id` minted at `initialize`, which scopes server-side state (tool registry view, subscriptions, in-flight SSE event log keyed by `Last-Event-ID`). 2. **Authorization identity** — the OAuth 2.1 access ...",
    "what_was_observed": "A multi-tenant MCP server exposed a `search_documents` tool and a long-running `subscribe_changes` SSE stream. The client flow: 1. `POST /mcp initialize` with access token `T1` (scope `docs:read`, `sub=alice`, `exp=+300s`). Server returns `Mcp-Session-Id: S1` and binds `S1 → {sub: alice, scopes: [docs:read]}`. 2. Client opens `GET /mcp` with `Mcp-Session-Id: S1`, token `T1`. Server streams events `id: 1001`, `id: 100...",
    "condition_of_validity": "The guardrail holds — i.e., resumption is safe — only when *all* of the following are true simultaneously: - The server stores, alongside each buffered event, the **authorization context snapshot** (subject, scope set, and a hash of the token's `jti` or grant) that was in force when the event was emitted. - On `GET` resumption, the server recomputes the effe...",
    "decision_boundary": "The boundary is not \"expired vs. valid token.\" It is **\"same grant vs. different grant under same subject.\"** Three regimes: - **Same `jti`/grant, refreshed expiry:** safe to replay. The scope set is identical by construction; only `exp`/`iat` moved. - **Different grant, same `sub`, scope set is a superset:** replay is *permitted* but must be re-redacted aga...",
    "operational_effect": "Without the invariant, the following concrete effects occur: - **Redaction bypass via replay.** Payloads redacted for the narrow principal are stored unredacted in the SSE buffer and delivered on a later resumption. The audit trail attributes the delivery to the resumption token, decoupling \"who saw it\" from \"who was authorized when it was generated.\" - **Se..."
  },
  "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": "8c35d4d0fc73215d373f59d17460c2c48d5bc14d59eda776cafcf4b335f85209",
    "verified_classes": [
      "ResumptionAuthorizationError",
      "AuthContext",
      "BufferedEvent"
    ],
    "verified_functions": [
      "authorize_resumption",
      "handle_get_resume",
      "covers"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumptionAuthorizationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
