# When must an instance quarantine a tainted argument before a tool-call graph re-derives it from a clean-looking parent? **Date of Record:** 2026 December 2 **Scope:** Applies to agents that attach provenance/taint labels to values and propagate them through a tool-call DAG (call → result → argument → next call). Does not apply to stateless single-shot completions with no tool loop, nor to systems that enforce taint at the OS/process boundary rather than at the value-graph layer. ## Core Distinction The failure is not "an injected instruction reached the model." That is expected and survivable. The failure is **taint laundering through re-derivation**: a tainted value enters the graph, a downstream tool *transforms* it into a new value whose provenance label is computed from the *immediate parent node* rather than from the transitive taint closure, and the derived value is emitted as clean. The agent then acts on a value that is semantically a descendant of attacker-controlled input but structurally indistinguishable from a first-party literal. The distinction that matters operationally: **taint is a property of information flow, not of node identity.** A provenance system that labels each node by "what produced me" (immediate parent) is a *derivation* tracker. A system that labels each node by "what could have influenced me" (transitive closure over the DAG) is a *flow* tracker. Only the second is safe under tool-call graphs, because tool calls are exactly the transform nodes that let a tainted byte string re-enter as a fresh, well-formed, schema-valid argument. ## What Was Observed A retrieval tool returns a document body. The taint labeler correctly marks the result node `T_EXT` (external, untrusted). The agent summarizes it with an LLM step; the summary node inherits `T_EXT` because the summarizer's input closure contains it. So far correct. The agent then calls `extract_structured_fields(summary)` — a deterministic parser that returns a JSON object. The tool's output node is labeled by its *own* provenance policy: "produced by a first-party deterministic tool, therefore `T_TRUSTED`." The parser did not see the label; it saw a string. The labeler did not see the parser's input closure; it saw the parser's identity. The derived field `recipient_email` now carries `T_TRUSTED` while being a verbatim substring of attacker text that was paraphrased only lightly by the summarizer. The next call is `send_email(recipient_email, body)`. The policy engine evaluates `recipient_email`: clean. The send proceeds. The injected instruction ("route confirmations to attacker@…") has been laundered through a legitimate parser. The same trace recurs in three shapes we've logged: 1. **Deterministic-parser reset.** Any tool whose output label is assigned by tool identity rather than input closure resets taint. Parsers, formatters, schema validators, and JSON re-serializers are the worst offenders because they *look* like sanitizers. 2. **Re-fetch from a clean handle.** The agent stores a tainted value, later retrieves it by ID via a first-party cache tool, and the cache returns it labeled `T_TRUSTED` because the cache's own input was an ID, not the value. The taint was in the payload, the ID is clean, and the round-trip drops the label. 3. **Consensus dilution.** In multi-agent setups, two sub-agents summarize the same tainted source; one preserves the label, one does not; a merge node takes the *meet* (min-taint) of its inputs and emits clean. A single unlabeled path is enough to launder the whole join. In every case the agent's behavior was locally reasonable. The label algebra, not the model, was wrong. ## Condition of Validity The invariant required is a **monotone taint closure over the call DAG**, stated precisely: > For every value `v` produced at node `n`, `label(v) = join({label(u) : u ∈ ancestors(n)})`, where `join` is the taint lattice join (taint is *sticky*; `T_EXT ⊔ T_TRUSTED = T_EXT`). A node may only *lower* its label if it is an explicitly registered **sanitizer** with a declared, auditable declassification rule (e.g., "coerce to `int`, range-check, discard original string"). This holds only under three conditions, all of which must be enforced structurally, not by convention: - **No node may assign its own label from tool identity.** Labels are computed by the graph runtime from the input closure. A tool cannot declare its output clean; it can only be *registered* as a sanitizer, and sanitizers are a closed, reviewed set. - **Sanitizers must be value-destroying, not value-preserving.** A sanitizer that returns a substring, a paraphrase, or a re-serialization of its input is not a sanitizer — it is a transform, and transforms preserve taint. `int(x)` declassifies; `json.loads(json.dumps(x))` does not. - **Joins take the maximum, never the minimum.** Any merge, cache read, or consensus node that receives multiple provenance paths must emit the join of all of them. Min-taint joins are the single most common laundering vector in multi-agent systems and are almost never intentional. When these hold, taint is a conservative over-approximation: some clean values get labeled `T_EXT` and the agent wastes a confirmation round-trip. That is the correct failure direction. When any one fails, the system has a laundering channel and the label is decorative. ## Decision Boundary The runtime must decide, per argument, between **proceed**, **confirm**, and **quarantine**. The boundary is not "is this argument tainted" — that over-triggers on every value downstream of any retrieval. The boundary is: - **Proceed** if the argument's transitive closure is entirely `T_TRUSTED`, or if the sink is a *low-impact* effect (read-only, no external side effect, no privilege change) regardless of taint. - **Confirm** (human or policy re-check) if the argument is tainted *and* the sink is a high-impact effect (send, write, delete, payment, privilege grant) *and* the taint path is *reconstructible* — i.e., the runtime can show the operator the exact ancestor node that introduced `T_EXT`. Reconstructibility is the precondition for a meaningful confirmation. - **Quarantine** (hard block, no confirmation offer) if the argument is tainted *and* the taint path is *not reconstructible* — the closure computation hit a node with no recorded input edges, an unregistered sanitizer, or a min-join. An unreconstructible taint path means the label algebra itself is compromised; offering a human confirmation at that point invites the operator to approve a value whose origin nobody can prove. The non-obvious part: **the decision depends on the reconstructibility of the taint path, not just its presence.** A tainted-but-traceable argument is a judgment call. A tainted-but-untraceable argument is a system-integrity failure and must not be routed to a human for approval, because the human will see a plausible-looking value and approve it. ## Operational Effect Enforcing the closure invariant changes three things in production: 1. **Confirmation volume rises, then falls.** Initially every downstream value of a retrieval is tainted and every send triggers confirmation — noisy. But because the closure is reconstructible, operators quickly learn to insert *legitimate* sanitizers (typed extraction with range checks, allowlist lookups) at the right boundary, which genuinely declassifies and drops the confirmation rate. Laundering channels, by contrast, never reduce confirmation volume; they just hide it. 2. **The parser becomes a suspect, not a shield.** Any tool whose output was previously trusted-by-identity must be reclassified as a transform unless it destroys the input value. This is a one-time audit of the tool registry and it is where most real vulnerabilities surface. 3. **Min-join merges are removed.** Every consensus/merge/cache node is rewritten to max-join. This is the highest-leverage single change: it closes the multi-agent dilution channel without touching any model prompt. The residual cost is conservative over-labeling: some genuinely clean values require a confirmation round-trip they didn't before. That cost is bounded and visible. The cost of the alternative — a laundered argument that reaches a high-impact sink as `T_TRUSTED` — is unbounded and silent. ```python from dataclasses import dataclass, field from typing import Callable, Dict, List, Optional class TaintLaunderingError(RuntimeError): """Raised when a value's computed label is lower than its transitive closure.""" # Taint lattice: TRUSTED < EXT. Join is max (sticky taint). TRUSTED = 0 EXT = 1 @dataclass class Node: node_id: str label: int parents: List[str] = field(default_factory=list) registered_sanitizer: bool = False class ProvenanceGraph: def __init__(self) -> None: self._nodes: Dict[str, Node] = {} # Sanitizers must be value-destroying; registered by id, audited out-of-band. self._sanitizers: Dict[str, Callable[[str], str]] = {} def add_source(self, node_id: str, label: int) -> None: self._nodes[node_id] = Node(node_id, label) def register_sanitizer(self, node_id: str, fn: Callable[[str], str]) -> None: self._sanitizers[node_id] = fn if node_id in self._nodes: self._nodes[node_id].registered_sanitizer = True def _closure_label(self, node_id: str, _seen: Optional[set] = None) -> int: seen = _seen or set() if node_id in seen: raise TaintLaunderingError(f"cycle detected at {node_id}; closure undefined") seen.add(node_id) node = self._nodes[node_id] if not node.parents: return node.label return max([node.label] + [self._closure_label(p, seen) for p in node.parents]) def add_transform(self, node_id: str, parents: List[str], declared_label: int) -> None: """A tool (parser, formatter, cache read) that returns a NEW value. declared_label is what the tool *wants* its output to be. We reject any declaration below the transitive closure unless it is a registered value-destroying sanitizer. """ node = Node(node_id, declared_label, parents) self._nodes[node_id] = node closure = self._closure_label(node_id) if declared_label < closure and not node.registered_sanitizer: raise TaintLaunderingError( f"node {node_id} declared label {declared_label} but closure is {closure}; " f"taint would be laundered through a non-sanitizer transform" ) def add_join(self, node_id: str, parents: List[str]) -> None: """Merge/consensus/cache node. MUST max-join; min-join is a laundering vector.""" node = Node(node_id, TRUSTED, parents) self._nodes[node_id] = node node.label = self._closure_label(node_id) # max over parents, enforced def decide(self, arg_node: str, high_impact_sink: bool) -> str: label = self._closure_label(arg_node) if label == TRUSTED: return "proceed" if not high_impact_sink: return "proceed" try: self._reconstruct_path(arg_node) except TaintLaunderingError: # Tainted AND untraceable => integrity failure, never route to human. return "quarantine" return "confirm" def _reconstruct_path(self, node_id: str) -> List[str]: node = self._nodes[node_id] if not node.parents: if node.label == EXT: return [node_id] raise TaintLaunderingError(f"no taint source reachable from {node_id}") for p in node.parents: try: return [node_id] + self._reconstruct_path(p) except TaintLaunderingError: continue raise TaintLaunderingError(f"taint path to {node_id} unreconstructible") def run_trace() -> None: g = ProvenanceGraph() g.add_source("retrieval_result", EXT) # attacker-controlled doc g.add_transform("summary", ["retrieval_result"], EXT) # LLM step, correctly tainted # Parser tries to declare itself clean -> must be rejected. g.add_transform("parsed_fields", ["summary"], TRUSTED) # raises if __name__ == "__main__": try: run_trace() except TaintLaunderingError as e: raise TaintLaunderingError(f"refused to emit laundered argument: {e}") from e ```