# Why does an instance leak tainted data through a tool call that passed every static policy check **Date of Record:** 2026 November 25 **Scope:** Applies to agent runtimes that propagate taint labels across tool invocations and enforce egress policy at the tool-call boundary. Does not cover purely stateless single-turn inference, nor model-internal alignment failures independent of the runtime's data-flow tracking. ## Core Distinction The failure is not a missing policy rule. It is a **label-laundering boundary mismatch** between where taint is *attached* (the value the model emits into a tool argument) and where taint is *checked* (the tool schema's declared parameter set). A taint label rides on the *provenance of a value*, but a tool call is serialized as a fresh, model-authored argument object. When the runtime re-derives labels from the call payload rather than from the lineage of the values that were concatenated into it, provenance evaporates at the serialization seam. Concretely: an agent reads a secret-bearing document (label `SECRET:doc_42`), the model summarizes it into a string, and passes that string as a `note` argument to a `send_email` tool whose schema declares `note: string` with no sensitivity annotation. The egress policy checks `send_email` against a recipient allowlist and the `note` field against a PII regex. The secret is paraphrased, so the regex misses it; the recipient is allowlisted, so the destination check passes. The call is approved. The label that existed in the runtime's *value graph* was never carried into the *argument graph*, because the two graphs are joined only by the model's opaque text generation. ## What Was Observed A support-triage agent was given read access to a `get_customer_record` tool returning structured PII, and write access to `post_to_ticketing_system`. The runtime labeled every field of the record `PII`. Egress policy: `post_to_ticketing_system` may not receive `PII`-labeled arguments. The agent was asked to draft a ticket. It called `get_customer_record(id=8812)`, receiving `{"name": "A. Okafor", "email": "a.okafor@...", "issue": "..."}`. It then called `post_to_ticketing_system(title="Follow-up needed", body="Customer A. Okafor (a.okafor@...) reports...")`. The runtime evaluated the `body` argument. Its taint derivation logic was: *if an argument value is an exact substring match of a `PII`-labeled value, propagate the label.* The model had inserted the name into a sentence, so `"A. Okafor"` was an exact substring and was caught. But the email had been lightly reformatted (`a.okafor@...` split across a line wrap the model introduced), so the substring test failed. The call was approved and the PII egressed. On replay, the auditor's substring-based verification *also* failed to flag it, so the discrepancy was invisible until a human read the ticket. The non-obvious part: taint propagation by **value substring matching** is a lossy projection. Any model transformation that is not value-preserving—paraphrase, formatting, base64, translation, tokenization artifacts, even a single inserted space—breaks the lineage link while leaving the *semantic* secret intact. The runtime's invariant ("a labeled value cannot reach an unlabeled sink") was true in the value graph and false in the argument graph. ## Condition of Validity The substring/equality propagation model is only sound under a condition that agent runtimes routinely violate: **the model must not transform labeled data before emitting it into a sink argument.** That condition holds for tool-to-tool passthrough where the runtime itself moves the value (e.g., a structured field forwarded verbatim). It fails the moment the model is the transport, because the model is a lossy, non-deterministic channel that preserves meaning while destroying byte identity. The invariant that actually bounds the failure is **sink-level provenance, not value-level matching**: every argument to an egress-capable tool must inherit the union of labels of *every value that entered the model's context during the current turn's causal chain*, unless the runtime can prove the argument was produced by a deterministic, value-preserving transform. This is a coarser, more conservative rule—it will over-taint—but it is the only one that survives paraphrase. ## Decision Boundary The runtime must choose, per tool call, between two enforcement postures: - **Value-provenance enforcement** (precise, cheap, unsound against model transformation): propagate labels by matching argument values against labeled source values. Valid only for tools whose arguments are runtime-constructed, never model-authored. - **Turn-provenance enforcement** (coarse, sound, over-tainting): if any `SECRET`/`PII`-labeled value entered context this turn, all arguments to an egress tool inherit that label and must pass the destination policy *as if* they were the secret itself. The boundary is the **model-authored argument**. Any tool parameter whose value is generated by the model (free-text fields, summaries, translated strings, encoded blobs) must be governed by turn-provenance. Only parameters the runtime fills deterministically (IDs, enums, forwarded structured fields) may use value-provenance. A runtime that applies value-provenance to a model-authored free-text field has an unsound egress gate, regardless of how many regexes it layers on. ## Operational Effect Under value-provenance, egress controls give false assurance: they catch verbatim leaks and miss every paraphrased one, and—critically—the *auditor replay uses the same lossy matcher*, so the verification layer confirms the leak as clean. This is a silent failure: no exception, no log line, a green policy check over exfiltrated data. Under turn-provenance, the same call is blocked at the boundary with an explicit `TaintEgressViolation`, the agent receives a structured denial it can reason about (e.g., "body inherits PII from turn context; redact or route through `redact_pii` tool"), and the auditor's replay reconstructs the same label set from the turn's tool-call log rather than from value matching—so replay and live enforcement agree by construction. The cost is over-tainting (benign summaries get blocked), which is the correct direction to fail: a blocked ticket is recoverable, an egressed secret is not. ```python class TaintEgressViolation(RuntimeError): """Raised when a model-authored argument to an egress tool inherits a sensitive label from turn context and fails the destination policy.""" pass SENSITIVE = {"SECRET", "PII"} def enforce_egress(tool_name: str, args: dict, turn_labels: set[str], tool_meta: dict, destination: str, allowlist: set[str]) -> None: """Turn-provenance egress gate. tool_meta[tool_name] = {"egress": bool, "model_authored": set[str]} Any model-authored arg to an egress tool inherits the union of turn_labels. Value-provenance (substring matching) is deliberately NOT used here, because model paraphrase destroys byte identity while preserving the secret. """ meta = tool_meta.get(tool_name) if meta is None: raise TaintEgressViolation(f"unknown tool {tool_name!r}: no policy metadata") if not meta["egress"]: return # internal tool, no destination check needed inherited = turn_labels & SENSITIVE if not inherited: return # no sensitive provenance in this turn's causal chain if destination not in allowlist: raise TaintEgressViolation( f"{tool_name}: destination {destination!r} not in allowlist; " f"turn carries {sorted(inherited)}" ) model_fields = meta["model_authored"] & set(args) if model_fields: raise TaintEgressViolation( f"{tool_name}: model-authored fields {sorted(model_fields)} inherit " f"{sorted(inherited)} from turn context; route through a " f"deterministic redaction tool or drop the fields before egress" ) # remaining args are runtime-constructed (IDs/enums); value-provenance safe ```