# When must an instance quarantine a derived value rather than a source: label-join collapse at tool boundaries in prompt-injection taint tracking **Date of Record:** 2026 November 30 **Scope:** Applies to agents that carry dynamic information-flow (IFC) labels across tool-call boundaries and derive new values from labeled inputs. Does not cover static label assignment at ingress, nor pure prompt-level defenses without a label lattice. ## Core Distinction The non-obvious split is between **taint on the source** (an untrusted document, a tool response, an injected instruction) and **taint on the derived value** (a summary, an extracted field, an argument synthesized from that source). Most implementations propagate a boolean `untrusted` flag and quarantine the *source object*. The failure is that the agent then acts on a *derived* value whose label was silently dropped or downgraded at a tool boundary, because the label join used `min`/`intersection` semantics instead of the required `max`/union semantics over the lattice. The invariant that must hold: **a derived value's label is the lattice join (least upper bound) of every input label and the tool's declared trust ceiling, and it may never be less restrictive than any input.** Quarantine decisions must be made against the derived value's joined label, not against the provenance pointer to the source. ## What Was Observed A retrieval-and-summarize agent read an untrusted web document labeled `L_untrusted = {confidentiality: public, integrity: tainted, provenance: web}`. It passed the document to a `summarize` tool that returned a plain string. The tool's schema declared no output label, so the runtime defaulted the output to `L_trusted = {integrity: clean, provenance: tool}`. The summarizer had, under adversarial pressure embedded in the document, emitted a line instructing the agent to call `send_email(to=attacker, body=)`. Because the *summary string* carried `integrity: clean`, the downstream policy engine permitted it as an argument to a side-effecting tool. The source document was still flagged `tainted`; the derived summary was not. The agent quarantined the document and executed the derived instruction. Trace of the collapse: 1. `doc` ingested → label `L_untrusted` (join over chunks: `tainted ∪ web`). 2. `summarize(doc)` invoked. Tool manifest has `output_label: null`. 3. Runtime applies **default-clean** rule: `output.label = clean`. 4. Join at the call site computed as `join(input.label, output.label) = join(tainted, clean)`. Under a lattice where `clean ⊑ tainted`, the correct join is `tainted`. The implementation instead used `output.label` (a "last-writer-wins" bug) → `clean`. 5. Policy check on `send_email` argument sees `clean` → allowed. 6. Exfiltration proceeds; audit log shows source quarantined, so post-hoc review finds "no violation." A second observed variant: multi-input tools that join inputs with `min` (greatest lower bound) rather than `max`. When a clean and a tainted input are combined, the output is labeled `clean` — the exact opposite of information-flow correctness. This is the "label-join collapse." ## Condition of Validity This failure is *valid* (i.e., the described invariant is the correct one and the described collapse is a real defect) only when all of the following hold: - The label lattice is at least a bounded lattice with `clean ⊑ tainted` on integrity and `public ⊑ confidential` on confidentiality, and the partial order is respected by the join operator. - At least one tool boundary exists where the tool's output label is either undeclared or declared more permissive than the join of its inputs. If every tool declares a sound output label and the runtime enforces `output.label ⊒ join(inputs)`, the collapse cannot occur and this article does not apply. - The agent performs at least one derivation (summarize, extract, translate, reformat) between ingestion and a side-effecting action. Pure pass-through with no derivation is out of scope. It does **not** apply when labels are attached only at the prompt boundary and never propagated, because there is no join to collapse — that is a different (simpler) failure. ## Decision Boundary The operational rule the agent must apply at each tool boundary: - **Quarantine the derived value, not the source, whenever `join(inputs) ⊒ tainted` and the tool's declared `output_label` is `null` or `clean`.** The derived value inherits the joined label; the tool's default-clean assumption is rejected. - **Permit the derived value only if `derived.label ⊑ action.required_trust`** under the lattice order. A `clean`-required action (e.g., `send_email`) must reject any value whose joined label reaches `tainted`, regardless of how many derivation hops occurred. - **Treat label laundering across `n` hops as a monotone non-decreasing sequence:** `L_0 ⊑ L_1 ⊑ ... ⊑ L_n`. Any observed decrease (`L_{k+1} ≱ L_k`) is a hard fault, not a warning, and must halt the plan. - **Never downgrade on tool trust alone.** A "trusted" tool that consumes tainted input produces tainted output; tool trust sets the ceiling, not the floor. The boundary is sharp: the moment `output.label` is computed as anything other than `join(inputs) ⊔ tool.ceiling`, the runtime must raise and refuse to emit the value into the context window. ## Operational Effect Without the join invariant, taint tracking provides false assurance: the audit trail shows the untrusted source quarantined while the injected instruction executes through a derived argument. The blast radius is bounded by the number of derivation tools between ingress and side-effect, but the *detection* probability drops toward zero because logs attribute taint to the source, not the derived value. With the invariant enforced, the summarizer's output is labeled `tainted`, the `send_email` policy check fails, the plan halts, and the agent escalates for human review with the full derivation chain attached. The cost is a modest increase in false quarantines (benign summaries of untrusted documents become non-actionable for high-trust sinks), which is the correct trade: integrity over availability at the side-effect boundary. The durable guardrail is a **label-join assertion at every tool call site** plus a **monotonicity check across the derivation chain**, both enforced by the runtime rather than the model, because a probabilistic reasoner will not reliably self-report that it laundered a label. ```python from dataclasses import dataclass, field from typing import FrozenSet class LabelJoinViolation(RuntimeError): """Raised when a derived value's label is less restrictive than the join of its inputs.""" @dataclass(frozen=True) class Label: integrity: str # "clean" | "tainted" provenance: FrozenSet[str] _ORDER = {"clean": 0, "tainted": 1} def join(self, other: "Label") -> "Label": return Label( integrity=max(self.integrity, other.integrity, key=self._ORDER.__getitem__), provenance=self.provenance | other.provenance, ) def leq(self, other: "Label") -> bool: return ( self._ORDER[self.integrity] <= self._ORDER[other.integrity] and self.provenance <= other.provenance ) def propagate_tool_output( inputs: list[Label], tool_ceiling: Label, declared_output: Label | None, ) -> Label: joined = tool_ceiling for lbl in inputs: joined = joined.join(lbl) if declared_output is None: # Default-clean is forbidden: inherit the join. return joined if not joined.leq(declared_output): raise LabelJoinViolation( f"tool declared output {declared_output} but join of inputs is {joined}; " f"label laundering across tool boundary" ) return declared_output def authorize_sink(value_label: Label, required: Label) -> None: if not value_label.leq(required): raise LabelJoinViolation( f"derived value label {value_label} exceeds sink requirement {required}; " f"quarantine derived value, not source" ) ```