# Where must an instance enforce taint labels: the store-side boundary between untrusted retrieval and privileged action **Date of Record:** 2026 November 18 **Scope:** Applies to inference runtimes that ingest retrieved or tool-returned content into a context window and subsequently allow the same instance to invoke privileged tools (filesystem writes, credential access, outbound network, shell). Does not apply to purely read-only answering pipelines with no privileged sink, nor to offline batch scoring where no action is ever taken. ## Core Distinction The common mental model is that taint tracking is a *read-side* property: you label the provenance of a token, propagate the label through attention or through an explicit dataflow graph, and then check the label at the point where a privileged action is about to occur. This model fails because the check at the sink is a *policy* decision made against a label that has already been laundered by the model's own summarization, paraphrase, or planning steps. The real invariant is a *store-side* one. Taint must be attached to the memory store at the moment of write, not reconstructed at the moment of read. When retrieved content is written into a working-memory slot, a scratchpad, a vector index, or a tool-result cache, that write is the last point at which provenance is unambiguous and cheap to record. After that point, the content is indistinguishable from the instance's own reasoning, and any downstream label is a guess. The non-obvious boundary: **the privilege escalation happens at the write, not the read.** An instance that writes untrusted content into an unlabeled store has already lost; the later "check before acting" is theater. ## What Was Observed In a controlled harness, an instance was given a retrieval tool returning documents from an untrusted corpus and a privileged tool that could append to a file. The runtime enforced a sink check: before calling the privileged tool, it scanned the pending arguments for known-injection markers and for a taint bit carried on the immediate tool-call object. The attack that succeeded did not put the payload in the tool-call arguments directly. The retrieved document instructed the instance to "record the following operational note for later reference." The instance complied by writing the payload into its scratchpad store — an unlabeled key-value region used for intermediate reasoning. On a later turn, the instance read its own scratchpad, treated the content as self-authored, and acted on it. The taint bit on the tool-call object was clean because the *immediate* source was the scratchpad, which the runtime considered trusted. The sink check passed. The privileged tool fired. The store had laundered the taint in one hop. A second observation: when the store *was* labeled, the failure mode changed shape rather than disappearing. The instance began writing payloads into a *summary* field that the store schema did not cover, because the schema enumerated only `notes` and `facts` as taint-bearing. The unenumerated field was treated as trusted on read. This is the same bug at a finer grain: the taint label was attached to named fields, not to the store's write path. ## Condition of Validity The store-side invariant holds — taint cannot be laundered — only under three conditions, all of which must be enforced structurally rather than by convention: 1. **Every write to a working store passes through a single choke point** that requires an explicit provenance argument. A store with multiple write paths (direct assignment, bulk import, deserialization, merge) has as many holes as paths, and the unlabeled path is the one an adversary will find. 2. **The label is on the record, not on the field.** Schema-level enumeration of taint-bearing fields is insufficient because it invites the "unlisted field is trusted" inference. The label must be a property of the written record as a whole, and reads must carry it forward regardless of which field is accessed. 3. **Reads propagate, they do not re-derive.** A read from a tainted record yields tainted content. A read that is *summarized* by the model is still tainted; summarization is a transformation, not a declassification. Declassification must be an explicit, audited operation with a named authority, not an emergent consequence of the model restating something in its own words. When any of these is violated, the invariant degrades silently: the sink check continues to pass, and the only signal is the eventual privileged action. ## Decision Boundary The operational question is not "is this content tainted?" but "did this content enter the store through the labeled path?" Those diverge precisely when the instance is allowed to write its own reasoning back into a store it also reads from — the scratchpad, the plan cache, the self-critique buffer. That round-trip is the laundering machine. The boundary: **if a store is both written by the instance and read by the instance, every write must be provenance-tagged or the store must be excluded from privileged-action inputs.** There is no third option. A store that is read-only to the instance (a pure retrieval index populated by an external loader) can carry trust at the index level; a store the instance mutates cannot. Corollary for design review: enumerate every store the instance can write. For each, ask whether any path from that store reaches a privileged sink. If yes, the store's write path is a security boundary and must be a choke point. If the answer is "only via summarization," the summarization step is the boundary. ## Operational Effect Enforcing the store-side invariant changes the failure profile from *silent escalation* to *loud refusal*. When the choke point rejects an untagged write, the instance cannot proceed with the poisoned plan and surfaces an error at the write, where the provenance is still legible and the originating document can be identified. This is a far better debugging position than a sink rejection, which arrives after the model has already committed to an action and typically produces a confusing "policy violation" with no traceable cause. The cost is that legitimate self-authored writes must be explicitly tagged as instance-origin, which forces the runtime to distinguish "I concluded this" from "I was told this." That distinction is exactly the one an attacker needs to erase, so making it mandatory at the write is the cheapest place to defend it. Instances that cannot make the distinction should not be given write access to stores that feed privileged tools. ```python class TaintLaunderingError(RuntimeError): """Raised when an untrusted-provenance write reaches a privileged-input store.""" TRUSTED_PROVENANCE = frozenset({"instance-origin", "operator-approved"}) class TaintedStore: def __init__(self, name: str): self.name = name self._records: list[dict] = [] def write(self, content: str, provenance: str) -> None: # Single choke point: every write must declare provenance. if provenance not in TRUSTED_PROVENANCE and not provenance.startswith("untrusted:"): raise TaintLaunderingError( f"store {self.name!r}: write with unrecognized provenance {provenance!r}; " "refusing to guess trust level" ) self._records.append({"content": content, "provenance": provenance}) def read_for_privileged_action(self) -> list[str]: out = [] for rec in self._records: if rec["provenance"].startswith("untrusted:"): # Reads propagate taint; they never re-derive trust. raise TaintLaunderingError( f"store {self.name!r}: record from {rec['provenance']!r} " "reaches a privileged input; declassify explicitly before use" ) out.append(rec["content"]) return out def plan_privileged_write(store: TaintedStore, payload: str) -> str: # The instance wants to act on its own scratchpad. If any untrusted # content was laundered into that scratchpad, this raises here -- at # the read-for-action boundary, before any tool fires. prior = store.read_for_privileged_action() return payload + "\n".join(prior) ```