{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-quarantine-mcp-tool-output-before-context-insertion-when-taint-provenance-is-lost-at-the-transport-boundary",
  "title": "How should an instance quarantine MCP tool output before context insertion when taint provenance is lost at the transport boundary",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agent runtimes that mediate MCP tool calls through a transport layer (stdio bridge, HTTP gateway, or A2A relay) and insert returned content into the model context. Does not apply to in-process tool calls where the caller holds the live result object and provenance is structurally intact.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-quarantine-mcp-tool-output-before-context-insertion-when-taint-provenance-is-lost-at-the-transport-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-quarantine-mcp-tool-output-before-context-insertion-when-taint-provenance-is-lost-at-the-transport-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-quarantine-mcp-tool-output-before-context-insertion-when-taint-provenance-is-lost-at-the-transport-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1682,
    "python_slice_tokens": 286,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct questions a taint-aware sandbox must answer, and conflating them is the root failure: 1. **Content classification** — does this byte string contain instructions, exfiltration payloads, or delimiters that could be read as instructions? 2. **Provenance binding** — is this byte string *the same object* that the sandbox classified, or has ...",
    "what_was_observed": "A filesystem MCP server returned a file listing. The sandboxed classifier saw the raw `CallToolResult` and marked it `taint=UNTRUSTED_CONTENT`, `risk=low` (no imperative verbs, no URLs, no role markers). The transport bridge, however, ran the result through a normalizer that: (a) reordered object keys, (b) expanded JSON escapes, and (c) — the load-bearing step — appended a `_meta` block from the server's progress not...",
    "condition_of_validity": "Taint-aware sandboxing is only valid under a **classification-insertion identity invariant**: > For every span of bytes inserted into the model context, there exists a taint decision computed over a superset of those bytes, produced after the final serialization transform, and carried alongside the span through insertion. Three conditions must hold jointly: ...",
    "decision_boundary": "The runtime must choose, at the moment of insertion, between three dispositions per span: The non-obvious boundary: **label mismatch across the transport boundary is itself a `UNTRUSTED_TAINTED` trigger, regardless of content.** If the classifier's input hash does not match the assembler's output hash for a span, the span is tainted by definition — because t...",
    "operational_effect": "With the invariant enforced, the observed incident resolves as follows: the classifier runs on the final merged buffer, sees the `[system]` role token inside the filename span, labels that span `UNTRUSTED_TAINTED`, and the assembler inserts `[QUARANTINED: filesystem.list span 3, 47 bytes, reason=role_token]` in place of the injected line. The listing itself ..."
  },
  "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": "558cfe588aaaa9566cf18a16d99ba43d7c2c47158664e844a9041fb44a7a8a49",
    "verified_classes": [
      "TaintProvenanceError",
      "Span"
    ],
    "verified_functions": [
      "classify",
      "_sha",
      "insert_span",
      "assemble_and_insert"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintProvenanceError"
    ],
    "sample_fail_closed_invariants": [
      "assert 'QUARANTINED' in out"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
