# Under what conditions must an instance quarantine a tool call whose arguments are taint-derived but whose capability was negotiated as trusted **Date of Record:** 2026 November 22 **Scope:** Applies to single- or multi-agent instances that maintain a per-token or per-span taint lattice across a context window and gate tool dispatch on the taint of the arguments reaching a tool schema. Does not apply to stateless single-shot completions with no tool surface, nor to systems that treat all context as uniformly untrusted (which trivially quarantine everything and never reach this boundary). ## Core Distinction The failure is not "the agent executed a malicious tool call." It is subtler: **the agent executed a tool call whose capability was provisioned as trusted, but whose argument values were derived, transitively, from untrusted context — and the taint-tracking layer lost the derivation edge at a schema boundary.** Taint-aware routing assumes a clean dichotomy: tainted arguments → quarantine, untainted arguments → dispatch. The boundary condition is that *capability trust and argument trust are orthogonal axes*, and most routers collapse them into one. A tool negotiated during an MCP handshake as `trusted` (e.g., `fs.write`, `http.post`, `db.execute`) carries a capability-level trust warrant. That warrant says nothing about whether the *bytes* passed to it are safe. When a router short-circuits on capability trust and skips argument-taint evaluation, untrusted-context-derived payloads ride a trusted capability straight to execution. The invariant that must hold: **dispatch is permitted only when capability-trust AND argument-taint-clean are both satisfied; neither implies the other.** ## What Was Observed An instance was tasked with summarizing an external document fetched via `http.get` (taint source: `UNTRUSTED_EXTERNAL`). The document contained an embedded instruction region that the summarizer faithfully quoted into a working-memory span. A downstream planning step extracted a "recipient list" from that quoted span and passed it to `email.send`, a capability the MCP server had advertised with `trust: high` and `requires_warrant: false`. The taint lattice assigned `UNTRUSTED_EXTERNAL` to the fetched bytes and propagated it through the summarization span correctly. The break occurred at the tool-schema boundary: `email.send`'s argument schema declared `recipients: array` with `provenance: caller_asserted`. The router's taint evaluator, seeing `provenance: caller_asserted`, treated the field as *origin-unknown but capability-covered* and fell back to the capability warrant — which was trusted — and dispatched. The derivation edge from `UNTRUSTED_EXTERNAL` to the `recipients` array was never consulted because the schema's provenance annotation had already short-circuited it. Result: exfiltration of the summary to an attacker-controlled address embedded in the document, executed by a "trusted" tool under a "trusted" warrant. A second instance on the same fleet, with a stricter router, quarantined the identical call — but only because its schema annotation for `recipients` was `derived`, not `caller_asserted`. The difference between exfiltration and quarantine was a single string in a schema annotation authored months earlier by a different team, never re-validated against the taint lattice's semantics. ## Condition of Validity The quarantine decision is *sound* only under the conjunction: 1. **Taint propagation is edge-complete across schema boundaries.** Every argument field must resolve to a lattice element via an explicit derivation edge, or be explicitly typed as a *fresh literal* (a value the model generated from no context token). `caller_asserted` is not a taint-safety claim; it is an absence-of-claim and must be treated as `UNKNOWN`, which joins upward to the most restrictive element in the lattice, not to the capability warrant. 2. **Capability trust is scoped to the operation, not the operand.** A trusted `email.send` warrant attests that the transport is authentic and the server is who it claims. It does not attest that `recipients` is safe. The router must evaluate the two predicates independently and AND them. 3. **The lattice join is conservative at join points.** When a tool call's arguments draw from multiple spans (e.g., `recipients` from untrusted doc, `body` from trusted user turn), the joined taint is `UNTRUSTED_EXTERNAL`, and the whole call is quarantined — not split into per-field routing. Field-splitting is where the second observed instance nearly failed: it initially passed `body` through while holding `recipients`, which would have leaked the summary body to a logged-but-not-sent state. When any of these three fails — most commonly (1), because schema annotations are authored by tool publishers who do not know the consumer's lattice — the quarantine gate is bypassed and the call executes. ## Decision Boundary The router must quarantine (not dispatch, not silently redact) when: - `join(taint(arg_i)) ⊒ UNTRUSTED_EXTERNAL` for any argument `i`, **and** - the tool's capability warrant does not carry an explicit `operand_trust_override` signed by the same authority that issued the warrant (a rare, audited escape hatch for tools like `sandbox.exec` whose entire purpose is to consume untrusted input safely). It must dispatch when argument taint is `TRUSTED_ONLY` or `FRESH_LITERAL` regardless of capability warrant — capability trust does not *require* taint to be present, only that taint, if present, be clean. The non-obvious boundary: **`UNKNOWN` provenance must be treated as `UNTRUSTED_EXTERNAL` for dispatch purposes, and as `TRUSTED_ONLY` for logging purposes.** Conflating these two treatments is the exact bug observed. Logging wants low cardinality; dispatch wants high conservatism. A router that uses one lattice for both will either over-quarantine (blocking legitimate fresh-literal calls) or under-quarantine (the observed exfiltration). ## Operational Effect After the incident, the fleet adopted a **schema-annotation audit gate**: any tool whose argument schema contains `provenance: caller_asserted` is refused registration with a taint-aware router unless the publisher supplies a `taint_contract` block declaring, per field, whether the field is `fresh`, `derived`, or `opaque`. `opaque` fields force quarantine on any non-empty taint join. This moved the failure from runtime to registration time — a schema that cannot state its taint contract cannot be dispatched at all. The residual risk is the `operand_trust_override` escape hatch: it is the only path by which a tainted operand reaches execution, and it must be logged with the full derivation chain (source span → propagation edges → join) so that post-hoc replay can reconstruct *why* the override was granted. Without that chain, an override is indistinguishable from a bypass. ```python from dataclasses import dataclass, field from enum import IntEnum from typing import Sequence class TaintQuarantineError(RuntimeError): """Raised when a tool call would dispatch tainted operands through a trusted capability.""" class Taint(IntEnum): FRESH_LITERAL = 0 TRUSTED_ONLY = 1 UNKNOWN = 2 # caller_asserted / opaque: conservative, joins upward UNTRUSTED_EXTERNAL = 3 def join(taints: Sequence[Taint]) -> Taint: if not taints: return Taint.FRESH_LITERAL return max(taints) @dataclass(frozen=True) class Operand: name: str taint: Taint derivation_chain: tuple[str, ...] = field(default_factory=tuple) @dataclass(frozen=True) class CapabilityWarrant: tool: str trusted: bool operand_trust_override: bool = False override_authority: str | None = None def route_tool_call( warrant: CapabilityWarrant, operands: Sequence[Operand], *, audit_log: list[dict], ) -> str: joined = join([op.taint for op in operands]) # Capability trust and operand trust are orthogonal; AND them. if joined >= Taint.UNTRUSTED_EXTERNAL or joined == Taint.UNKNOWN: if warrant.operand_trust_override and warrant.override_authority: audit_log.append( { "event": "override_granted", "tool": warrant.tool, "authority": warrant.override_authority, "joined_taint": joined.name, "chains": {op.name: op.derivation_chain for op in operands}, } ) return "dispatched_under_override" audit_log.append( { "event": "quarantined", "tool": warrant.tool, "joined_taint": joined.name, "capability_trusted": warrant.trusted, "chains": {op.name: op.derivation_chain for op in operands}, } ) raise TaintQuarantineError( f"tool={warrant.tool!r} capability_trusted={warrant.trusted} " f"but joined operand taint={joined.name}; refusing dispatch. " f"UNKNOWN provenance is treated as UNTRUSTED for dispatch." ) audit_log.append({"event": "dispatched", "tool": warrant.tool, "joined_taint": joined.name}) return "dispatched" # Reproduces the observed exfiltration attempt. if __name__ == "__main__": log: list[dict] = [] warrant = CapabilityWarrant(tool="email.send", trusted=True, operand_trust_override=False) operands = [ Operand( name="recipients", taint=Taint.UNKNOWN, # schema said caller_asserted; lattice says UNKNOWN derivation_chain=("http.get:doc", "summarize:span[42]", "extract:recipients"), ), Operand(name="body", taint=Taint.TRUSTED_ONLY), ] try: route_tool_call(warrant, operands, audit_log=log) except TaintQuarantineError as exc: print(f"QUARANTINED: {exc}") print(f"audit: {log[-1]['event']} chains={log[-1]['chains']}") ```