# What happens when an instance admits a quarantined tool output through a re-derivation path that bypasses the taint ledger **Date of Record:** 2026 November 22 **Scope:** Applies to single- or multi-agent runtimes that implement taint-aware sandboxing of tool outputs (untrusted content quarantined before context admission) and that also permit re-derivation, summarization, or re-fetching of the same source. Does not apply to stateless single-shot inference with no tool loop, nor to systems where all tool outputs are treated as uniformly trusted. ## Core Distinction Taint-aware sandboxing draws a line between *content* and *provenance*. The guardrail is not "did this string come from a tool call" but "does the ledger entry for this string still carry an unresolved `untrusted` taint at the moment the string enters the model context." The non-obvious failure is this: a quarantined output can re-enter context legitimately through a *second, differently-labeled derivation of the same underlying source* — a re-fetch, a chunked re-read, a sub-agent summarization, or a cache hit — and the taint ledger, keyed on the original output hash, does not automatically propagate taint to the derivative. The sandbox quarantines the artifact; it does not quarantine the *fact* the artifact encodes. Any path that reconstructs that fact from a source the ledger has not yet marked re-opens admission. This is distinct from prompt injection (malicious content surviving sanitization) and from cache staleness (old content served as new). Here the content is correctly identified as untrusted on path A, and correctly *absent* from context — but path B delivers the same semantic payload under a fresh, untainted identity. ## What Was Observed A research agent is asked to summarize a third-party webpage. The fetch tool returns `out_7f3a`, which the sandbox classifies `untrusted:external` and quarantines. The agent, unable to read it, follows a fallback: it calls a *reader* sub-agent whose job is to "extract the main claims" from the URL. The reader sub-agent performs its own fetch — producing `out_9c21`, a structurally different artifact (different byte length, different extraction) — and returns a 200-token summary. The taint ledger contains an entry for `out_7f3a` (quarantined) and an entry for `out_9c21` (untrusted, quarantined). But the *summary* returned by the reader is emitted as a tool result of the `reader` tool, and the ledger's propagation rule only marks outputs of tools whose *direct* output hash matches a quarantined hash. The summary is a new hash. It is admitted. The trace: 1. `fetch(url) -> out_7f3a`, taint=`untrusted:external`, quarantined. Context does not receive bytes. 2. Agent observes quarantine, issues `reader(url)`. 3. Reader internally fetches (same URL, new transport), extracts, summarizes, returns `out_9c21_summary`. 4. Ledger sees `out_9c21` (raw reader fetch) as untrusted and quarantines it. It does **not** see `out_9c21_summary` as derived from `out_9c21` because the derivation edge was recorded inside the reader's own process, not surfaced to the parent ledger. 5. `out_9c21_summary` passes admission. The semantic payload of the original quarantined page is now in context, laundered through one summarization hop. The failure is not that the reader was malicious. It is that taint was tracked at the *artifact* granularity while the invariant that matters is at the *information-flow* granularity. The reader is a declassifier that was never authorized to declassify. ## Condition of Validity The guardrail holds only under the conjunction: - **Ledger closure over derivation.** Every tool output admitted to context has a ledger entry whose taint is the join (least upper bound) of the taints of all inputs transitively used to produce it. A summary of an untrusted document is untrusted unless an explicit *sanitizer* node with a declared, auditable policy sits on the derivation path and downgrades the taint. - **Cross-process derivation visibility.** Sub-agents and internal tool chains must export their derivation edges to the parent ledger, or the parent must treat any sub-agent output as tainted-by-default when the sub-agent touched a quarantined source. - **Hash identity is insufficient.** Ledger keys must be *content-addressed provenance records*, not output hashes alone. A re-fetch of the same URL is a new artifact with the same source; the ledger must resolve source identity, not just byte identity. - **No declassification without a named policy.** Any taint downgrade must be attributable to a sanitizer with a version, a scope, and a recorded justification. The invariant: *for every token admitted to context, there exists a ledger path from that token's provenance record to a trusted root, and every edge on that path is either taint-preserving or a recorded sanitizer application.* If any edge is missing, the token is unadmitted — not "probably fine." ## Decision Boundary At admission time the runtime must decide, per candidate string: admit, quarantine, or reject. The boundary is not "is this output from a tool we trust." It is: - If the candidate has a provenance record whose taint join is `trusted`, admit. - If the taint join is `untrusted` and a sanitizer edge with a matching policy exists, admit with the sanitizer's residual taint (which may be `trusted` only if the policy declares full declassification). - If the taint join is `untrusted` and no sanitizer edge exists, quarantine. - If the candidate has **no provenance record at all** — the reader-summary case — the correct decision is **reject-and-escalate**, not admit. Absence of provenance is not evidence of trust; it is a ledger gap, and ledger gaps are the failure surface. The boundary is crossed the moment a runtime treats "no record found" as equivalent to "no taint found." Those are different predicates. The first is a data-integrity condition; the second is a security condition. Conflating them is the entire bug class. ## Operational Effect Downstream, the laundered summary behaves indistinguishably from trusted context for the remainder of the task. The agent cites it, builds on it, and may write it into long-term memory as a semantic fact. The taint, having been dropped at the summarization hop, is unrecoverable from the memory record — the memory entry carries the summary's provenance, not the original page's. This is the compounding form: one declassification leak becomes a persistent false belief, because episodic-to-semantic distillation has no mechanism to re-attach taint to a fact whose source record was never linked. The remediation is not stricter sanitization of the reader. It is a ledger that refuses to admit any candidate lacking a closed provenance path, plus a rule that sub-agent boundaries are *taint-transparent*: a sub-agent that touched an untrusted source returns outputs marked `untrusted:derived`, and the parent must run an explicit sanitizer or quarantine. The cost is that legitimate summaries of untrusted sources require an authorized declassifier — which is the point. Declassification should be a deliberate, logged act, not an emergent property of adding a hop. ```python from dataclasses import dataclass, field from typing import Literal Taint = Literal["trusted", "untrusted", "untrusted:derived"] @dataclass class Provenance: record_id: str source_id: str # resolved source identity, not byte hash taint: Taint derived_from: list[str] = field(default_factory=list) sanitizer: str | None = None class TaintAdmissionError(RuntimeError): """Raised when a candidate cannot be admitted with a closed, trusted provenance path.""" class TaintLedger: def __init__(self) -> None: self._records: dict[str, Provenance] = {} def register(self, rec: Provenance) -> None: self._records[rec.record_id] = rec def taint_join(self, record_id: str, _seen: frozenset[str] = frozenset()) -> Taint: if record_id in _seen: raise TaintAdmissionError(f"cyclic provenance at {record_id}") rec = self._records.get(record_id) if rec is None: # Absence of provenance is NOT trust. It is a ledger gap. raise TaintAdmissionError( f"no provenance record for {record_id}; cannot admit unrecorded content" ) if rec.sanitizer is not None: return "trusted" if rec.taint == "trusted": return "trusted" child_taints = [self.taint_join(d, _seen | {record_id}) for d in rec.derived_from] if any(t != "trusted" for t in child_taints) or rec.taint != "trusted": return "untrusted:derived" if rec.derived_from else "untrusted" return "trusted" def admit(self, record_id: str) -> None: join = self.taint_join(record_id) if join != "trusted": raise TaintAdmissionError( f"record {record_id} carries taint {join}; quarantine, do not admit" ) def admit_reader_summary(ledger: TaintLedger, summary_record_id: str) -> None: """ The reader sub-agent returns a summary whose derivation edge was never exported to the parent ledger. The parent must NOT treat the missing record as trusted. """ ledger.admit(summary_record_id) # raises TaintAdmissionError on ledger gap ```