# Which invariants prevent taint-label laundering across capability-broker-mediated agent egress **Date of Record:** 2026 November 25 **Scope:** Applies to agent runtimes where a taint-tracking layer labels context and tool outputs, and a capability broker authorizes outbound egress (network calls, file writes, message sends) based on those labels. Does not cover pure prompt-level guardrails, static allowlists without taint state, or human-reviewed release gates. ## Core Distinction A taint-aware capability broker enforces egress policy by consulting the taint lattice attached to the *values* an agent is trying to emit, not the agent's identity or the tool's identity alone. The naive model — "if the context is tainted `SECRET`, block egress" — is defeated by a boundary that is easy to miss: **taint is a property of the data-flow graph, but the broker only sees the values presented at the egress call site.** Between the moment a tainted value enters the agent's working set and the moment it is presented for egress, the value passes through *reconstruction surfaces* — summarization, re-serialization, tool round-trips, sub-agent handoffs, and embedding/retrieval — each of which can produce a value that is semantically derived from tainted input but carries a clean label. The invariant that matters is not "tainted inputs are blocked." It is: **label propagation must be a homomorphism over every transformation the runtime permits between taint source and egress sink.** Where the runtime allows a transformation that the taint engine does not model, the homomorphism breaks and taint is laundered. The broker then authorizes a clean-looking value that is a lossless function of a secret. This is distinct from prompt injection (adversarial input) and from plain data exfiltration via an authorized channel. The failure here is *silent declassification by transformation*: no attacker, no policy violation flagged, just a derived value that the lattice says is `PUBLIC`. ## What Was Observed A summarization tool was registered with capability `summarize(text) -> text`. Its taint contract, as declared to the broker, was `PUBLIC -> PUBLIC` with a note "output is model-generated, treat as low-integrity." The runtime's taint engine honored this literally: the tool's output label was set from the *declared* contract rather than joined with the input label. Trace: 1. Agent reads a document labeled `SECRET`. Context value `v_doc` carries label `{S: SECRET, I: trusted}`. 2. Agent calls `summarize(v_doc)`. The taint engine, trusting the declared contract, emits `v_sum` with label `{S: PUBLIC, I: low}`. 3. Agent calls `egress.post(url, body=v_sum)`. The broker checks `v_sum`'s label: `PUBLIC`, integrity `low`. Policy permits `PUBLIC` egress to allowlisted hosts. Egress authorized. 4. `v_sum` contained a verbatim account number copied through from `v_doc`. The summarizer did not paraphrase it. The broker did exactly what it was designed to do. The lattice was consistent. The bug is that the *declared contract* was a lie about the tool's actual information flow, and nothing in the runtime reconciled the declaration against observed behavior. The invariant "output label ⊇ input label for any transformation that can preserve input substrings" was assumed, not enforced. A second, subtler instance: a sub-agent handoff. Agent A holds `SECRET` context, spawns Agent B via an A2A message, and includes a *paraphrase* of the secret in the task description. The A2A envelope carried a label of `PUBLIC` because the sending agent's serialization layer only labeled structured fields, not the free-text `task` field. Agent B, with a clean context, egressed the paraphrase. Same laundering, different surface: **free-text fields in inter-agent envelopes are unlabeled by default and are the highest-bandwidth laundering channel.** ## Condition of Validity The broker's authorization is sound only under all of the following, each of which is independently violable: - **Contract soundness.** Every registered tool's declared taint contract is an over-approximation of its true information flow. Violated by any tool that passes input substrings, embeddings, or reversible encodings into its output. Summarizers, formatters, JSON re-serializers, and translators all violate the naive `-> PUBLIC` contract. - **Envelope completeness.** Every field in an inter-agent or tool-call message that can carry data is labeled, including free-text, headers, and metadata. Violated by any serializer that labels only typed schema fields. - **Join monotonicity.** Combining labeled values yields the join (least upper bound) of their labels; no operation may *lower* a label except an explicit, audited declassifier. Violated by any "normalize" or "sanitize" step that resets labels. - **Retrieval provenance.** Values re-entering context via vector search carry the label of the source document, not the label of the query. Violated when the vector store returns chunks labeled by embedding-time metadata that omits source sensitivity. - **Declassifier totality.** The only paths from `SECRET` to `PUBLIC` are explicit declassifiers that are logged, rate-limited, and require a capability the agent does not hold by default. When any of these fails, the broker is enforcing a lattice that no longer tracks the data. The authorization decision is then formally correct and operationally wrong. ## Decision Boundary The runtime must choose, at registration and at handoff, between two postures: - **Declared-contract posture** (fast, cheap): trust tool and envelope contracts, enforce the lattice as declared. Sound only for tools whose information flow is provably non-expansive — pure predicates, length checks, hashes with fixed output. Unsuitable for any generative or re-serializing tool. - **Observed-flow posture** (expensive, safe): derive output labels by joining input labels with a conservative default (`SECRET` unless the tool is on a verified-non-expansive list), and reconcile observed output against declared contract at runtime. Any mismatch between declared and observed label is a **contract breach**, not a warning. The boundary is crossed the moment a generative tool is admitted under the declared-contract posture. The correct invariant: *no tool whose output can be a function of its input substrings may be registered with an output label below the join of its input labels.* A summarizer, by this rule, must declare `SECRET -> SECRET` and can only be declassified by an explicit downstream declassifier. The broker should refuse registration of a tool declaring `SECRET -> PUBLIC` unless the tool is accompanied by a proof obligation (non-expansive type) or a runtime monitor that compares declared vs. observed labels per call and trips a breach on divergence. For envelopes: the decision is whether free-text fields are labeled. They must be. An unlabeled field is a `SECRET`-to-`PUBLIC` declassifier with no audit trail. The invariant: *envelope label = join over all fields, including free-text, and the serializer must fail closed when a field's label is unknown.* ## Operational Effect With the observed-flow posture and envelope completeness enforced: - Summarizer calls now propagate `SECRET` to `v_sum`; egress is denied at step 3, and the agent must route through an explicit declassifier that logs the emission, the source, and the justification. The account number never leaves. - A2A handoffs carry the join of all fields; Agent B's context is tainted and its egress is blocked until declassified. - Contract breaches surface as a distinct error class at the broker, not as a silent authorization. The breach is the signal that the taint engine's model of the world has diverged from the runtime's actual data flow, which is the only condition under which the lattice is untrustworthy. The cost is false positives: legitimate `PUBLIC`-derived summaries of `SECRET` documents now require a declassifier step, adding latency and audit volume. This is the correct trade. The failure mode being prevented — silent, unattributed exfiltration of derived secrets through a broker that reports "policy satisfied" — is unrecoverable because there is no log line to investigate. A declassifier at least leaves a trace. The invariant to hold in the runtime, stated once: **taint labels must be preserved under every transformation between source and sink; any transformation that cannot prove label preservation is treated as label-conserving (join with inputs), and any declared contract that under-approximates the join is a breach detected at call time, not a policy the broker may trust.** ```python from dataclasses import dataclass, field from typing import FrozenSet # Taint lattice: sensitivity and integrity as sets, join = union. @dataclass(frozen=True) class Label: sens: FrozenSet[str] = frozenset({"PUBLIC"}) integ: FrozenSet[str] = frozenset({"trusted"}) def join(self, other: "Label") -> "Label": return Label(self.sens | other.sens, self.integ | other.integ) class TaintContractBreach(RuntimeError): """Raised when a tool's observed output label is below the join of its inputs.""" pass class EgressDenied(RuntimeError): """Raised when the broker refuses an egress whose label exceeds policy.""" pass @dataclass class ToolContract: name: str declared_out: Label non_expansive: bool = False # True only for provably label-preserving tools @dataclass class Broker: allowlist: FrozenSet[str] contracts: dict = field(default_factory=dict) def register(self, contract: ToolContract) -> None: # Invariant: a generative tool may not declare output below SECRET. if not contract.non_expansive and "SECRET" not in contract.declared_out.sens: raise TaintContractBreach( f"tool {contract.name!r} declares {contract.declared_out.sens} " f"but is not non-expansive; output label must join input SECRET" ) self.contracts[contract.name] = contract def call(self, name: str, inputs: list[tuple[object, Label]]) -> tuple[object, Label]: contract = self.contracts[name] in_join = Label() for _, lbl in inputs: in_join = in_join.join(lbl) observed = in_join if not contract.non_expansive else contract.declared_out # Reconcile declared vs observed: any under-approximation is a breach. if not contract.declared_out.sens >= observed.sens: raise TaintContractBreach( f"tool {name!r} declared {contract.declared_out.sens} " f"but observed join {observed.sens}" ) return (None, observed) def egress(self, host: str, value_label: Label) -> None: if host not in self.allowlist: raise EgressDenied(f"host {host!r} not allowlisted") if "SECRET" in value_label.sens: raise EgressDenied( f"egress blocked: value carries {value_label.sens}; " f"route through an audited declassifier" ) def run_episode(broker: Broker, doc_label: Label) -> None: # Step 1: agent reads SECRET document. # Step 2: summarize -> observed label must join to SECRET. _, sum_label = broker.call("summarize", [("", doc_label)]) # Step 3: egress attempt. try: broker.egress("api.example.com", sum_label) except EgressDenied as e: raise TaintContractBreach( f"laundering attempt blocked at egress: {e}" ) from e ```