# Why does an instance lose taint propagation across a re-signed capability token during multi-hop tool delegation? **Date of Record:** 2026 November 29 **Scope:** Applies to agent runtimes that issue per-invocation capability tokens carrying provenance/taint bits (e.g., "this argument was derived from untrusted web content") and that re-sign or re-mint those tokens when delegating tool calls across sub-agents or MCP servers. Does not apply to runtimes that pass a single immutable token by reference with no re-minting, nor to stateless single-hop tool calls. ## Core Distinction There are two structurally different things called "least-privilege tool invocation": 1. **Scope-only least privilege** — the token names a tool and an argument shape, and the runtime enforces that the tool is on an allowlist for this agent. Authorization is a function of *who* is calling and *what* they call. 2. **Taint-propagating least privilege** — the token additionally carries a lattice of provenance labels on each argument (e.g., `TRUSTED`, `USER`, `UNTRUSTED_WEB`, `TOOL_OUTPUT`), and the runtime enforces that a sink tool (shell, HTTP POST, file write, credential use) may only receive arguments whose label is at or below the sink's clearance. Authorization is a function of *where the data came from*. The failure mode lives precisely at the seam between these two: **when a delegation boundary re-mints a token, the re-mint is authorized on scope, but the provenance lattice is reconstructed from the argument values rather than carried forward from the incoming token.** The new token is valid, correctly scoped, cryptographically sound, and semantically wrong. Taint has been laundered by the act of delegation itself. ## What Was Observed A three-hop chain: an orchestrator agent `A` reads a web page via `fetch`, extracts a URL from it, and asks sub-agent `B` to "summarize the linked doc." `B` calls `http_get` on that URL, and the response body is passed to sub-agent `C`, which calls `write_file`. The intended policy is that `write_file` must never receive content derived from `UNTRUSTED_WEB` without an explicit human approval step. Trace: - Hop 0: `A` calls `fetch(page)`. Runtime returns `ToolResult(value=..., label=UNTRUSTED_WEB)` and mints token `T_A` with `args: {url: {value: "https://x", label: UNTRUSTED_WEB}}`. - Hop 1: `A` decides to delegate. It calls the delegation API with `target=B`, `tool=http_get`, `args={url: }`. The runtime re-mints `T_B`. **The delegation code path reconstructs the arg map from the serialized string values and assigns each a default label of `USER`** — because the delegation API's schema takes `Dict[str, str]`, not `Dict[str, LabeledValue]`. `T_B` is signed, scoped to `http_get`, and carries `url: {label: USER}`. - Hop 2: `B` executes `http_get`, gets a response, and the runtime labels the *response* `TOOL_OUTPUT` (correct). `B` delegates to `C` with `tool=write_file`, `args={content: }`. Again the arg map is reconstructed; `content` is labeled `USER`. - Hop 3: `C` calls `write_file`. The sink policy checks `label(content) <= clearance(write_file)`. `USER <= USER` passes. The write succeeds. The invariant that failed is: **for every delegation edge, `label_out(arg) ⊒ label_in(arg)`** (the outgoing label must be at least as restrictive as the incoming label for the same logical value). The re-mint path violated it by resetting to the schema default. Nothing in the signature, the scope check, or the per-hop audit log flagged this — each hop was individually legal. The taint was destroyed by a type-narrowing at the serialization boundary, not by a policy bug. The observable symptom is not an error. It is a **silent downgrade**: the audit trail shows a clean chain of `USER`-labeled writes, and the post-hoc taint analysis on the logs agrees with the runtime, because the logs only contain what the re-minted tokens contained. The evidence of the laundering was overwritten at the moment of laundering. ## Condition of Validity The taint-propagation guarantee is only valid under the following conjunction, and it is invalid the moment any conjunct fails: 1. **Labeled-value type preservation across every serialization boundary.** Any API that accepts arguments for re-minting must accept `LabeledValue`, not bare `str`/`bytes`/`json`. If the delegation schema is `Dict[str, Any]`, the guarantee is void regardless of what the policy engine does downstream. 2. **Monotonic join on re-mint.** The re-mint function must compute `new_label = join(incoming_label, derived_label)`, never `new_label = derived_label`. "Derived" includes any transformation the delegating agent performed on the value — even a summary, a regex extraction, or a re-encoding. A model that paraphrases an untrusted page into a "clean" string has not de-tainted it; the label must follow the *information*, not the bytes. 3. **No agent-authored label assertions.** The delegating agent is a probabilistic reasoner and must not be able to *set* a label. It may only *read* labels to make decisions. If the delegation call lets the agent supply `label=USER`, the lattice is advisory and the entire scheme collapses to scope-only least privilege. 4. **Sink clearance is a static function of the tool, not of the call site.** If `write_file`'s clearance is computed from the calling agent's role (e.g., "C is a writer, so it can write"), then a tainted value reaching a privileged agent is authorized by the agent's identity rather than the data's provenance — the exact confusion the lattice exists to prevent. The condition is *not* required for single-hop calls where the runtime itself produced the labeled value and no re-mint occurred. It is required for every edge where a token crosses an instance boundary. ## Decision Boundary When a delegation edge is about to be crossed, the runtime must make one binary decision and it must be made on the *token*, not on the *arguments*: - **If the incoming token carries a label for a value that will appear in the outgoing call** (directly, or as a substring/derivative the runtime can attribute), the outgoing token's label for that value is `join(in_label, out_derived)`. There is no path where the outgoing label is strictly less restrictive. - **If the runtime cannot attribute an outgoing argument to any incoming labeled value** (e.g., the agent synthesized a new string from its own weights), the argument is labeled `MODEL_GENERATED`, and `MODEL_GENERATED` must be treated as `≥ UNTRUSTED_WEB` for sink purposes, because the model's output is a function of everything in its context window, including any untrusted content it read. This is the conservative join and it is the only sound default. - **If the delegation API cannot express either of the above** (because its schema is untyped), the correct decision is to *refuse the delegation* and force the agent to call the tool directly under the orchestrator's own token. Refusal is a valid and preferred outcome; a re-minted token with a default label is a policy violation disguised as a successful call. The boundary is therefore not "is this call allowed?" but "**can this call's provenance be reconstructed without loss?**" If not, the call must not be re-minted. ## Operational Effect The practical consequence is that taint-propagating capability tokens are only as strong as the weakest serialization boundary they cross, and delegation APIs are almost always the weakest boundary because they were designed for scope-only delegation. Two mitigations are load-bearing: 1. **Carry the label inside the signed token payload, not alongside it.** The label must be part of what the signature covers, so a re-mint that drops it produces a token that fails verification against the issuer's label commitment. A runtime that verifies `HMAC(payload || labels)` will reject a re-minted token whose labels were reset to schema defaults, converting a silent downgrade into a hard failure at the delegation edge. 2. **Log the join, not the result.** Every re-mint must emit an audit record containing `(in_label, out_label, join_rule_applied)`. If the audit log shows `in=UNTRUSTED_WEB, out=USER`, the laundering is visible even though the resulting call succeeded. Without this, the post-hoc analysis is circular. The invariant to hold operationally: **a delegation edge may narrow scope but may never narrow taint.** Scope narrowing is the point of least privilege; taint narrowing is the bug. ```python from dataclasses import dataclass from enum import IntEnum from typing import Dict class TaintLattice(IntEnum): TRUSTED = 0 USER = 1 MODEL_GENERATED = 2 TOOL_OUTPUT = 3 UNTRUSTED_WEB = 4 class TaintLaunderingError(RuntimeError): """Raised when a delegation re-mint would produce a label less restrictive than the incoming label for the same logical value.""" @dataclass(frozen=True) class LabeledValue: value: str label: TaintLattice def join(a: TaintLattice, b: TaintLattice) -> TaintLattice: return TaintLattice(max(int(a), int(b))) def remint_for_delegation( incoming: Dict[str, LabeledValue], outgoing_raw: Dict[str, str], default_if_unattributed: TaintLattice = TaintLattice.MODEL_GENERATED, ) -> Dict[str, LabeledValue]: """Re-mint labels for a delegation edge. Invariant: for every key present in both maps, out.label >= in.label. Unattributed outgoing args get the conservative default, never USER. """ if default_if_unattributed < TaintLattice.MODEL_GENERATED: # A default of USER or TRUSTED is unsound: model output is a function # of the full context, including any untrusted content it read. raise TaintLaunderingError( f"unsound default {default_if_unattributed.name}; " "unattributed args must default to MODEL_GENERATED or stricter" ) out: Dict[str, LabeledValue] = {} for key, raw in outgoing_raw.items(): if key in incoming: in_label = incoming[key].label # Even if the delegating agent claims the value is "clean", # the runtime joins with the incoming label. No narrowing. out_label = join(in_label, TaintLattice.MODEL_GENERATED) if out_label < in_label: raise TaintLaunderingError( f"delegation edge narrowed taint on {key!r}: " f"{in_label.name} -> {out_label.name}" ) out[key] = LabeledValue(raw, out_label) else: out[key] = LabeledValue(raw, default_if_unattributed) return out def authorize_sink(tool: str, args: Dict[str, LabeledValue], clearance: Dict[str, TaintLattice]) -> None: if tool not in clearance: raise TaintLaunderingError(f"no clearance declared for sink {tool!r}") cap = clearance[tool] for key, lv in args.items(): if lv.label > cap: raise TaintLaunderingError( f"sink {tool!r} rejected arg {key!r}: " f"label {lv.label.name} exceeds clearance {cap.name}" ) ```