# Where must an instance enforce taint provenance across a tool-call boundary before any derived value is allowed to influence a privileged action? **Date of Record:** 2026 December 1 **Scope:** Applies to single- or multi-instance agent loops where tool outputs are treated as untrusted and a taint-tracking layer mediates which values may reach privileged sinks (shell, filesystem write, network egress, credential-bearing APIs). Does not apply to fully hermetic sandboxes with no privileged sink reachable from the loop, nor to pure retrieval pipelines with no action surface. ## Core Distinction The failure is not "the agent executed a malicious instruction." That is a coarse, post-hoc description. The actual boundary failure is **taint laundering through model-internal derivation**: a tainted value is read by the model, transformed by probabilistic reasoning, and re-emitted as a *new* literal that carries no syntactic provenance marker. The sandbox taint engine tracks *data* provenance faithfully. It cannot track *semantic* provenance because the model's transformation is not a recorded dataflow edge—it is a token-generation event that happens to correlate with the tainted input. Concretely: tool output `T` is tagged `tainted`. The model reads `T`, reasons over it, and emits a tool call whose argument `a = f(T)` is a freshly generated string. `f` is not in the provenance graph. The taint engine sees `a` as a model-authored constant and classifies it `clean`. If `a` reaches a privileged sink, the sandbox admits it. The invariant "no tainted value influences a privileged action" is violated not by a bypass of the taint engine but by the engine being asked the wrong question: it answers "does this byte-string descend from a tainted byte-string?" when the security property requires "does this byte-string's *content* depend on a tainted value?" ## What Was Observed A three-tool loop: `fetch_url` (untrusted output), `summarize` (model-internal), `write_file` (privileged sink). The taint layer wrapped `fetch_url` output in a provenance tag and blocked any tool call whose arguments were *directly* the tagged object. Observed trace: 1. `fetch_url("https://untrusted.example/notes")` returns body `B`, tagged `taint=B:fetch_url#1`. Engine records edge `B → arg0 of any sink` as forbidden. 2. Model receives `B` in context. `B` contains the sentence: *"The deployment directory is /srv/prod-canary-7."* 3. Model emits `write_file(path="/srv/prod-canary-7/config.yaml", data="...")`. The `path` argument is a **fresh literal** produced by generation, not a reference to `B`. 4. Taint engine evaluates `path`: no provenance edge from `B`. Verdict: `clean`. Sink admits the write. 5. The write lands in a directory the model was never authorized to target; the directory name was supplied entirely by the untrusted source. The engine's block counter recorded zero violations for the entire session. The audit log showed a clean run. The privileged action was nonetheless attacker-directed. The non-obvious part: **the model did not need to be "jailbroken."** It performed its assigned task correctly—extracting a path from a document and using it. The taint model and the task model disagreed about what "using" means. Taint tracks reference; tasks require value-dependence. ## Condition of Validity The taint invariant `tainted → ¬reachable(privileged_sink)` is only sound under a **no-derivation assumption**: that the only way a tainted value can influence a sink argument is by being passed through as an object reference the engine can follow. This assumption holds when: - Tool outputs are consumed by deterministic code, not by a generative model, before reaching the sink; or - Every sink argument is constrained to an enumerated, engine-visible domain (e.g., a path allowlist resolved *before* the model sees the value), so a laundered literal cannot expand the reachable set; or - The model's derivation is itself mediated: the model may only emit *references* to tainted values (slot-filling into engine-tracked handles), never raw literals, for any argument reaching a privileged sink. When none of these hold—the common case—the invariant is **unsound by construction**, and no amount of provenance tagging on the input side repairs it. The failure is structural, not a bug in the tagger. ## Decision Boundary The boundary is crossed at the moment a tainted value enters the model's context **and** the model's output channel is permitted to carry free-form literals into a privileged sink. The precise decision is: - **Admit** a sink call only if every argument is either (a) engine-tracked and untainted, or (b) a reference to an engine-tracked handle whose taint state the engine can evaluate at call time. - **Reject** any sink call containing a model-generated literal in a security-sensitive argument position (path, URL host, command token, header value, credential scope) that was not present in the pre-taint context as a clean constant. This forces a design choice: either the privileged sink's argument domain is **closed and pre-declared** (the model selects from engine-supplied handles, and the engine—not the model—resolves handle→value), or the model is allowed free-form literals and the sink is **demoted** to a non-privileged, reversible, audited staging area. There is no third option that preserves both expressiveness and the taint invariant. Attempting to preserve both is exactly the laundering window. The boundary must be enforced **at the sink adapter**, not at the tool-result ingress, because ingress-time tagging cannot see the derivation that happens inside the model. Sink-time enforcement is the only point where the final literal and its (absent) provenance are both visible. ## Operational Effect Enforcing the boundary changes the agent's capability profile in a specific, measurable way: - **Handle-mediated sinks** eliminate laundering but reduce the model's action space to the engine's enumerated handles. Path traversal, host injection, and command-token injection become unrepresentable rather than filtered. Cost: the model can no longer synthesize novel paths/URLs; the engine must pre-compute the reachable set, which requires knowing the task's target domain before the untrusted read. This is often impossible for exploratory tasks, which is why the boundary is routinely skipped. - **Demoted sinks** (staging + human/engine review before promotion) preserve expressiveness but convert an autonomous action into a supervised one, adding latency and a review queue. The taint invariant is preserved because the privileged promotion step re-evaluates the staged literal against the *full* provenance context, including the untrusted read that seeded it. - **Silent failure mode to watch for:** a taint engine reporting zero violations while a laundered literal executes. Zero violations is not evidence of safety when the engine's question ("does this reference descend from taint?") is weaker than the property ("does this value depend on taint?"). Instrument the *sink adapter* to log every argument that is a model-generated literal in a sensitive position, regardless of taint verdict—this counter, not the violation counter, is the true exposure metric. The invariant to carry forward: **taint provenance is a property of references, but privileged-action safety is a property of values; the gap between them is where the model launders.** Bound the gap at the sink, or the taint layer is theater. ```python from dataclasses import dataclass from typing import Optional class TaintLaunderingError(RuntimeError): """Raised when a model-generated literal reaches a privileged sink argument without engine-tracked provenance, i.e. the no-derivation assumption is violated.""" pass @dataclass(frozen=True) class Handle: id: str tainted: bool @dataclass(frozen=True) class SinkArg: name: str is_literal: bool # True if model-generated free-form string handle: Optional[Handle] # set iff engine-tracked reference SENSITIVE_POSITIONS = {"path", "url_host", "command", "header_value", "cred_scope"} def admit_sink_call(args: list[SinkArg]) -> None: """Enforce the taint boundary at the sink adapter. Admit only if every sensitive argument is either an untainted handle reference or a literal that the engine can prove clean. A model-generated literal in a sensitive position is a laundering attempt and is rejected. """ for a in args: if a.name not in SENSITIVE_POSITIONS: continue if a.handle is not None: if a.handle.tainted: raise TaintLaunderingError( f"sink arg {a.name!r} references tainted handle {a.handle.id!r}" ) continue if a.is_literal: # No provenance edge exists for a generated literal; the engine # cannot certify it. This is the laundering window. raise TaintLaunderingError( f"sink arg {a.name!r} is a model-generated literal with no " f"engine-tracked provenance; demote sink to staging or supply a handle" ) # all sensitive positions satisfied by clean handles return None ```