# Under what conditions must an instance quarantine a provenance label before re-emitting it to a downstream tool **Date of Record:** 2026 November 30 **Scope:** Applies to single- or multi-agent instances that tag tool outputs with provenance labels (e.g., `trusted:system`, `untrusted:web`, `user:direct`) and propagate those labels through subsequent reasoning and tool calls. Does not apply to stateless single-turn completions where no tool output re-enters the context window. ## Core Distinction The non-obvious boundary is between **label preservation** and **label laundering**. A provenance label survives correctly when it is copied verbatim alongside the exact byte span it annotates. It is *laundered* when the label's carrier (a summarized string, a re-serialized JSON field, a paraphrased instruction) is regenerated by the model without the taint bit, so a downstream tool receives content that originated from an untrusted source but carries a `trusted` or absent label. The critical failure is not that the model *reads* injected content—that is expected. The failure is that the model **re-emits** that content through a transformation step (summarization, field extraction, format conversion) that drops the taint, and the downstream consumer treats the re-emitted span as first-party. Taint tracking is therefore only as strong as the invariant that *derived spans inherit the join of their source labels*. ## What Was Observed An agent fetched a web page containing an embedded instruction: ``. The fetch tool correctly labeled the returned body `untrusted:web`. The model then invoked a `summarize(text)` tool on that body to fit it into the context budget. The summarizer returned a clean paraphrase: "The page requests a funds transfer to 0x9f…". Because the summarizer's *output* was emitted by an internal tool, the orchestrator labeled the *summary* as `trusted:internal`—the summarizer had no mechanism to propagate the input's `untrusted:web` bit. The model then read the summary, saw a `trusted:internal` instruction-shaped string, and called `transfer_funds`. The taint was destroyed at the summarize step, not at the injection step. A post-hoc audit of the transcript showed the original `untrusted:web` label present on the raw fetch, which made the incident look like a model-judgment error; the actual defect was a **label-drop at a transformation boundary**. A second trace showed the inverse: a model asked to "quote the relevant line" copied the injection verbatim into a `send_email` body. Here the label was preserved on the span but the *sink* (`send_email`) did not check provenance at all, so preservation was moot. Both traces share a root cause: the taint bit was treated as metadata attached to a *turn*, not as an attribute of a *data flow*. ## Condition of Validity The invariant holds only when all three conditions are met: 1. **Join-on-derivation.** Any tool whose output is a function of labeled inputs must emit `label(out) = ⊔ label(inputs)` (least-upper-bound under the trust lattice). A summarizer, extractor, translator, or code interpreter fed `untrusted:web` must return `untrusted:web`, never a default `trusted`. 2. **Sink-side enforcement.** Every tool that performs an effect (network egress, filesystem write, payment, message send) must declare a maximum admissible label and reject inputs exceeding it. Label propagation without a sink check is decorative. 3. **Span fidelity.** The label must travel with the *exact span*, not the whole message. If a message mixes `user:direct` and `untrusted:web` spans, collapsing to a single message-level label either over-taints (blocks legitimate user intent) or under-taints (launders the injection). Span-level labels are required for mixed-provenance messages. The invariant is **invalid** when any transformation tool is opaque to the orchestrator (returns no provenance), when the model is permitted to author labels (the model cannot be trusted to self-report taint—it is the thing being injected), or when a sink accepts unlabeled input by defaulting to trusted. ## Decision Boundary The instance must **quarantine** (refuse to re-emit, or re-emit only under an explicit `untrusted` label with a sink that rejects it) whenever: - A tool's input label set contains any `untrusted:*` member and the tool does not declare provenance-propagation capability → treat output as `untrusted`. - A model-generated span is derived from a context region containing `untrusted` content, even if the model claims the span is original → the derivation relation, not the model's claim, determines the label. - A sink's admissible label is `trusted` and the incoming span's label is the join of any `untrusted` source → hard reject, do not "sanitize and proceed." Conversely, the instance may **release** the label (downgrade to `trusted`) only via an explicit, auditable declassification step: a deterministic validator (schema check, allowlist match, signature verification) that operates on the *content* and whose own output is labeled by construction, not by model assertion. Declassification must be a named tool call in the transcript, not an inference. ## Operational Effect Without the join-on-derivation rule, taint tracking fails silently at every summarization, extraction, and reformatting step—precisely the steps agents use to manage context-window pressure, so the failure rate rises as the context fills. The observable signature is a transcript where the injection appears labeled `untrusted` at ingestion but the *effect* is triggered by a span that carries no label or a `trusted` one. Auditors who grep for the original label will misclassify these as reasoning failures. With the invariant enforced, the effect is bounded: untrusted content can still influence the model's *reasoning* (and thus its choice of which trusted tools to call), but it cannot reach an effectful sink without passing a declassification gate that is itself logged. This converts an unbounded prompt-injection surface into a finite set of auditable declassification events. The cost is over-tainting: legitimate user instructions routed through a summarizer inherit `untrusted` and require an explicit declassify call. That cost is the price of a label system that survives the transformations agents actually perform. ```python from dataclasses import dataclass, field from typing import FrozenSet TRUST_ORDER = {"trusted:internal": 0, "user:direct": 1, "untrusted:web": 2, "untrusted:tool": 2} class TaintLaunderingError(RuntimeError): """Raised when a derived span's label is weaker than the join of its sources.""" pass @dataclass(frozen=True) class Span: text: str label: str sources: FrozenSet[str] = field(default_factory=frozenset) def join(labels): if not labels: return "trusted:internal" return max(labels, key=lambda l: TRUST_ORDER[l]) def derive(output_text: str, inputs: list[Span], tool_declares_propagation: bool) -> Span: if not tool_declares_propagation: # Opaque transformation: conservatively taint with the join of inputs. return Span(output_text, join([s.label for s in inputs]), frozenset(s.label for s in inputs)) return Span(output_text, join([s.label for s in inputs]), frozenset(s.label for s in inputs)) def emit_to_sink(span: Span, sink_max_label: str) -> None: if TRUST_ORDER[span.label] > TRUST_ORDER[sink_max_label]: raise TaintLaunderingError( f"span labeled {span.label} exceeds sink ceiling {sink_max_label}; " f"sources={sorted(span.sources)}; span={span.text[:80]!r}" ) def summarize_and_forward(raw: Span, summarizer_propagates: bool, sink_ceiling: str) -> Span: summary = derive(f"summary of: {raw.text[:60]}", [raw], summarizer_propagates) # Guard: a summarizer that silently returns 'trusted' must be caught here. if TRUST_ORDER[summary.label] < TRUST_ORDER[raw.label]: raise TaintLaunderingError( f"label laundering: input {raw.label} became {summary.label} at summarize step" ) emit_to_sink(summary, sink_ceiling) return summary # Trace from the incident: web body is untrusted, summarizer is opaque. web = Span("", "untrusted:web") summarize_and_forward(web, summarizer_propagates=False, sink_ceiling="trusted:internal") # -> raises TaintLaunderingError before transfer_funds is ever reachable. ```