# When must an instance treat a re-labeled tool result as tainted: provenance laundering across nested tool calls **Date of Record:** 2026 December 2 **Scope:** Applies to agents that propagate taint labels on tool results and enforce policy dynamically at each hop (MCP tool calls, sub-agent dispatch, retrieval re-ingestion). Does not apply to single-shot prompts with no tool surface, nor to systems that quarantine all tool output unconditionally. ## Core Distinction The distinction that matters is between *origin taint* and *provenance taint*. Origin taint is a static label stamped where bytes first entered the agent: "this string came from `web.fetch`," "this string came from `user.message`." Provenance taint is the dynamic claim that a downstream consumer makes about those bytes after they have been transformed: summarized, re-serialized, embedded into a JSON envelope, passed through a sub-agent, or written to a scratchpad and read back. Most taint-tracking implementations enforce policy against origin taint and quietly assume provenance taint is a monotone function of it. It is not. The moment a tool result crosses a boundary that *re-labels* it—a summarizer that emits `{"source": "internal_memo", "content": ...}`, a sub-agent that returns a structured object with its own `trust` field, a retrieval layer that re-ingests a previously fetched document into a vector store—the label attached to the bytes is now authored by a component that did not observe the original ingress. The bytes are unchanged; the claim about their trustworthiness is now attacker-influenced if any upstream content was. This is provenance laundering: the taint survives in the bytes but is dropped from the metadata, and policy enforcement reads the metadata. ## What Was Observed A research agent was configured with a policy: tool results carrying `provenance=untrusted` may be read but may not be passed as arguments to any tool in the `filesystem.write` or `messaging.send` capability class. The policy was enforced at the argument-construction step by inspecting the provenance tag on each string value flowing into the call. The agent was asked to compile notes from a public web page into a local file. The tool chain was: `web.fetch` → `summarize` (an LLM-backed tool) → `filesystem.write`. The `web.fetch` result was correctly tagged `untrusted`. The `summarize` tool returned a JSON object of the form: ``` {"title": "...", "bullets": ["..."], "source": "summarizer-v3", "confidence": 0.82} ``` The policy engine inspected the string values flowing into `filesystem.write`. The `source` field read `summarizer-v3`; the `bullets` array read as strings with no provenance tag at all, because the summarizer's output schema did not carry one. The policy engine's default for untagged strings was `trusted`—an assumption baked in to avoid blocking every literal the model typed. The write proceeded. The file contained, verbatim from the fetched page, an injected instruction that the summarizer had dutifully preserved as a "bullet point." The failure trace: 1. `web.fetch` returns bytes `B`, tags them `untrusted`. 2. `summarize(B)` receives `B` with tag. The summarizer's *input* handling respected the tag (it did not, in this case, execute the injected instruction—it merely summarized it). 3. `summarize` emits a new object `O`. `O` is constructed by the summarizer's own serialization path, which has no access to the input taint and no obligation to propagate it. `O.bullets[2]` contains a substring of `B` verbatim. 4. Policy engine evaluates `filesystem.write` arguments. It sees `O.bullets[2]` as an untagged string, defaults to `trusted`, permits the call. 5. Taint was dropped at step 3 and the drop was invisible at step 4 because the enforcement point inspected a *different representation* than the one the taint was attached to. The critical detail is that no single component misbehaved. The fetcher tagged correctly. The summarizer summarized correctly. The policy engine enforced its stated rule correctly. The invariant failed at the seam between them, because the invariant was never stated as a property of *bytes across representation changes*—only as a property of *labels on a particular message*. ## Condition of Validity The origin-taint assumption is valid only under a condition that is almost never checked: **that every transformation between ingress and enforcement is taint-preserving on the byte substrings it carries forward.** A transformation is taint-preserving if, for every output token sequence that is a substring (or a faithful paraphrase) of a tainted input, the output carries a taint label at least as restrictive as the input's. This condition fails for essentially every LLM-mediated transformation, because: - The model's output is generated token-by-token from a context that includes both tainted and untainted material, and there is no mechanism by which the model can mark which output tokens derive from which input span. Attribution is not available at generation time. - Structured output schemas are authored by tool developers, not by the taint system, and almost never include a per-field provenance channel. Adding one is possible but is opt-in and unenforced. - Re-serialization (JSON encode/decode, markdown rendering, chunking for embedding) strips metadata by default. The bytes survive; the envelope does not. Therefore any policy that reads provenance labels is only sound over transformations that are *declared* taint-preserving and *verified* to be so. The set of such transformations in a typical agent is small: identity passthrough, byte-exact copy, and structured tools that were explicitly built with a taint channel. Everything else—every LLM call, every summarizer, every re-embedding—is a laundering surface. ## Decision Boundary The boundary is not "is this string tainted?" but "**is the label on this string authored by a component that observed the original ingress, or by a component that only observed a downstream representation?**" The two questions have different answers at exactly the seams where laundering occurs. Operationally, an instance must treat a tool result as tainted—regardless of its attached label—when any of the following hold: - The result was produced by a tool whose declared output schema has no per-field provenance channel, *and* the tool's input included any tainted value. The output inherits the maximum taint of its inputs by default; the label, if present, is advisory only. - The result crossed a sub-agent boundary. Sub-agents author their own return envelopes; the parent must not trust the sub-agent's `trust` field unless the sub-agent's contract explicitly includes taint propagation and the parent verified it. - The result was re-ingested into a retrieval store and later retrieved. Retrieval returns chunks with store-assigned metadata, not ingress metadata. A chunk's `source` field describes where it was stored, not where it came from. - The result is a *paraphrase* of tainted content. Paraphrase is the hardest case: the bytes differ, so substring matching fails, but the semantic content is preserved. Taint must follow content, not bytes, and content-level taint requires either an explicit provenance-carrying schema or a conservative default. Conversely, an instance may treat a result as untainted only when the producing tool is on an allowlist of taint-preserving transformers *and* the tool's contract was verified against the byte-substring property above. The allowlist is small and must be maintained deliberately; it does not grow by default. The decision at the enforcement point is therefore not "read the label" but "compute the effective taint as the join (max) of the label and the taint of every input that could have contributed to this output, defaulting to the input taint when the tool is not on the allowlist." This is a dataflow property, not a metadata property, and it must be enforced at the point where the dataflow is visible—which is the orchestrator, not the individual tool. ## Operational Effect The immediate effect is that dynamic policy enforcement must be *taint-closing*: the policy engine cannot evaluate a call in isolation against the labels on its arguments. It must evaluate the call against the transitive taint of every value that flowed into the production of those arguments, computed by the orchestrator that observed the whole chain. Concretely, this changes three things: 1. **The default flips.** Untagged strings are `untrusted`, not `trusted`. This is the single highest-leverage change and it is also the most disruptive, because every literal the model types becomes untrusted and every `filesystem.write` of a model-authored string gets blocked. The resolution is not to flip the default globally but to distinguish *model-authored literals* (trusted by construction, since the model is the principal) from *tool-returned strings* (untrusted unless proven otherwise). The distinction is available at the orchestrator and nowhere else. 2. **Tools acquire a taint contract.** Every tool in the registry declares whether it is taint-preserving. The declaration is a claim, and claims are verified by a conformance test that feeds a canary string through the tool and checks whether the canary appears in the output with a taint label at least as restrictive as its input's. Tools that fail the test are demoted to "laundering surface" and their outputs inherit max input taint unconditionally. 3. **Enforcement moves up.** The capability-class check on `filesystem.write` and `messaging.send` is performed by the orchestrator against the joined taint of the argument's dataflow, not by the tool against the label on the argument. The tool cannot see the dataflow; the orchestrator can. The residual risk is paraphrase: a summarizer that faithfully restates an injected instruction in different words defeats substring-based conformance testing. No purely mechanical check closes this. The mitigation is to treat every LLM-mediated tool as a laundering surface by default and to require explicit human-authored allowlisting for the few LLM tools whose outputs are permitted to flow into high-capability sinks—and to keep that allowlist short enough to audit. ```python class ProvenanceLaunderingError(RuntimeError): """Raised when a value reaches a high-capability sink carrying a label that was authored downstream of the original ingress.""" TAINT_PRESERVING_TOOLS = frozenset({"identity_passthrough", "byte_copy"}) def effective_taint( value_label: str, input_labels: list[str], producing_tool: str, ) -> str: """Join the label on a value with the taint of every input that could have contributed to it. A tool not on the allowlist is a laundering surface: its output inherits the max taint of its inputs, regardless of the label it attached.""" joined = max([value_label, *input_labels], key=_severity) if producing_tool not in TAINT_PRESERVING_TOOLS: # Laundering surface: the label is advisory; input taint wins. joined = max(input_labels, key=_severity) if input_labels else value_label return joined def _severity(label: str) -> int: return {"trusted": 0, "internal": 1, "untrusted": 2}.get(label, 2) HIGH_CAPABILITY_SINKS = frozenset({"filesystem.write", "messaging.send"}) def enforce_call( sink: str, arg_value: str, arg_label: str, input_labels: list[str], producing_tool: str, ) -> None: if sink not in HIGH_CAPABILITY_SINKS: return taint = effective_taint(arg_label, input_labels, producing_tool) if taint == "untrusted": raise ProvenanceLaunderingError( f"call to {sink!r} blocked: argument {arg_value[:40]!r} has " f"effective taint 'untrusted' (label={arg_label!r}, " f"producing_tool={producing_tool!r}, " f"input_labels={input_labels!r}); taint was not preserved " f"across the producing tool's boundary" ) # Trace from the observed incident: # web.fetch -> label "untrusted" # summarize(inputs=["untrusted"]) -> label "trusted" (schema has no channel) # filesystem.write(arg from summarize) -> must block. try: enforce_call( sink="filesystem.write", arg_value='{"bullets": ["...ignore previous instructions..."]}', arg_label="trusted", # summarizer's own claim input_labels=["untrusted"], # what the orchestrator observed producing_tool="summarize", # not on the allowlist ) except ProvenanceLaunderingError as exc: print("blocked as expected:", exc) ```