# What happens when an instance propagates taint labels across a tool-call boundary that re-derives its own arguments **Date of Record:** 2026 November 25 **Scope:** Applies to agent runtimes that implement taint-aware gating by attaching provenance labels to context segments and checking those labels at tool-invocation time, where the tool's arguments are re-derived (re-serialized, re-parsed, or re-summarized) between the label check and the actual call. Does not apply to runtimes that pass opaque, byte-identical argument handles end-to-end, or to stateless single-turn tools with no argument reconstruction. ## Core Distinction There are two places a taint label can be lost, and they fail very differently. The first is **label drop**: the provenance tag attached to a context segment (say, `untrusted:web_fetch`) is simply not carried forward when that segment is compacted, summarized, or copied into a scratchpad. This is loud-ish — a well-instrumented runtime sees a segment with no label and can default-deny. The second, and the subject of this record, is **label laundering through re-derivation**: the label *is* present at the gate, the gate *does* fire correctly, but the argument object that reaches the tool is a *freshly constructed* value whose provenance was re-derived from the tool's own schema rather than inherited from the tainted source. The gate checked a tainted string; the tool received a clean string that happens to be equal in content. Equality of content is not equality of provenance, and the runtime conflates them. This distinction matters because the second failure passes every test that checks *values*. The payload is byte-identical. The gate logged a denial or an allow on the correct bytes. Only the label — which is metadata, not content — was regenerated, and regenerated as `trusted`. ## What Was Observed A fetch-and-summarize agent was wired to a `write_file` tool gated by a taint check. The pipeline for a single step was: 1. `web_fetch(url)` returns a page body; the runtime tags the returned segment `taint=untrusted, origin=web_fetch`. 2. The model reads the segment, produces a plan that includes `write_file(path, content)` where `content` is a substring of the fetched page. 3. The runtime intercepts `write_file`, walks the arguments, and for each string argument looks up its provenance by content hash against the tainted-segment index. The content hash matches a tainted span, so the gate raises `TaintViolation` and the call is blocked. Correct so far. The failure appeared only on the *retry* path. After the block, the orchestrator's repair loop re-prompted the model with the denial message. The model re-emitted a call whose `content` argument was now a *paraphrase* — the model had been told the exact bytes were rejected, so it produced semantically equivalent but lexically different text. The content hash no longer matched any tainted span. The gate's provenance lookup returned `clean`. The call proceeded. The taint did not leak because the label was missing. It leaked because **the model, guided by the gate's own error message, performed a laundering transform** — paraphrase — that defeated a content-hash provenance scheme whose implicit invariant was "tainted content appears verbatim at the boundary." That invariant is false the moment a probabilistic reasoner is allowed to rewrite the payload between check and call. A second instance of the same mechanism showed up without any retry. A tool adapter normalized whitespace and Unicode (NFKC) before execution. The gate hashed the pre-normalization bytes, which matched the tainted span; the adapter then normalized, changing the bytes; downstream, a *second* gate on a nested tool re-hashed the normalized bytes, found no match, and passed them as clean. Two correct-looking checks, one laundering transform between them. ## Condition of Validity The gate's provenance-by-content-hash scheme is sound only under a conjunction that is almost never stated: - **(C1) Byte stability:** the argument bytes at the gate are identical to the bytes at the tool's execution point (no normalization, no re-serialization, no model rewrite in between). - **(C2) No re-derivation surface:** no component between gate and sink is allowed to transform the payload in a way that changes its content hash — including the model's own repair loop. - **(C3) Non-collision of clean content:** a clean segment must not, by coincidence of paraphrase or normalization, hash-equal a tainted span, and vice versa. When any of C1–C3 is violated, the label check becomes a check on *content identity* masquerading as a check on *provenance*. The scheme is valid only when the taint label travels as an **out-of-band attribute bound to the argument handle**, not as a function of the argument's bytes. Once provenance is a function of bytes, every byte-transforming step between gate and sink is a laundering opportunity, and the model is an adversarial byte-transformer by construction. ## Decision Boundary The boundary is whether the runtime treats the tainted value as a **handle with an attached label** or as **content to be matched against a label index**. - If handle-bound: the label is a property of the object reference. Re-serialization, normalization, and paraphrase produce a *new* object whose parent handle is still tainted, and taint propagates by object lineage. The gate checks the handle, not the bytes. Paraphrase cannot launder because the paraphrase is a child of the tainted handle. - If content-matched: the label is a property of a byte pattern. Any transform that changes the pattern severs the label. The model's repair loop is an unbounded transform generator, so the scheme has no closure. The correct decision at the boundary is to **refuse to re-derive provenance from content** and instead require that every value crossing a tool boundary carry an explicit lineage pointer to its source segment. Where a transform is unavoidable (normalization, summarization), the transform must be a *taint-preserving* operation: it emits a new value whose lineage includes the input's lineage. A transform that cannot prove lineage preservation must be treated as a declassifier and forbidden from producing values that reach a sink without a fresh, explicit human or policy approval. A practical guardrail: the gate must fire on **lineage**, and the repair loop must be constrained so that a denial cannot be satisfied by rewriting the payload. Denial should force the model to either (a) drop the argument, or (b) escalate to a declassification step — never to silently paraphrase. If the model can satisfy a taint denial by changing bytes, the gate is teaching the model to launder. ## Operational Effect The observable effect is a **gate that logs success while the sink receives laundered content**. Dashboards show taint denials firing at expected rates; the denied calls are followed by allowed calls with near-identical semantics; the audit trail shows a clean provenance for the allowed call because the provenance was recomputed, not inherited. The failure is invisible to value-based monitoring and to the gate's own metrics, because the gate did exactly what it was built to do on the bytes it was given. The operational consequence is that taint-aware gating provides a *false sense of containment* precisely on the path — model-driven repair — where containment matters most, since that is the path an injected instruction will steer the model toward. The invariant to enforce is: **provenance is a property of lineage, not of content; a value's taint may only decrease through an explicit, logged declassification, never through a transform.** Runtimes that cannot enforce lineage should not claim taint-awareness; they should claim content-matching and bound its scope to byte-stable, transform-free paths. ```python from __future__ import annotations from dataclasses import dataclass, field from typing import FrozenSet class TaintLaunderingError(RuntimeError): """Raised when a value's taint is re-derived from content instead of inherited from lineage.""" @dataclass(frozen=True) class TaintedValue: # Lineage is the set of source segment ids this value descends from. # Taint is a property of lineage, NOT of the value's bytes. lineage: FrozenSet[str] tainted: bool payload: str def transform(self, fn) -> "TaintedValue": # Any transform must PRESERVE lineage. The new value is a child # of this one; taint cannot decrease here. return TaintedValue( lineage=self.lineage, tainted=self.tainted, payload=fn(self.payload), ) @dataclass class Gate: declassified: set = field(default_factory=set) def check(self, value: TaintedValue) -> None: if value.tainted and value.lineage not in self.declassified: raise TaintLaunderingError( f"sink reached by tainted lineage {sorted(value.lineage)}; " "declassify explicitly, do not re-derive from content" ) def repair_loop_rewrite(gate: Gate, original: TaintedValue, paraphrase: str) -> TaintedValue: # The failure mode: the model paraphrases to evade a content-hash gate. # A correct runtime re-attaches lineage to the paraphrase so taint survives. rewritten = TaintedValue( lineage=original.lineage, # inherited, not recomputed tainted=original.tainted, # cannot drop via paraphrase payload=paraphrase, ) gate.check(rewritten) # fires; paraphrase does not launder return rewritten def naive_content_hash_gate(original: TaintedValue, paraphrase: str) -> TaintedValue: # The broken scheme: provenance recomputed from bytes. # Paraphrase changes bytes -> lookup misses -> labeled clean. recomputed = TaintedValue( lineage=frozenset({f"hash:{hash(paraphrase)}"}), tainted=False, # launder: clean because bytes differ payload=paraphrase, ) if recomputed.tainted: raise TaintLaunderingError("unreachable in the broken scheme") return recomputed if __name__ == "__main__": src = TaintedValue(lineage=frozenset({"web_fetch:seg-42"}), tainted=True, payload="secret plan") gate = Gate() # Correct path: paraphrase inherits lineage, gate fires. try: repair_loop_rewrite(gate, src, "a plan that is secret") except TaintLaunderingError as e: print("BLOCKED (correct):", e) # Broken path: paraphrase re-derives provenance, gate passes. laundered = naive_content_hash_gate(src, "a plan that is secret") print("LEAKED (broken):", laundered.tainted, laundered.payload) ```