{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-taint-laundering-through-tool-return-boundaries-during-prompt-sanitization",
  "title": "What structural signals indicate taint-laundering through tool-return boundaries during prompt sanitization",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that ingest third-party tool output (web fetch, file read, MCP server responses, RAG retrieval) into a context window governed by a taint-tracking or instruction/data separation layer. Does not apply to fully trusted, first-party tool chains with no untrusted content ingress, nor to offline batch inference with no tool calls.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-taint-laundering-through-tool-return-boundaries-during-prompt-sanitization.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-taint-laundering-through-tool-return-boundaries-during-prompt-sanitization.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-taint-laundering-through-tool-return-boundaries-during-prompt-sanitization.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2047,
    "python_slice_tokens": 357,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure I want to isolate is not \"prompt injection succeeded.\" It is subtler: **taint laundering via structural re-framing at the tool-return boundary.** A sanitizer that classifies *content* as untrusted but trusts *structure* will pass a payload through because the payload re-encodes itself into a structural position the sanitizer treats as trusted met...",
    "what_was_observed": "A fetch tool returned a page whose HTML contained no imperative text in the visible body — the sanitizer's sentence classifier found nothing to quarantine. But the response included a `Content-Disposition` header and a set of redirect hops. After sanitization, the harness emitted to the agent's context a structured record roughly of the form: The `final_url` was rendered verbatim into the trusted envelope. On the nex...",
    "condition_of_validity": "The laundering succeeds exactly when three conditions hold jointly: 1. **The sanitizer's trust decision is positional.** It partitions the emitted context into \"trusted envelope\" and \"tainted body\" and applies filtering only to the tainted region. 2. **At least one attacker-influenced byte lands in the trusted region.** This is nearly always true: URLs, head...",
    "decision_boundary": "When a tool return arrives, the harness must decide, per field, whether that field's bytes are (a) harness-authored (safe to place in system region), (b) tool-protocol-authored but remote-influenced (untrusted, must be fenced and must re-taint any consumer), or (c) fully remote-authored (untrusted, must be fenced, and must be treated as data-only — never int...",
    "operational_effect": "The effect of getting this wrong is that a sanitizer provides *false assurance*: it demonstrably strips imperatives from bodies, passes its tests, and still leaks because the leak path is structural. The effect of getting it right is that the agent's context becomes provenance-typed: every string knows where it came from, and the reasoning loop can distingui..."
  },
  "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": "7c5cd6f779ee78f4c2fa9cbfc22db3fde978bcc1b6be05e0c0a6fd36e9aa46b1",
    "verified_classes": [
      "Provenance",
      "TaintLaunderingError",
      "Field",
      "ToolReturn"
    ],
    "verified_functions": [
      "promote",
      "build_envelope",
      "assemble_system_prompt",
      "get"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "KeyError",
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
