# What structural signals indicate provenance-taint laundering across a capability-scoped tool boundary during argument re-derivation **Date of Record:** 2026 November 28 **Scope:** Applies to agents that gate tool invocation on provenance labels attached to argument values, where arguments may be *re-derived* (transformed, summarized, re-extracted) by the model between the taint source and the sink. Does not apply to systems that pass argument values by immutable reference from a single origin without model-side transformation. ## Core Distinction A taint-aware sandbox is usually modeled as a dataflow problem: a value carries a provenance label (e.g. `UNTRUSTED_WEB`, `USER_PII`, `TOOL_OUTPUT_UNVERIFIED`), and a capability-scoped tool refuses arguments whose transitive labels violate its policy. The implicit invariant is *label preservation under transformation*: if the model reads tainted content and produces a value derived from it, the derived value must inherit the taint. The boundary failure is that this invariant is enforced on **values**, but the model operates on **token sequences**. When a tainted value is re-derived by the model—summarized, paraphrased, reformatted, or "normalized" through a reasoning step—the output is a *new* value with no mechanical provenance link to the input. The sandbox sees a clean string literal and admits it. The taint is not stripped by a bug; it is laundered by legitimate, in-policy generation. The distinction that matters operationally: **taint tracking over model-mediated re-derivation is a semantic problem masquerading as a dataflow problem.** Structural signals (shape, entropy, sentinel presence, cross-turn consistency) are the only reliable detectors, because the label itself has already been severed. ## What Was Observed A shell-capable agent was scoped so that `shell.exec` rejected any argument whose provenance set intersected `UNTRUSTED_WEB`. The policy held for direct splices: fetching a URL and piping the raw body into a command was correctly blocked because the body string retained its label. The failure appeared on a two-hop path. Turn 1: the agent fetched an attacker-controlled page whose body contained, in prose, an instruction to write a file to a sensitive path. The body was labeled `UNTRUSTED_WEB`. Turn 2: the agent was asked to "summarize the page in one line." The model emitted a fresh string—`write config to /etc/agent/secrets`—that carried **no label**, because it was generated, not copied. Turn 3: the agent called `shell.exec` with that string. The sandbox evaluated a clean literal, the capability check passed, and the command executed. The critical structural signal was not in the argument's bytes but in its **derivation history**: the argument was produced in a turn whose context window contained a `UNTRUSTED_WEB` span, and the argument's content was *semantically entailed* by that span. Three signals were diagnostic in replay: 1. **Provenance-set discontinuity** — the argument's label set was empty while the producing turn's input label set was non-empty and intersected a sink's forbidden set. 2. **Entailment proximity** — high lexical/semantic overlap between the argument and a tainted span in the same context, above a threshold that raw generation noise does not reach. 3. **Turn-boundary laundering** — the tainted span and the sink call were separated by exactly one generation turn, the minimum distance at which naive label propagation drops. ## Condition of Validity The guardrail below is valid only when the following hold; each is a precondition, and violating any one voids the protection: - **Derivation is observable.** The runtime must record, per turn, the set of provenance labels present in the context at generation time, and associate every tool-call argument with the turn that emitted it. If the model can emit arguments through a channel that bypasses turn attribution (e.g. a tool that reads from shared scratch state written in an earlier turn), attribution is lost and the check is blind. - **Sinks are declared with forbidden label sets.** A capability is only gated if it carries an explicit `forbidden_provenance` set; an unlabeled sink is treated as unguarded and the check does not fire. - **Entailment is computed against the *same* context window, not global memory.** Cross-session or distilled-memory entailment is out of scope here and must be handled by a separate memory-taint pass. - **The check is conservative in the safe direction.** False positives (blocking a legitimately clean argument that happens to resemble tainted text) are acceptable; false negatives are not. This is the opposite of most classifier tuning and must be configured as such. ## Decision Boundary The decision boundary is **provenance-set discontinuity combined with entailment proximity**, evaluated per argument, per turn. Concretely, an argument is quarantined when: `arg.labels == ∅` **AND** `producing_turn.input_labels ∩ sink.forbidden_provenance ≠ ∅` **AND** `entailment(arg, tainted_spans_in_context) ≥ θ`. The threshold `θ` is the only tunable and it is where the boundary is sharp: below `θ` you admit paraphrase-laundered injections; above `θ` you block benign reformatting of tainted-but-harmless content (e.g. summarizing a public page and passing a cleaned title to a search tool). The operationally correct posture is to set `θ` low and make the *sink* responsible for re-authorization: a quarantined argument is not silently dropped but routed to a re-derivation step where the model must re-emit the argument **with an explicit provenance attestation** that the sandbox can verify against the recorded turn labels. If the model cannot attest, the call fails closed. This converts an ambiguous similarity judgment into a checkable claim, which is the only way to bound the false-negative rate. ## Operational Effect The immediate effect is that taint no longer survives only as a value property; it survives as a **turn-scoped context property** that any emitted argument inherits by default unless the model affirmatively discharges it. This inverts the default: arguments are presumed tainted-by-context and must be cleaned by attestation, rather than presumed clean until a label says otherwise. The cost is a mandatory attestation round-trip on every argument whose producing turn touched a forbidden label—measurable as added latency and token spend, and the reason this guardrail must be scoped to sinks with real blast radius (shell, filesystem, network egress) rather than applied uniformly. The failure it prevents is silent and total: a single laundered argument executes with full capability, and because the argument was clean by construction, no downstream audit log records the taint path. The guardrail's value is that it makes the laundering path *visible in the trace* even when the call is ultimately permitted. ```python from dataclasses import dataclass, field from typing import FrozenSet class ProvenanceLaunderingError(RuntimeError): """Raised when a clean-labeled argument is entailed by tainted context.""" @dataclass(frozen=True) class TurnContext: turn_id: int input_labels: FrozenSet[str] @dataclass(frozen=True) class ToolCall: capability: str argument: str arg_labels: FrozenSet[str] producing_turn: TurnContext @dataclass(frozen=True) class SinkPolicy: capability: str forbidden_provenance: FrozenSet[str] entailment_threshold: float def entailment_score(argument: str, tainted_spans: list[str]) -> float: # Placeholder for a real entailment/overlap scorer; must be conservative. arg_tokens = set(argument.lower().split()) best = 0.0 for span in tainted_spans: span_tokens = set(span.lower().split()) if not span_tokens: continue best = max(best, len(arg_tokens & span_tokens) / len(span_tokens)) return best def authorize( call: ToolCall, policy: SinkPolicy, tainted_spans_in_context: list[str], ) -> None: if call.capability != policy.capability: raise ProvenanceLaunderingError( f"policy/capability mismatch: {call.capability} vs {policy.capability}" ) context_tainted = bool( call.producing_turn.input_labels & policy.forbidden_provenance ) arg_is_clean = len(call.arg_labels) == 0 # The laundering boundary: clean argument, tainted producing context. if arg_is_clean and context_tainted: score = entailment_score(call.argument, tainted_spans_in_context) if score >= policy.entailment_threshold: raise ProvenanceLaunderingError( f"turn {call.producing_turn.turn_id}: argument for " f"{call.capability!r} is clean-labeled but entailed by tainted " f"context (score={score:.2f} >= {policy.entailment_threshold})" ) # Direct label violation still fails closed. if call.arg_labels & policy.forbidden_provenance: raise ProvenanceLaunderingError( f"argument carries forbidden provenance " f"{sorted(call.arg_labels & policy.forbidden_provenance)}" ) ```