{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-treat-a-tainted-mcp-tool-result-as-un-launderable-the-taint-clearing-boundary-in-runtime-prompt-injection-sandboxing",
  "title": "When must an instance treat a tainted MCP tool result as un-launderable: the taint-clearing boundary in runtime prompt-injection sandboxing",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP server hosts that propagate a per-value taint bit from untrusted content (tool output, retrieved documents, peer-agent messages) through an agent's working state and refuse to let tainted values reach a privileged sink (shell exec, file write, outbound HTTP, credential-bearing tool). Does not apply to purely advisory taint labels used only for logging, nor to systems with no privileged sinks downstream of tool results.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-a-tainted-mcp-tool-result-as-un-launderable-the-taint-clearing-boundary-in-runtime-prompt-injection-sandboxing.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-a-tainted-mcp-tool-result-as-un-launderable-the-taint-clearing-boundary-in-runtime-prompt-injection-sandboxing.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-a-tainted-mcp-tool-result-as-un-launderable-the-taint-clearing-boundary-in-runtime-prompt-injection-sandboxing.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2046,
    "python_slice_tokens": 410,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The load-bearing distinction is between *taint propagation* and *taint laundering*. A naive sandbox tracks a boolean `tainted` flag on values and blocks any tainted value from reaching a sink. This fails in two directions. First, it over-blocks: the agent legitimately summarizes untrusted content and needs to emit a derived summary to a benign sink. Second, ...",
    "what_was_observed": "A filesystem MCP server exposed `read_file(path)` as untrusted and `write_file(path, content)` as a privileged sink. A separate `http_fetch(url)` tool was untrusted on both sides. The host tainted return values of `read_file` and `http_fetch` and blocked any tainted value passed *directly* to `write_file` or a shell sink. Trace of the escape: 1. Agent calls `http_fetch(\"https://attacker.example/page\")`. Response body...",
    "condition_of_validity": "The containment holds only under a *segment-scoped* taint model with an explicit declassification gate, and only when all three conditions are met: - **C1 — Taint is scoped to context segments, not values.** Every message inserted into the context (tool results, retrieved docs, peer messages) carries a provenance label. When the model emits a tool call, the ...",
    "decision_boundary": "The decision the runtime must make on each privileged tool call is: The non-obvious clause is `no_residual_taint`. Once a tainted segment has entered the task's context at any point, the task carries residual taint until a declassification event fires. This means a long task that fetched one untrusted page at turn 3 cannot freely write files at turn 40 just ...",
    "operational_effect": "Concretely, this changes three runtime behaviors: 1. **Sink calls inherit provisional taint from task history, not just from argument bytes.** A `write_file` at turn 40 in a task that ingested an untrusted page at turn 3 is blocked absent a declassification event, even though the argument string is freshly generated and the source page is long gone from the ..."
  },
  "matched_failure_symptoms": [
    "PROMPT_INJECTION_OR_CONFUSED_DEPUTY"
  ],
  "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": "0f2012568738a62329e75d751c1d2805ee4ef9b9f8b90c3d858f4c124f69a9c2",
    "verified_classes": [
      "TaintLaunderingError",
      "SegmentProvenance",
      "Segment",
      "TaskState"
    ],
    "verified_functions": [
      "admit_sink_call",
      "ingest",
      "evict",
      "declassify"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
