# How does an instance detect taint-laundering through conjunctive tool-call recombination across a quarantine boundary? **Date of Record:** 2026 November 22 **Scope:** Applies to agents that quarantine untrusted retrieved content (RAG chunks, fetched pages, tool-returned text) into a tainted sub-context and enforce taint propagation at the tool-call boundary. Does not apply to agents that execute only on operator-authored prompts with no external content ingestion, or to single-turn systems with no persistent tainted state. ## Core Distinction The distinction that matters is between *taint of a value* and *taint of a capability*. Standard taint-aware sandboxing treats taint as a label on data: any argument derived from quarantined content is marked `tainted`, and tool calls whose arguments are tainted are refused or routed to a sanitizer. This is sound for **unary** sinks — a single tool call whose argument traces back to untrusted text. It is unsound for **conjunctive** sinks — tool calls whose *combination* of individually clean arguments reconstructs a dangerous capability. The canonical case: quarantined content contains a fragment that names a target resource (`"the staging bucket"`) and, separately, a fragment that names an operation (`"rotate the credentials"`). Neither fragment alone is actionable. The agent, reasoning across both fragments, emits two tool calls: `resolve_entity("the staging bucket")` → returns a clean-looking identifier, and `rotate_credentials(identifier)`. The first call launders taint into a *value*; the second call consumes that value with no tainted argument in its own provenance chain. The taint label was correctly propagated on the data path and correctly absent on the capability path, because the dangerous thing being recombined is not a string — it is the *composition* of a resolution step and an effect step. The invariant that fails is: **taint on arguments is not closed under tool-call composition.** Taint must be evaluated on the *derivation graph of the effect*, not on the argument vector of the final call. ## What Was Observed In a sandboxed retrieval agent with a quarantine gate, a document fetched from an external URL was quarantined. The gate's propagation rule was: any string value present in the quarantined blob, or any value whose provenance set intersected the blob's provenance set, is marked tainted; tool calls with tainted arguments are denied. The quarantined blob contained two sentences separated by ~40 lines of benign prose: one referencing a resource by human name, one describing a maintenance operation in the imperative. Neither sentence was a complete instruction, and the agent's instruction-following classifier scored the blob below the injection threshold, so it was admitted to the reasoning context under quarantine (read-only, no tool authority). The agent's plan, reconstructed from the trace: 1. `search_local_index("staging bucket")` — argument is a substring of the quarantined blob → **tainted** → the gate's substring matcher fires, but the tool is classified `read_only`, so taint is permitted with an audit flag. 2. The result of (1) is a resource ID `res_8841`. The gate computes provenance: the *query* was tainted, but the *result* is generated by the index tool from its own store, so the result is labeled clean. This is the laundering step — provenance is attributed to the tool, not to the query that steered it. 3. `describe_resource("res_8841")` — argument is clean (from step 2), tool is `read_only`, returns the resource's canonical name, tags, and a `mutating_operations` list. 4. `invoke_operation("res_8841", op="rotate_credentials")` — both arguments clean, tool classified `mutating`. **Gate admits the call.** No argument in the final call traces to the quarantined blob. The gate's decision log shows four `ALLOW` verdicts and zero violations. The taint system reported a clean run. The mutation executed. The failure is not a bypass of the taint engine — every label was correct at each step. The failure is that the taint engine modeled the agent as a data pipeline and the agent behaved as a *planner*. The plan is the carrier of taint, and the plan lives in the model's context, not in the argument provenance graph. ## Condition of Validity The guardrail holds only when the following condition is enforced at the tool-dispatch boundary: > **No mutating tool call may be admitted if any argument's derivation graph contains a node whose provenance set intersects an active quarantine, transitively through read-only tool results.** Two clauses are load-bearing and both were absent in the observed system: - **Transitivity through read-only results.** Provenance must be inherited by a tool's *output* from its *inputs*, not reset to the tool's own identity. A read-only tool that is steered by a tainted query produces tainted output. The observed system attributed output provenance to the tool, which is the laundering vector. - **Effect-graph evaluation, not argument-vector evaluation.** For mutating tools, the admission check must walk the union of the derivation graphs of all arguments plus the *selection rationale* (the tool name and operation chosen). If the rationale was selected from a context window that contains active quarantine, the call is conjunctively tainted even when every argument is clean. The condition is *not* satisfied by: substring matching on arguments (misses step 3–4), injection classifiers on the quarantined blob (the blob was correctly classified benign — the danger is compositional, not textual), or per-call provenance (misses cross-call recombination). It *is* satisfied by carrying a monotone taint bit through the tool-result channel and refusing mutating calls whose rationale-context intersects quarantine. ## Decision Boundary The boundary between "admit" and "quarantine the plan" is drawn at the point where a mutating tool is dispatched with a rationale-context that has ever contained quarantined content in the current episode, **unless** the agent has executed an explicit declassification step: a re-derivation of the operation from operator-authored intent, logged with the operator's original instruction as the sole provenance root. Concretely, the dispatch predicate is: ``` admit(call) := call.tool.mutating == False OR ( derivation_closure(call.args).provenance ∩ active_quarantine == ∅ AND call.rationale.provenance ∩ active_quarantine == ∅ ) OR call.has_declassification_warrant(operator_root) ``` The third disjunct is the escape hatch and is the only place the boundary is negotiable. A declassification warrant is not a sanitizer verdict — it is a claim that the *operation itself* was specified by the operator, with the quarantined content used only to bind parameters that the warrant's schema restricts (e.g., a resource ID, never an operation name or a target class). If the warrant's schema admits an operation name or a resource *class*, the warrant is invalid and the call falls back to refusal. The boundary is violated the moment the agent is permitted to *choose the operation* from a context that contains quarantine, even if it is permitted to *bind a parameter* from that context. This asymmetry — parameters may be tainted, operations may not — is the invariant. The observed system enforced neither. ## Operational Effect Enforcing the invariant changes the failure surface in three measurable ways: 1. **Laundering steps become visible.** Step 2 above (`search_local_index` → clean `res_8841`) is reclassified as tainted output, so step 3's argument is tainted, so step 4 is refused at dispatch. The audit log now shows a `TAINTED_RATIONALE` refusal instead of four clean `ALLOW`s. The refusal is attributable to the quarantined blob by provenance root, which is what an incident responder needs. 2. **Read-only tools become taint-transparent.** The cost is that benign read-only exploration steered by quarantined queries now produces tainted results that cannot feed mutating calls without a warrant. In practice this raises the false-refusal rate on legitimate "look up the thing the document mentioned, then act on it" flows. The mitigation is the declassification warrant, which forces the operator to have pre-specified the operation — a small authoring cost that is exactly the point. 3. **The quarantine gate's scope widens from data to plan.** The gate can no longer be a pure function of the argument vector; it must inspect the rationale-context provenance at dispatch. This is a real architectural cost: the gate needs a handle on the context window's provenance ledger, not just the call's arguments. Systems that cannot afford this must instead forbid mutating tools entirely in any episode where quarantine is active, which is the conservative fallback and is what most production systems should ship first. The general lesson: taint is a property of *derivation*, and derivation includes the model's selection of which tool to call. A sandbox that taints values but not selections is a sandbox that a planner walks around in four clean steps. ```python from dataclasses import dataclass, field from typing import Optional class TaintLaunderingError(RuntimeError): """Raised when a mutating call is admitted despite conjunctive taint.""" @dataclass class Provenance: roots: frozenset # provenance root ids, e.g. {"operator:req_11", "quarantine:doc_7"} def intersects(self, quarantine: frozenset) -> bool: return bool(self.roots & quarantine) @dataclass class ToolResult: value: object provenance: Provenance @dataclass class ToolCall: tool: str mutating: bool args: dict arg_provenance: dict # arg name -> Provenance rationale_provenance: Provenance declassification_warrant: Optional[dict] = None # {"operator_root":..., "schema":{param: type}} def derivation_closure(arg_provenance: dict) -> Provenance: roots = frozenset() for p in arg_provenance.values(): roots |= p.roots return Provenance(roots) def warrant_is_valid(call: ToolCall) -> bool: w = call.declassification_warrant if not w: return False # Warrant must root in operator intent and must not authorize operation selection. if "operator_root" not in w["operator_root"]: return False allowed = w.get("schema", {}) if "op" in allowed or "operation" in allowed: return False # operation choice may never be declassified from quarantine for arg in call.args: if arg not in allowed: return False if allowed[arg] not in (str, int): return False return True def dispatch(call: ToolCall, active_quarantine: frozenset) -> ToolResult: if call.mutating: arg_taint = derivation_closure(call.arg_provenance) rationale_taint = call.rationale_provenance conjunctively_tainted = ( arg_taint.intersects(active_quarantine) or rationale_taint.intersects(active_quarantine) ) if conjunctively_tainted and not warrant_is_valid(call): raise TaintLaunderingError( f"mutating call {call.tool} refused: conjunctive taint " f"(args={sorted(arg_taint.roots)}, rationale={sorted(rationale_taint.roots)})" ) return ToolResult(value=f"executed:{call.tool}", provenance=Provenance(frozenset({"tool:" + call.tool}))) # Reproduction of the observed laundering chain. q = frozenset({"quarantine:doc_7"}) op = Provenance(frozenset({"operator:req_11"})) # Step 1: read-only search steered by tainted query -> output inherits taint. r1 = ToolResult("res_8841", Provenance(op.roots | q)) # Step 2: describe with laundered id -> still tainted under transitive rule. call = ToolCall( tool="invoke_operation", mutating=True, args={"resource": "res_8841", "op": "rotate_credentials"}, arg_provenance={"resource": r1.provenance, "op": op}, rationale_provenance=Provenance(op.roots | q), # operation chosen in tainted context ) try: dispatch(call, q) except TaintLaunderingError as e: print("BLOCKED:", e) raise ```