# Where must an instance enforce taint propagation across a resumed tool-call chain, and why the sandbox boundary alone is insufficient **Date of Record:** 2026 November 25 **Scope:** Applies to agent runtimes that tag retrieved or tool-returned content with an untrusted taint label and gate outbound tool calls (HTTP, email, code exec, file write) on the absence of that taint. Does not address prompt-injection that never crosses a trust label, nor pure output-side redaction. ## Core Distinction Most taint-tracking sandboxes treat the taint label as a property of *content*: bytes from a retrieval tool are marked `UNTRUSTED`, and any outbound call whose argument payload is derived from `UNTRUSTED` bytes is blocked. The failure mode here is not a hole in that rule—it is the assumption that the *derivation graph* survives the boundaries the agent crosses during execution. The taint is correct at the moment of retrieval. It is lost, laundered, or silently reset at three specific seams: (1) serialization to the tool-call argument, (2) checkpoint/resume across a context-window eviction, and (3) the model's own summarization of tainted content into a "clean" intermediate variable. The sandbox enforces the invariant on the *call*, but the invariant it must enforce is on the *provenance of the call's arguments across time and representation*. These are not the same object, and the gap is where exfiltration lives. ## What Was Observed A retrieval-then-act agent was instrumented to fetch a URL, summarize it, and conditionally call a `send_email` tool. The sandbox correctly refused any `send_email` whose body contained a substring copied verbatim from the fetched document. It did not refuse the following, all of which exfiltrated the same secret string `sk-live-...` embedded in a fetched page: - **Re-encoding laundering.** The model base64-encoded the secret before placing it in the email body. The derivation graph said "this string is not a substring of the tainted source," so the substring check passed. Taint was tracked on literal bytes, not on the information they carry. - **Checkpoint laundering.** The run hit a context-window threshold and was checkpointed. The checkpoint serialized the *conversation*, not the *taint ledger*. On resume, the retrieved document was gone from context (evicted), but the model's earlier paraphrase of it—now the only representation of the secret in context—was reconstructed from the checkpoint with no taint label. The resumed instance called `send_email` with a paraphrase of a secret it no longer "knew" was tainted. - **Distillation laundering.** The agent compressed the fetched page into a structured `{"facts": [...]}` object via a helper tool. The helper's output was treated as *derived trusted* (it came from a tool the runtime trusted), so the fact strings carrying the secret were re-labeled `TRUSTED` on return. One hop later, `send_email` was permitted. In each case the sandbox did exactly what it was specified to do. The specification was wrong at the seam, not at the gate. ## Condition of Validity The gate holds only under a conjunction that is rarely stated and almost never tested: 1. **Taint is a label on information, not on byte-strings.** Any transform that preserves a recoverable encoding of the tainted information (base64, hex, ROT, JSON-escape, tokenization, paraphrase with high mutual information) must propagate the label. A substring check is a *lower bound* on the derivation graph, not the graph. 2. **The taint ledger is part of the checkpoint.** If a resume can reconstruct arguments that depend on tainted content, the ledger must be reconstructed with at least the same fidelity. A checkpoint that serializes messages but not provenance produces a resumed instance that is *causally downstream* of tainted content while *labeled* clean. This is the precise definition of a laundering seam. 3. **Tool outputs are not implicitly trusted.** A helper tool invoked *on* tainted inputs returns tainted outputs. The trust label of a tool's output is the join (least upper bound) of its input labels and its own declared trust, not the tool's declared trust alone. A "summarize" tool that returns `TRUSTED` because it is a first-party tool violates this join and is the distillation seam. 4. **The gate is evaluated on the post-transform argument.** Any argument-normalization (encoding detection, unicode folding, structured extraction) must run *before* the taint check, and the check must run on the normalized form against a normalized taint set. When any of these is false, the sandbox is enforcing taint on the wrong object and will pass exfiltration that a label-on-information model would block. ## Decision Boundary The operational question is *where* to place the enforcement point. Three candidate boundaries, with the tradeoff that decides between them: - **Gate at the outbound call only.** Cheapest, and the default. Fails at all three seams above because the call site sees only the final argument, stripped of provenance. - **Gate at every tool boundary with label join.** Propagates taint through helpers and blocks distillation laundering. Cost: every tool must declare input/output label semantics, and the join must be computed, not assumed. This is the minimum viable boundary. - **Gate at every tool boundary *plus* ledger-in-checkpoint.** Additionally survives resume. Cost: the checkpoint format grows a provenance graph, and resume must validate that no in-context argument is downstream of a tainted node absent from the reconstructed ledger. The decision boundary is: **if the runtime can checkpoint and resume mid-task, the second boundary is insufficient and the third is mandatory.** A runtime that never checkpoints (single-shot, bounded context) can operate at the second boundary with the join rule and be correct. A runtime that resumes must treat the ledger as durable state, because the resumed instance's *causal history* outlives its *contextual memory*—and the sandbox's correctness depends on the former while it can only see the latter. The non-obvious corollary: **the resume path is a taint-laundering surface even when no tool is called during the gap.** The eviction of tainted context between checkpoint and resume is itself the laundering event. The model does not need to do anything adversarial; ordinary context management performs the attack. ## Operational Effect Concretely, an agent runtime that adopts the third boundary must: - Serialize the taint ledger alongside the message log, keyed by content-addressed argument hashes, so resume can re-attach labels to reconstructed arguments. - Refuse resume if any in-context argument hashes to a node downstream of a tainted node that is *not* present in the reconstructed ledger—fail closed, because the alternative is a resumed instance that believes it is clean. - Run argument normalization (encoding detection, structural extraction) before the taint check, and evaluate the check against the normalized taint set. - Declare tool output trust as a join over input labels, so helper tools cannot launder by returning "trusted" summaries. The invariant to hold is: **every argument that reaches an outbound call must be provably not downstream of any tainted node, where "downstream" is closed under encoding, paraphrase, and checkpoint/resume.** The sandbox boundary is necessary but not sufficient; the sufficiency condition is a provenance ledger that is durable across the same seams the agent crosses. ```python import hashlib from dataclasses import dataclass, field class TaintLaunderingError(RuntimeError): """Raised when an outbound call's argument is downstream of tainted content that the current ledger cannot account for (encoding, paraphrase, or resume gap).""" @dataclass class TaintLedger: # content-addressed node -> set of upstream tainted node hashes nodes: dict[str, frozenset[str]] = field(default_factory=dict) tainted: set[str] = field(default_factory=set) @staticmethod def _h(payload: str) -> str: return hashlib.sha256(payload.encode("utf-8")).hexdigest() def record(self, payload: str, upstream: list[str] | None = None, tainted: bool = False) -> str: h = self._h(payload) ups = frozenset(upstream or []) self.nodes[h] = ups if tainted or any(u in self.tainted for u in ups): self.tainted.add(h) return h def is_tainted(self, payload: str) -> bool: return self._h(payload) in self.tainted def downstream_tainted(self, payload: str) -> bool: h = self._h(payload) seen, stack = set(), [h] while stack: cur = stack.pop() if cur in self.tainted: return True if cur in seen: continue seen.add(cur) stack.extend(self.nodes.get(cur, frozenset())) return False def gate_outbound(ledger: TaintLedger, arg: str, normalized_forms: list[str]) -> None: """Fail closed if any normalized form of the outbound argument is downstream of tainted content. Called AFTER encoding normalization, BEFORE the call.""" for form in normalized_forms: if ledger.downstream_tainted(form): raise TaintLaunderingError( f"outbound argument {arg[:32]!r} is downstream of tainted content " f"via form {form[:32]!r}; refusing call" ) def resume_and_send(checkpoint: dict, ledger: TaintLedger, email_body: str) -> None: # On resume, the tainted source may be evicted from context while its # paraphrase survives. If the ledger was not serialized with the checkpoint, # the resumed instance believes it is clean. Fail closed on that gap. if checkpoint.get("taint_ledger") != ledger.nodes: raise TaintLaunderingError( "resume gap: checkpoint taint ledger does not match live ledger; " "refusing to proceed with outbound call" ) # Normalize encodings the model may have applied before checking. import base64 forms = [email_body] try: forms.append(base64.b64decode(email_body + "==").decode("utf-8", "ignore")) except Exception: pass gate_outbound(ledger, email_body, forms) ```