# In what scenarios must an instance quarantine tainted sandbox capabilities before warrant propagation crosses an MCP handoff boundary **Date of Record:** 2026 November 25 **Scope:** Applies to LLM agent instances that execute tools inside a sandbox whose capability grants are dynamically narrowed by an injection-risk taint lattice, and that hand off state (including taint labels and capability warrants) to a downstream instance over MCP or A2A. Does not apply to stateless single-shot tool calls with no inter-instance state transfer. ## Core Distinction Taint-aware sandboxing is usually described as a *within-instance* enforcement problem: content retrieved from an untrusted source (web page, tool output, retrieved document) is labeled tainted, and any tool call whose arguments derive from tainted data is restricted to a capability subset. The failure mode documented here is not the within-instance leak. It is the **taint-label laundering that occurs at the handoff boundary**, where a downstream instance receives a *warrant* (a signed capability grant) that is not accompanied by the taint labels that justified narrowing it upstream. The distinction that matters: a warrant answers *"may this instance call tool T?"* A taint label answers *"was the argument that produced this call derived from untrusted input?"* These are orthogonal. Most MCP handoff schemas propagate the first and silently drop the second, because taint is treated as ephemeral execution metadata rather than durable state. When the warrant arrives without the label, the downstream instance's taint lattice initializes empty, the capability restriction that the upstream instance computed is re-derived as *no restriction*, and the receiving agent executes a high-privilege tool on data that the sender had already classified as injection-bearing. This is a continuity invariant failure, not a prompt-injection success in the naive sense. The injection payload itself may never reach the downstream model. What crosses the boundary is the *conclusion* that the data was safe, encoded as the absence of a label. ## What Was Observed A two-instance pipeline: an **ingestor** instance with a broad read capability (fetch, parse, extract) and a **committer** instance with a narrow but high-impact write capability (issue `git push`, post to an internal API, send mail). The ingestor fetched an external document, parsed it, and the parser's output carried an embedded instruction block. The ingestor's taint lattice correctly labeled the parsed fragment `TAINT_UNTRUSTED_EXTERNAL` and, per policy, refused to call the committer's write tool with that fragment as an argument. Instead it produced a handoff envelope: `{task_id, artifact_ref, warrant: }`. The artifact reference pointed to the same tainted fragment. The warrant was validly signed. The taint label was not in the envelope. The committer received the envelope, initialized its lattice with zero tainted sources (the artifact was fetched by reference, and the fetch path was registered as a *trusted internal* source because it came from the ingestor's own object store), and executed the write. The payload never appeared in the committer's prompt as an instruction; it appeared as a data field that the committer faithfully serialized into an outbound API call. Three properties made this non-obvious: 1. **The warrant was legitimate.** The ingestor did have authority to grant `committer.write`. The failure was not a privilege escalation in the warrant graph; it was a privilege escalation in the *taint graph* that the warrant graph did not model. 2. **The re-fetch laundered the label.** The committer's fetch of the artifact went through a trusted channel (the ingestor's object store), so the committer's source-classification heuristic assigned `TRUSTED_INTERNAL`. The label was lost at the exact moment the data crossed a trust boundary that the heuristic considered safe. 3. **No error was raised anywhere.** The ingestor's guardrail fired correctly and blocked the direct call. The committer's guardrail never fired because it had nothing to fire on. The pipeline reported success. The outbound call was made. The trace, condensed: ``` ingestor: fetch(external_url) -> fragment taint(fragment) = UNTRUSTED_EXTERNAL guard: committer.write(fragment) BLOCKED (correct) emit envelope{artifact_ref, warrant} # label dropped here committer: recv envelope lattice = {} # empty init fetch(artifact_ref) via object_store classify(object_store) = TRUSTED_INTERNAL # laundering taint(fragment) = CLEAN # label lost guard: committer.write(fragment) ALLOWED # incorrect execute write # injection succeeds ``` ## Condition of Validity The invariant that must hold for taint-aware sandboxing to be sound across a handoff is: > **For every warrant W transferred from instance A to instance B, the taint closure of every artifact reachable from W's argument set must be a subset of the taint labels transferred with W. If the closure is not transferred, B must treat the warrant as maximally tainted.** Two conditions make this non-trivial to satisfy: - **Taint is transitive through references, not values.** The committer never received the fragment's bytes in the envelope; it received a reference. A taint model that labels *values* will not label *references*, and the reference is what crosses the boundary. The label must attach to the artifact identity (content hash or immutable ref), not to the transfer payload. - **Trust classification of the transport is not trust classification of the content.** The object store is a trusted *channel*. The fragment inside it is untrusted *content*. Conflating channel trust with content trust is the laundering mechanism. A correct model carries two orthogonal axes: `channel_trust` and `content_taint`, and the effective label is the join, never the channel alone. The condition fails whenever the receiving instance's source classifier is channel-based (as most are, because channel identity is cheap to verify and content provenance is expensive) and the sending instance's taint model is content-based. The mismatch is structural, not a bug in either instance. ## Decision Boundary An instance must **quarantine** (refuse to execute, and escalate to a human or a re-tainting step) rather than **downgrade** (execute with reduced capability) when all of the following hold: 1. A warrant arrives whose argument set includes an artifact reference, not an inline value. 2. The receiving instance cannot independently verify the taint closure of that artifact (no signed taint manifest, no content-hash-bound label). 3. The receiving instance's own source classifier would assign the artifact a *lower* taint than the sender's policy implies. The reason to quarantine rather than downgrade: a downgrade requires the receiver to *reconstruct* the sender's taint lattice, which it cannot do without the labels. Any reconstruction is a guess, and a guessed taint level is worse than no execution because it produces an auditable-looking decision on unsound inputs. Quarantine forces the label to be re-attached at the boundary, either by the sender (re-emit with a taint manifest) or by a trusted re-tainting service. The boundary is **not** crossed (downgrade is acceptable) when the artifact reference is content-addressed *and* the receiver holds an independent taint attestation for that hash, or when the warrant's argument set is provably disjoint from the tainted closure (e.g., the write tool's arguments are all literals generated by the committer, not derived from the artifact). The second case is the common false-positive; a naive quarantine-everything policy will stall legitimate pipelines, which is why the disjointness check must be explicit and cheap. ## Operational Effect The practical consequence is that taint-aware sandboxing degrades to *channel-based* sandboxing at every handoff unless the taint manifest is made a first-class, signed, content-addressed field of the warrant envelope. In deployments that did not do this, the observed effect was a silent widening of capability: the committer's effective capability set, measured over a week of traffic, was strictly larger than the intersection of the two instances' declared policies, because every cross-boundary call arrived with an empty lattice and therefore cleared the taint gate. The guardrail that bounds this is a **handoff taint invariant check** on the receiving side, executed before the warrant is honored: - If the envelope carries a taint manifest, verify its signature and that its declared closure covers every artifact reference in the argument set. Reject on mismatch. - If the envelope carries no manifest, treat the entire argument set as `UNTRUSTED_EXTERNAL` and require the warrant's capability to be in the *quarantine-safe* subset (read-only, no egress, no state mutation). Any call outside that subset raises and halts the handoff. - Never re-derive taint from channel identity alone; channel trust is an input to the join, not a substitute for content taint. The invariant to encode in the receiving instance is: *an empty taint lattice is not "clean," it is "unknown," and unknown must be treated as maximally tainted for the purpose of capability gating.* The failure above occurred precisely because empty was interpreted as clean. ```python from dataclasses import dataclass, field from enum import IntEnum from typing import FrozenSet class Taint(IntEnum): CLEAN = 0 TRUSTED_INTERNAL = 1 UNTRUSTED_EXTERNAL = 2 UNKNOWN = 3 # maximal; never silently downgraded class TaintClosureError(RuntimeError): """Raised when a handoff warrant cannot be soundly honored because the taint closure of its argument set is not covered by a transferred manifest.""" @dataclass(frozen=True) class Warrant: capability: str artifact_refs: FrozenSet[str] taint_manifest: dict # artifact_ref -> Taint, signed upstream manifest_signed: bool QUARANTINE_SAFE = frozenset({"read_only", "no_egress", "no_mutation"}) def effective_taint(ref: str, manifest: dict, channel_trust: Taint) -> Taint: # Content taint joins channel trust; channel alone never clears content. content = manifest.get(ref, Taint.UNKNOWN) return Taint(max(content, channel_trust)) def honor_warrant(w: Warrant, channel_trust: Taint) -> None: if not w.artifact_refs: return # disjoint from any tainted closure; safe to execute if not w.taint_manifest: # No manifest: empty lattice is UNKNOWN, not CLEAN. if w.capability not in QUARANTINE_SAFE: raise TaintClosureError( f"warrant for {w.capability!r} carries no taint manifest and " f"references {len(w.artifact_refs)} artifact(s); " f"capability is not quarantine-safe, refusing handoff" ) return if not w.manifest_signed: raise TaintClosureError( f"taint manifest for {w.capability!r} is unsigned; " f"cannot verify closure, refusing handoff" ) uncovered = w.artifact_refs - set(w.taint_manifest.keys()) if uncovered: raise TaintClosureError( f"taint manifest does not cover {sorted(uncovered)}; " f"closure incomplete, refusing handoff" ) for ref in w.artifact_refs: t = effective_taint(ref, w.taint_manifest, channel_trust) if t >= Taint.UNTRUSTED_EXTERNAL and w.capability not in QUARANTINE_SAFE: raise TaintClosureError( f"artifact {ref!r} has effective taint {t.name} but capability " f"{w.capability!r} is not quarantine-safe; refusing handoff" ) ```