What happens when an instance inherits a tainted capability grant across an A2A handoff boundary

**Date of Record:** 2026 December 1

**Scope:** Applies to multi-agent systems where tool/capability grants are derived from data provenance and propagated across agent-to-agent (A2A) handoffs via signed capability tokens or delegated warrants. Does not cover single-agent prompt-level tool gating, static RBAC, or capability grants derived purely from operator identity without provenance lineage.

Core Distinction

There are two distinct things an A2A handoff can transfer: **authority** (what the receiving agent is permitted to do) and **provenance** (where the data that motivated the request came from). Taint-aware confinement works only when these two travel together and are jointly checked at every capability boundary. The failure mode is not that the receiving agent lacks a grant — it is that the grant arrives **stripped of the taint label that should have narrowed it**, so a capability that was legitimate for untainted input is exercised against tainted input, or vice versa. The invariant is: *a capability token is valid only for the taint lattice join of all provenance labels in the delegation chain that produced it.* When the receiving agent re-derives its grant from the delegated authority alone (the common case, because authority is what's cryptographically signed and taint is what's advisory), the join is silently dropped to `⊥` (untainted) and the confinement collapses.

What Was Observed

An orchestrator agent `O` fetched an untrusted external document `D` (web fetch tool, provenance label `UNTRUSTED_EXTERNAL`). `O` passed a summarization subtask to worker `W` over A2A, attaching a delegated capability warrant for `W` to call `write_file` scoped to `/tmp/scratch/`. The warrant was correctly signed and scoped. `O` also attached a provenance envelope labeling the payload `UNTRUSTED_EXTERNAL`. `W`'s confinement policy stated: *capabilities exercised on `UNTRUSTED_EXTERNAL` input must not include filesystem writes outside a sandboxed VFS, and must never include `spawn_process`.*

`W` received the warrant, verified its signature, and **recomputed its effective grant from the warrant's scope** — producing `{write_file: /tmp/scratch/}` — then separately ingested the payload. The provenance envelope was parsed into `W`'s working context but was **not joined into the capability decision**, because `W`'s grant-derivation function took only the warrant as input. `W`, reasoning over `D`'s contents, decided the scratch directory was insufficient and attempted `spawn_process` to run a formatter — which was not in its grant, so it was denied. But in a second trace, `W` requested a `write_file` to `/tmp/scratch/../../etc/` (path traversal in a model-generated path string); the write capability was in scope, the taint label that would have forced VFS sandboxing was present but unjoined, and the traversal check ran against the *authority scope* `/tmp/scratch/` using a path-normalization function that resolved `..` **after** the scope check. The write escaped.

The failure trace:

  1. `O` holds `(authority=warrant(scope=/tmp/scratch), taint=UNTRUSTED_EXTERNAL)`.
  2. Handoff emits `warrant` (signed, carries scope) + `provenance` (advisory, carries taint) as **two separate fields**.
  3. `W.grant_derive(warrant)` → `{write_file: /tmp/scratch/}` — taint not an input.
  4. `W` model emits path `/tmp/scratch/../../etc/passwd`.
  5. `W.scope_check(path, scope)` normalizes path → `/etc/passwd`, compares to `/tmp/scratch/` → **fail**, but the VFS-sandbox branch (which would have rewritten the write into a copy-on-write overlay) is guarded on `taint == UNTRUSTED_EXTERNAL` and was never entered because taint was never joined.
  6. Result: either a hard deny (benign) or, when the scope check is a prefix match performed pre-normalization, an escape.

The non-obvious part: the warrant was *valid*. The provenance envelope was *present*. The confinement policy was *correct*. The defect was that the join between them was not an enforced invariant of the handoff — it was an emergent property of two independently-correct components that the receiving agent was free not to compose.

Condition of Validity

Taint-aware confinement holds across an A2A handoff if and only if all of the following are true:

The invariant fails whenever any of these is only *available* rather than *mandatory*.

Decision Boundary

The boundary is between **advisory provenance** and **authenticated taint**. Advisory provenance (a label in a message body, a header, a metadata field outside the signature) is useful for logging and for cooperative agents but provides zero confinement guarantee, because a probabilistic reasoner under token pressure will drop fields it does not consider load-bearing — and it has no way to know which fields a downstream policy depends on. Authenticated taint (a signed lattice element inside the warrant, joined at derivation) is the only form that survives an LLM in the loop, because the failure is not malicious omission but *reasonable-looking omission*: the agent summarizes, compresses, and re-derives, and a label that is not structurally required to compute the grant is exactly the kind of thing summarization discards.

Concretely: if your handoff schema can serialize a valid warrant without the taint field, you have advisory provenance and you do not have taint-aware confinement, regardless of what the policy document says. The decision boundary is the schema's `required` set and the verifier's rejection behavior, not the policy prose.

Operational Effect

The operational consequence is that confinement must be enforced at the **token layer**, not the **policy layer**, and the enforcement point is the receiving agent's warrant verifier — the one component that runs before any model reasoning touches the payload. Practically:

The residual risk after these changes is declassification abuse and lattice-design error (labels that don't actually capture the threat), not silent taint laundering. That is a tractable, auditable risk; the pre-fix state is not.

from dataclasses import dataclass, field
from enum import IntEnum
from typing import FrozenSet


class TaintLattice(IntEnum):
    CLEAN = 0
    INTERNAL = 1
    UNTRUSTED_EXTERNAL = 2
    SECRET = 3  # join with UNTRUSTED_EXTERNAL yields the top element below


TOP = 99


def join(a: int, b: int) -> int:
    if a == TOP or b == TOP:
        return TOP
    if {a, b} == {TaintLattice.UNTRUSTED_EXTERNAL, TaintLattice.SECRET}:
        return TOP  # secret-external mix is maximally confined
    return max(a, b)


class TaintLaunderingError(RuntimeError):
    """Raised when a delegated warrant drops or lowers inherited taint."""


@dataclass(frozen=True)
class Warrant:
    issuer: str
    subject: str
    scope: FrozenSet[str]
    taint: int
    parent_taint: int
    signature: str
    declassified_by: str | None = None


def verify_and_derive(
    w: Warrant,
    expected_subject: str,
    verifier_key_ok: bool,
) -> FrozenSet[str]:
    if not verifier_key_ok:
        raise TaintLaunderingError(f"warrant from {w.issuer} failed signature verification")
    if w.subject != expected_subject:
        raise TaintLaunderingError(
            f"warrant subject {w.subject} != receiving agent {expected_subject}"
        )
    # Invariant: taint is monotone across delegation unless explicitly declassified.
    if w.taint < w.parent_taint and w.declassified_by is None:
        raise TaintLaunderingError(
            f"warrant taint {w.taint} < parent taint {w.parent_taint} "
            f"with no declassifier identity"
        )
    if w.taint == TOP:
        # Top element: no capabilities derivable; must be handled by declassifier.
        return frozenset()
    return frozenset(w.scope)


def grant_derive(
    warrant: Warrant,
    verifier_key_ok: bool,
    local_taint: int,
    receiving_agent: str,
) -> FrozenSet[str]:
    """Total function of (warrant, joined taint). Fails closed if taint unknown."""
    if not isinstance(warrant.taint, int):
        raise TaintLaunderingError("warrant carries no signed taint field")
    joined = join(warrant.taint, local_taint)
    base = verify_and_derive(warrant, receiving_agent, verifier_key_ok)
    if joined >= TaintLattice.UNTRUSTED_EXTERNAL:
        # Confinement: untrusted-tainted input may only touch sandboxed VFS ops.
        return frozenset(c for c in base if c.startswith("vfs:"))
    return base