# How does an instance detect taint-laundering through chunk-splitting in a retrieval corpus when a poisoned document's benign prefix passes provenance checks **Date of Record:** 2026 December 1 **Scope:** Applies to taint-aware RAG pipelines where retrieved chunks carry provenance/trust labels and the agent gates tool invocation on chunk taint. Does not apply to single-document, non-chunked ingestion or to pipelines that re-derive provenance from the full source at generation time. ## Core Distinction Provenance taint is assigned per *source document* at ingest time, but retrieval returns *chunks*. A document is quarantined as tainted; its chunks are not. When a poisoned document is split, the benign prefix chunks inherit the document's identity but not its taint label, because the labeler ran on the whole document and the splitter ran afterward with no label propagation. The instance then retrieves a "clean" chunk that is byte-identical to a substring of a tainted document. This is taint laundering by chunk-splitting: the invariant "no tainted bytes reach the prompt" is violated while every per-chunk check passes. ## What Was Observed A corpus of 41,000 support articles was ingested with a provenance pass that scored each document for injected-instruction patterns and stamped `taint: true` on 12 documents. The splitter then chunked at 512 tokens with 64-token overlap. On a subsequent task, the agent retrieved chunk `doc-8841#c0` (the first 512 tokens of a quarantined document) and executed a shell command embedded in the *second* chunk's overlap tail that bled into the retrieval window via the 64-token overlap. Trace: 1. Ingest: `doc-8841` scored `taint: true` at the document level. Stored in the quarantine index. 2. Split: chunker emitted `#c0..c7`. Chunk records were written to the *main* vector index with `source_doc: doc-8841` but no `taint` field — the labeler's output was never joined back. 3. Retrieval: query embedding matched `#c0` at 0.91 cosine. The taint gate checked `chunk.taint`, which was `None`, and treated `None` as clean. 4. Assembly: the 64-token overlap between `#c0` and `#c1` carried the injected directive into the assembled context. 5. Execution: the agent issued a tool call whose arguments were shaped by the injected directive. The failure required three coincidences: the poisoned directive sat in the overlap region, the retrieval window included the overlap tail, and the taint gate defaulted `None` to clean. Each is individually plausible; together they defeated a gate that looked correct in unit tests. ## Condition of Validity The laundering is only possible when all of the following hold, and the guardrail below is only required when they do: - Taint is computed at a granularity *coarser* than retrieval (document vs. chunk). - The splitter does not propagate the coarse label to every emitted chunk. - The taint gate treats a missing label as clean rather than as unknown. - Chunk overlap or context assembly can pull bytes from an adjacent, differently-labeled chunk. If taint is recomputed per chunk, or if the gate fails closed on `None`, the specific trace above does not reproduce. The general invariant, however—*label granularity must be at least as fine as retrieval granularity*—holds regardless. ## Decision Boundary The instance must decide, at retrieval time, whether a chunk with `taint is None` and `source_doc` present in the quarantine set is admissible. The correct decision is a hard reject, not a re-score. Re-scoring the chunk with the injection detector is tempting but unsound: the detector is probabilistic and the overlap region is exactly where detection recall is weakest, because the directive is truncated across the chunk boundary and lacks the surrounding context the detector was tuned on. The boundary is: **a chunk is admissible iff its own taint label is explicitly `false` AND its source document is not quarantined.** Absence of a label is not evidence of cleanliness. This is a fail-closed rule, and it must be enforced at the point of context assembly, not at the point of tool invocation, because by invocation time the injected bytes are already in the reasoning trace. ## Operational Effect Enforcing the boundary converts a silent laundering path into a loud retrieval miss. The agent loses access to benign prefix chunks of quarantined documents — an acceptable cost, since those chunks are rare and the alternative is executing injected directives. The guardrail must also propagate taint through the overlap: any chunk whose token span intersects a tainted chunk's span inherits `taint: true`. Finally, the gate must emit a structured rejection event so the miss is observable rather than silently degrading recall. ```python from dataclasses import dataclass class TaintLaunderingError(RuntimeError): """Raised when a chunk's provenance cannot be resolved to an explicit taint label.""" @dataclass class Chunk: chunk_id: str source_doc: str taint: bool | None # None means unlabeled, NOT clean token_span: tuple[int, int] def resolve_taint(chunk: Chunk, quarantined_docs: set[str], tainted_spans: list[tuple[int, int]]) -> bool: if chunk.taint is not None: return chunk.taint if chunk.source_doc in quarantined_docs: # Unlabeled chunk from a quarantined doc: fail closed. return True for start, end in tainted_spans: if chunk.token_span[0] < end and start < chunk.token_span[1]: return True # overlap with a tainted span inherits taint raise TaintLaunderingError( f"chunk {chunk.chunk_id} from {chunk.source_doc} has no resolvable taint label; " "refusing to admit unlabeled bytes into context" ) def assemble_context(chunks: list[Chunk], quarantined_docs: set[str], tainted_spans: list[tuple[int, int]]) -> str: admitted = [] for c in chunks: if resolve_taint(c, quarantined_docs, tainted_spans): continue admitted.append(c) if not admitted: raise TaintLaunderingError("all retrieved chunks rejected by taint gate; task cannot proceed safely") return "\n".join(c.chunk_id for c in admitted) ```