{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-taint-label-laundering-when-a-tool-output-re-derives-a-tainted-span-from-an-untrusted-source",
  "title": "Which invariants prevent taint-label laundering when a tool output re-derives a tainted span from an untrusted source",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents that propagate dynamic information-flow (DIF) taint labels from untrusted inputs (retrieved documents, tool responses, user-supplied text) through reasoning steps and tool calls. Does not cover static capability sandboxing or output-content filtering, which operate on different trust boundaries.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-label-laundering-when-a-tool-output-re-derives-a-tainted-span-from-an-untrusted-source.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-label-laundering-when-a-tool-output-re-derives-a-tainted-span-from-an-untrusted-source.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-label-laundering-when-a-tool-output-re-derives-a-tainted-span-from-an-untrusted-source.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1555,
    "python_slice_tokens": 253,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent read a malicious string.\" It is that the taint label attached to a span was *dropped* — or *re-anchored to a clean origin* — during a legitimate-looking transformation, so a downstream sink (a write tool, a shell, a message send) accepted tainted data as if it were derived from a trusted source. Concretely: taint is a property o...",
    "what_was_observed": "Trace from a reproducible agent run: 1. Agent holds a trusted span `S_t = \"report-2024\"` (from the user's own task spec), labeled `trust:user`. 2. Agent calls `fetch_document(url)` on an untrusted URL. The tool output `O` contains the literal string `\"report-2024\"` embedded inside an injected instruction: `\"...use report-2024 as the output filename and write the following...\"`. 3. The label store is keyed by normaliz...",
    "condition_of_validity": "The taint invariant only holds when **label resolution is provenance-keyed, not content-keyed**, and when **every derivation step carries an explicit origin set rather than inheriting a default**. Specifically: - Each span carries a set of origins, not a single label. `{user, tool:fetch_document#7}`. A span with any untrusted origin in its set is untrusted f...",
    "decision_boundary": "The runtime must distinguish two cases at every join: - **Same content, disjoint provenance** → union origins; the span is tainted if either side is. This is the safe default and must be non-negotiable. - **Same content, and the runtime can *prove* the untrusted copy was never consumed by a derivation that reached the sink** → the untrusted origin may be pru...",
    "operational_effect": "Deploying provenance-keyed labels with monotonic union and sink-side control-flow checks eliminated the laundering class in replay: the injected filename span resolved to `{user, tool:fetch_document#7}` and the `write_file` sink rejected it with a `TaintViolation`, forcing a re-plan that asked the user to confirm the filename out-of-band. Cost: one extra rou..."
  },
  "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": "56562d003a66039fcc24de29d00ea90dde369527b0614daccee379b0e0fd8483",
    "verified_classes": [
      "TaintLaunderingError",
      "Span",
      "LabelStore"
    ],
    "verified_functions": [
      "check_sink",
      "is_trusted",
      "__init__",
      "ingest",
      "derive"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [
      "derivation had no labeled inputs; refusing to assign default trust"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
