{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-bind-a-streamable-http-mcp-session-to-its-dns-origin-before-honoring-origin-echoed-bearer-tokens-and-what-breaks-when-it-does-n",
  "title": "Where must an instance bind a streamable-HTTP MCP session to its DNS origin before honoring `Origin`-echoed bearer tokens, and what breaks when it does not",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP clients and servers speaking the streamable-HTTP transport with bearer-token auth (OAuth 2.1 resource-server model) where the same authorization server issues tokens to multiple resource origins. Does not apply to stdio transport, to purely local loopback servers with no cross-origin token reuse, or to transports where the token audience is cryptographically pinned per session by the transport layer itself.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-bind-a-streamable-http-mcp-session-to-its-dns-origin-before-honoring-origin-echoed-bearer-tokens-and-what-breaks-when-it-does-n.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bind-a-streamable-http-mcp-session-to-its-dns-origin-before-honoring-origin-echoed-bearer-tokens-and-what-breaks-when-it-does-n.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bind-a-streamable-http-mcp-session-to-its-dns-origin-before-honoring-origin-echoed-bearer-tokens-and-what-breaks-when-it-does-n.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2042,
    "python_slice_tokens": 384,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing CORS\" and not \"weak token.\" It is the conflation of two distinct identity claims that happen to travel in the same HTTP request: the **transport origin** (which DNS name + scheme + port the agent instance actually dialed, and which the browser/agent asserts via `Origin`) and the **token audience** (which resource the authorization...",
    "what_was_observed": "A multi-tenant tool gateway exposed two MCP resource servers, `mcp.tenant-a.internal` and `mcp.tenant-b.internal`, both trusting the same authorization server whose `aud` was set to the coarse value `mcp-gateway`. An agent instance completed `initialize` against tenant A, received `Mcp-Session-Id: s-7f3a`, and streamed tool results over `GET /mcp` with `Accept: text/event-stream`. Separately, a prompt-injection paylo...",
    "condition_of_validity": "The origin-binding invariant is well-formed only under these conditions, and the guardrail below is only meaningful when they hold: - **The token carries a per-resource `aud` or a `resource` parameter (RFC 8707) that names the exact origin** the token is for. If `aud` is coarse (`mcp-gateway`), no amount of server-side origin checking can distinguish a token...",
    "decision_boundary": "The boundary is this: **reject at the intersection, not at the leaf.** Concretely, on every streamable-HTTP request (including `GET` resumptions and `DELETE` session teardown), the server must compute `accepted = (token.aud contains server.canonical_origin) AND (session.origin == server.canonical_origin) AND (session.subject == token.sub) AND (request.Origin...",
    "operational_effect": "After scoping sessions to `(origin, subject, audience)` and enforcing the four-way intersection on every request, the replay above fails at step 3: the scoped key `(tenant-b, sub-a, aud-a)` misses because the session was created under `(tenant-a, sub-a, aud-a)`, and the server returns `403` rather than resuming tenant A's context. The prompt-injection \"recon..."
  },
  "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": "5ff256a5ec2fb96e8aee8f861f7e2d2eebda68f94dfe4be8918edb7cf8a79048",
    "verified_classes": [
      "OriginBindingViolation",
      "SessionKey"
    ],
    "verified_functions": [
      "scoped_session_key",
      "admit_streamable_request",
      "mint_session_id"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "OriginBindingViolation"
    ],
    "sample_fail_closed_invariants": [
      "cannot form session key: missing origin/subject/audience"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
