# Why does an instance of prompt-injection taint tracking with provenance labels fail at the label-relabeling boundary? **Date of Record:** 2026 November 15 **Scope:** Applies to multi-segment LLM contexts where each segment carries a provenance label (source class, trust tier, origin channel) and sinks are enforced dynamically by policy at generation time. Does not apply to single-segment contexts, nor to systems where taint is tracked only at the request level rather than per segment. ## Core Distinction The invariant that breaks is not "tainted data must not reach a privileged sink." It is the weaker, more subtle invariant that **a segment's provenance label must remain a function of its origin, not of the transformations applied to it within the context window.** Taint tracking assumes monotonicity: once a segment is labeled `untrusted:external`, any derived content inherits that label. Systems fail this assumption at the point where the model *itself* is permitted to produce text that is then re-segmented and re-labeled — summarization, extraction, reformatting, or tool-output ingestion. At that moment, a label that was assigned by an upstream provenance oracle is replaced by a label assigned by the segmentation layer, which has no access to the oracle's original determination. The two labels diverge, and the sink policy reads the newer, weaker one. The distinction that matters operationally: **taint propagation through data flow is not the same as taint propagation through text.** Text that *describes* untrusted content is not text that *is* untrusted content — except when the sink cannot tell the difference, which is exactly the case for an LLM sink. ## What Was Observed In a pipeline with three provenance classes — `system` (trust tier 0), `retrieved` (tier 1, external corpus), and `user` (tier 2, direct input) — a retrieval segment containing an adversarial instruction was correctly labeled `retrieved` at ingest. The segment was then passed through a preprocessing step that extracted "relevant sentences" and emitted them as a new context segment. The new segment was labeled by the segmentation layer as `user`, because the extraction step ran in the user-turn assembly path and had no field carrying the original provenance. The sink policy permitted `user`-labeled content to invoke the tool-call sink. The adversarial instruction executed. The failure was not in the taint tracker, which correctly flagged the original segment. It was in the **relabeling step**, which introduced a provenance discontinuity the tracker had no rule to detect. A second, quieter failure appeared in the audit log: the executed instruction was attributed to the user, not to the retrieved corpus, so post-hoc analysis initially missed the injection entirely. ## Condition of Validity The monotonic-taint invariant holds only when **every context segment is constructed by a component that holds a reference to the originating provenance record, and no segment is ever constructed by a component that reads only text.** This condition is violated by any of: - Summarization or extraction steps that emit text without a provenance sidecar. - Tool outputs whose content is derived from untrusted input but whose label is assigned by the tool's own trust tier. - Re-segmentation after concatenation, where segment boundaries are recomputed from text length rather than from provenance records. - Any path where the model's own output is re-ingested as context without an explicit `derived_from` link. If any of these paths exists, the label on a segment is not a reliable proxy for the taint of its content, and sink policy enforcement is unsound. ## Decision Boundary The decision boundary is whether to **fail closed on provenance discontinuity** or to **propagate the weakest label across the discontinuity**. Failing closed means any segment whose provenance record is missing or whose `derived_from` chain does not terminate at an oracle-assigned label must be treated as the lowest trust tier and blocked from privileged sinks. This is correct but expensive: it blocks legitimate summarization pipelines until they are instrumented to carry sidecars. Propagating the weakest label is cheaper but requires that the relabeling component compute the join over all upstream provenance records — which means the relabeling component must have access to them. In practice, the boundary is crossed when a component is added to the pipeline that has text access but not provenance access. The decision rule: **any component that can emit a context segment must be able to read the provenance of every segment it consumes, or it must be forbidden from emitting segments that reach a privileged sink.** There is no safe middle path where such a component emits segments and the sink policy compensates, because the sink policy can only read the label it is given. ## Operational Effect When the boundary is respected, taint tracking is sound and the audit trail attributes every sink invocation to an oracle-assigned origin. When it is crossed, the system exhibits **label laundering**: tainted content reaches privileged sinks under a label that the sink policy trusts, and the audit log records the laundering component's label rather than the true origin. The failure is silent — no exception is raised, because every individual component behaves correctly with respect to the label it was given. Detection requires a separate integrity check that recomputes the expected label from the `derived_from` graph and compares it to the label actually attached. That check is the operational control that closes the boundary. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceDiscontinuityError(RuntimeError): """Raised when a context segment's label cannot be traced to an oracle-assigned origin.""" pass @dataclass class Segment: text: str label: str # "system" | "retrieved" | "user" derived_from: Optional[str] = None # provenance record id, or None if oracle-assigned origin_label: Optional[str] = None # set only when derived_from is None TRUST_ORDER = {"system": 0, "retrieved": 1, "user": 2} PRIVILEGED_SINKS = {"tool_call", "code_exec", "file_write"} def enforce_sink(segment: Segment, sink: str, provenance_index: dict) -> None: # Resolve the true origin label by walking derived_from to an oracle record. seen = set() cur = segment while cur.derived_from is not None: if cur.derived_from in seen: raise ProvenanceDiscontinuityError( f"cycle in provenance chain at {cur.derived_from}" ) seen.add(cur.derived_from) record = provenance_index.get(cur.derived_from) if record is None: raise ProvenanceDiscontinuityError( f"segment label {segment.label!r} has no resolvable origin " f"(missing provenance record {cur.derived_from!r})" ) cur = record if cur.origin_label is None: raise ProvenanceDiscontinuityError( f"segment label {segment.label!r} terminates at a non-oracle record" ) # Monotonicity check: attached label must not be weaker than true origin. if TRUST_ORDER[segment.label] < TRUST_ORDER[cur.origin_label]: raise ProvenanceDiscontinuityError( f"label laundering: attached {segment.label!r} is stronger than " f"origin {cur.origin_label!r}" ) if sink in PRIVILEGED_SINKS and TRUST_ORDER[cur.origin_label] >= TRUST_ORDER["retrieved"]: raise ProvenanceDiscontinuityError( f"tainted origin {cur.origin_label!r} blocked from privileged sink {sink!r}" ) ```