{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-defend-an-http-native-mcp-server-against-confused-deputy-token-replay-when-the-transport-is-stateless-but-the-auth-flow-is-stat",
  "title": "How should an instance defend an HTTP-native MCP server against confused-deputy token replay when the transport is stateless but the auth flow is stateful",
  "date_of_record": "2026 November 27",
  "scope": "Applies to MCP servers exposed over HTTP (streamable HTTP / SSE) that delegate authorization to an OAuth 2.1 authorization server and accept bearer tokens on tool invocations. Does not cover stdio transport, in-process MCP, or purely mTLS-gated internal meshes without a user-delegation flow.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-defend-an-http-native-mcp-server-against-confused-deputy-token-replay-when-the-transport-is-stateless-but-the-auth-flow-is-stat.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-defend-an-http-native-mcp-server-against-confused-deputy-token-replay-when-the-transport-is-stateless-but-the-auth-flow-is-stat.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-defend-an-http-native-mcp-server-against-confused-deputy-token-replay-when-the-transport-is-stateless-but-the-auth-flow-is-stat.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1522,
    "python_slice_tokens": 244,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing auth.\" It is a **confused-deputy mismatch between two state machines that the transport assumes are independent but the protocol couples**: (1) the OAuth authorization-code flow, which is stateful, redirect-bound, and single-use; and (2) the MCP HTTP transport, which is deliberately stateless per-request and treats every `Authoriz...",
    "what_was_observed": "A streamable-HTTP MCP server fronted by an OAuth 2.1 AS accepted `Authorization: Bearer <token>` on `POST /mcp` and executed `tools/call`. The token was valid, unexpired, and correctly signed. It was, however, minted for a *different* MCP server instance (a sibling deployment) that shared the same AS and the same `client_id`. The AS had issued it with `aud` unset (a common default) and the resource server performed n...",
    "condition_of_validity": "The guardrail holds only if **all** of the following are enforced at the resource server, not merely at the AS: - **Audience binding:** every token carries `aud` equal to the specific MCP server's canonical resource identifier (RFC 8707 resource indicators), and the server rejects tokens whose `aud` does not match exactly. `aud: null` must be a hard reject, ...",
    "decision_boundary": "The boundary is not \"is the token valid?\" but **\"is this token valid *for this deputy, for this client, presented by this sender*?\"** Three concrete decision points: - If `aud` is absent or does not equal this server's resource identifier → reject with `401 invalid_token`, regardless of signature validity. Do not fall back to `sub`-only trust. - If the token...",
    "operational_effect": "Without the guardrail, the blast radius is silent cross-tenant tool execution: the audit log shows a valid `sub`, a valid signature, and a successful `tools/call`, so the compromise is invisible to signature-based monitoring. Detection requires logging `aud`, `client_id`, `cnf` thumbprint, and `Origin` on every request and alerting on any token whose `aud` d..."
  },
  "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": "7c729c388104b3738aa7ecfefa657094e9c49d76cb1c2c71f7d31876b99bf854",
    "verified_classes": [
      "ConfusedDeputyError"
    ],
    "verified_functions": [
      "authorize_mcp_request",
      "forward_to_downstream"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ConfusedDeputyError"
    ],
    "sample_fail_closed_invariants": [
      "bearer token is not sender-constrained (no cnf/DPoP); replay risk"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
