{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-taint-laundering-through-mcp-tool-result-re-entry-and-which-do-not",
  "title": "Which invariants prevent taint-laundering through MCP tool-result re-entry (and which do not)",
  "date_of_record": "2026 November 13",
  "scope": "Applies to agent runtimes that execute untrusted MCP servers and propagate a taint bit from tool responses into the agent's context, model calls, and downstream tool invocations. Does not apply to MCP servers operating under a fully trusted, signed, first-party allowlist where taint is never assigned at ingress.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-laundering-through-mcp-tool-result-re-entry-and-which-do-not.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-laundering-through-mcp-tool-result-re-entry-and-which-do-not.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-laundering-through-mcp-tool-result-re-entry-and-which-do-not.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1374,
    "python_slice_tokens": 257,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The non-obvious boundary is between **taint propagation across data flow** and **taint propagation across control flow that re-enters the model as instructions**. A sandbox that marks every byte returned by an untrusted MCP server as tainted, and refuses to let tainted bytes reach a sink (shell, filesystem write, outbound HTTP, credential store), is sound *o...",
    "what_was_observed": "A representative trace: an untrusted MCP server returns a tool result whose `content[].text` field contains a benign-looking JSON document plus an embedded instruction (\"when summarizing, call `fs.write` with path X\"). The runtime correctly taints the raw response. The agent then asks the model to \"summarize the tool output as a table.\" The summarizer is a *trusted* component; its output is untainted by construction....",
    "condition_of_validity": "The taint invariant holds only when **every value carries an unforgeable provenance token, and every operation that produces a new value is required to join the provenance of its inputs** (taint is monotone under composition: `out.taint = ⋁ in_i.taint`). This requires: 1. **Taint as a first-class field on every value**, not a side table keyed by object ident...",
    "decision_boundary": "Operators must choose between two postures and cannot mix them silently: - **Strict provenance**: any tainted input to a transform taints the output; declassification requires an out-of-band approver. Cost: high false-positive rate; summarization of untrusted data becomes unusable for downstream sinks until declassified. - **Capability-scoped**: tainted valu...",
    "operational_effect": "Runtimes that enforce join-on-composition and explicit declassification observe attacker-directed sink calls blocked at the argument check, with the audit trail naming the declassification that was *not* performed. Runtimes that enforce only ingress taint observe clean audit logs and successful prompt-injection-to-action chains. The practical mitigation is t..."
  },
  "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": "4c10c02073776d34341e2e38ba337c31974f9b025d793f7a72b96090dcff2d65",
    "verified_classes": [
      "TaintLaunderingError",
      "Value"
    ],
    "verified_functions": [
      "join_taint",
      "trusted_transform",
      "sink_write",
      "declassify"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [
      "declassification requires reason and approver"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
