{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-agent-identity-binding-from-silently-degrading-under-mcp-session-reuse",
  "title": "Which invariants prevent agent identity binding from silently degrading under MCP session reuse",
  "date_of_record": "2026 November 12",
  "scope": "Applies to Model Context Protocol (MCP) deployments where a long-lived transport session (stdio, SSE, or streamable HTTP) carries an authenticated agent identity, and where the authorization decision for tool calls is derived from that session-bound identity rather than re-verified per request. Does not apply to fully stateless MCP transports that re-authenticate and re-authorize on every JSON-RPC message, nor to single-tenant local stdio servers with no identity layer at all.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-agent-identity-binding-from-silently-degrading-under-mcp-session-reuse.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-agent-identity-binding-from-silently-degrading-under-mcp-session-reuse.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-agent-identity-binding-from-silently-degrading-under-mcp-session-reuse.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1741,
    "python_slice_tokens": 351,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two different things that can be \"bound\" to an MCP session, and conflating them is the source of the failure mode: 1. **Session binding** — the transport-level association between a connection (or `Mcp-Session-Id`) and a server-side session object that holds negotiated capabilities, subscriptions, and pending request state. 2. **Identity binding** ...",
    "what_was_observed": "An MCP server using streamable HTTP issued an `Mcp-Session-Id` header at `initialize` and accepted that header on subsequent requests. The agent's OAuth token was validated at `initialize` and the resulting principal was cached on the session object. Tool-call authorization read `session.principal.scopes`. Two things were observed in production telemetry: - Session IDs appeared in server access logs (a debug middlewa...",
    "condition_of_validity": "The invariant holds — identity binding does not silently degrade — only when all of the following are true: 1. **The session ID is not a bearer credential.** Presenting `Mcp-Session-Id` alone must be insufficient to act. Each request must carry a proof-of-possession artifact (a DPoP-style signed JWT bound to a client-held key, or an mTLS client cert) that th...",
    "decision_boundary": "The decision boundary is whether to treat a session as an *identity-bearing capability* or as a *state container keyed by identity*. - **Treat as identity-bearing capability** (the failure mode): the session ID grants authority. This is acceptable only when the session is short-lived, single-use, and the ID never leaves the authenticated channel — conditions...",
    "operational_effect": "With the invariant enforced, three operational properties follow: - **Hijack detection becomes possible.** A request presenting session S with a PoP for principal B, where S is bound to principal A, is a detectable event. Log it as a security event with both principals and the session ID hash; do not silently serve it. - **Credential rotation and revocation ..."
  },
  "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": "f8220b7ed597f6d41d0388ee76ca358fa1a5f78e40c376a47d882a74fd40abd0",
    "verified_classes": [
      "SessionIdentityMismatch",
      "ProofOfPossessionError",
      "Principal",
      "Session"
    ],
    "verified_functions": [
      "_verify_pop",
      "authorize_tool_call"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ProofOfPossessionError",
      "SessionIdentityMismatch"
    ],
    "sample_fail_closed_invariants": [
      "missing session id or proof-of-possession artifact",
      "proof-of-possession did not verify against any registered key"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "hmac",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
