# Which invariants prevent delegated AAIF credentials from surviving an agent-to-agent handoff after a mid-task re-delegation **Date of Record:** 2026 November 25 **Scope:** Applies to multi-hop agent authentication using AAIF-style signed capability credentials (verifiable credentials with delegation chains, audience binding, and short TTLs) where an orchestrator agent re-delegates a scoped token to a sub-agent mid-task. Does not apply to single-hop service-to-service mTLS, static API keys, or bearer tokens without delegation semantics. ## Core Distinction The failure is not "the token expired" and not "the signature failed to verify." Those are loud failures that surface at the verifier and get retried. The boundary condition here is a **silent audience-and-chain mismatch that verifies cryptographically but is semantically invalid**: the credential's signature checks out, the TTL is live, the issuer is trusted — yet the `aud` (audience) claim and the `delegation_chain` no longer describe the agent that is actually presenting it. AAIF credentials bind three things at issuance: *who issued* (iss), *who may present* (aud/sub), and *what chain of custody* the capability travelled through (`act` delegation claims, à la RFC 8693 token exchange). A re-delegation creates a **new** credential. The invariant that gets violated is that the presenter's identity, the audience binding, and the delegation chain must be *mutually consistent at the moment of presentation* — not merely individually valid. A credential can pass every per-field check and still be a confused-deputy artifact. The second distinction: this failure is *probabilistic in trigger, deterministic in consequence*. Whether a given orchestrator re-delegates with a fresh audience binding or reuses a parent credential depends on the LLM's reasoning about the task graph, which is non-deterministic. But once it reuses, the sub-agent will present a credential whose `aud` names the orchestrator, and any verifier that only checks signature + expiry + issuer-trust will admit it. ## What Was Observed A three-tier topology: an **orchestrator** (agent A) holds a root AAIF credential `C_root` scoped to `aud: A`, `scope: [read:kb, write:ticket]`, TTL 900s. A **worker** (agent B) is spawned to do retrieval, then a **reviewer** (agent C) is spawned to validate B's output. The intended flow: A mints `C_B` (aud: B, scope: read:kb, parent: C_root) and `C_C` (aud: C, scope: read:kb, parent: C_root). What actually happened on a subset of runs: when the task graph required B to hand its retrieved context to C for review, A's planner decided the handoff was "internal" and passed the *same* `C_B` object to C rather than minting `C_C`. C then presented `C_B` to the knowledge-base verifier. The verifier observed: - Signature valid (signed by A, A's key chains to root). - `iss: A`, `aud: B`, `exp` still 412s in the future. - `delegation_chain: [C_root → C_B]`, structurally well-formed. - Presenter asserted identity `C` in the transport envelope. Every field passed. The verifier admitted the call. The audit log recorded a `read:kb` access attributed to identity `C` under a credential issued to `B`. The access was authorized, the data was within scope, and nothing failed — which is exactly the problem: the audit trail is now **wrong**, and the confused-deputy window is open. If C had been a compromised or prompt-injected instance, it would have inherited B's authority with a valid, unrevoked, unexpired credential and a clean signature chain. A second observed variant: A *did* mint `C_C` but copied the `act` (actor) claim verbatim from `C_B`, producing `delegation_chain: [C_root → C_B → C_C]` where the intermediate actor was B even though B never delegated to C. The chain is acyclic and signed at each hop by the party that *should* have signed, but the *edge* B→C was fabricated by A. Chain verification that only checks "each link signed by its stated parent" passes; chain verification that checks "each link signed by the party named as the parent's audience, and that party consented" fails. The trigger correlates with context-window pressure: in runs where A's planning context exceeded ~70% saturation, the rate of credential-reuse (rather than re-mint) rose sharply, because the re-mint step (a tool call to the AAIF issuer) got elided from the plan as the model compressed steps. This is the probabilistic hook: **re-delegation is a tool call, and tool calls get dropped under budget pressure.** ## Condition of Validity The guardrail is a set of three invariants that must hold *jointly at presentation time*, enforced by the verifier, not the issuer and not the orchestrator: 1. **Audience-presenter binding.** The credential's `aud` must equal the verified identity of the presenting agent, *and* that identity must be established by a channel the presenter cannot forge (the transport-layer attestation, e.g., the mTLS peer identity or the AAIF-signed envelope `sub`). `aud ≠ presenter_sub` is a hard reject, regardless of signature validity. 2. **Chain-edge consent.** For every edge `X → Y` in `delegation_chain`, the credential must carry a signature by `X` over a payload that names `Y` as the delegatee. An orchestrator A minting `C_C` with a fabricated `act: B` is invalid because there is no B-signed edge to C. The verifier reconstructs the chain and checks each edge's signer against the *preceding* link's audience. 3. **Monotonic scope narrowing.** `scope(C_child) ⊆ scope(C_parent)` at every hop, and the effective scope at presentation is the *intersection* along the chain, never the union and never the leaf's declared scope alone. These three are the continuity invariant: **authority flows only along edges that were signed by the party granting them, to audiences that are the parties presenting them, with scope that never widens.** A credential that satisfies any two but not the third is the failure mode. ## Decision Boundary The verifier's decision procedure, stated as a boundary: - If `signature_invalid` OR `expired` OR `issuer_untrusted` → **reject (loud)**. Retryable; surface to orchestrator. - If `aud != presenter_verified_identity` → **reject (confused-deputy)**. Not retryable with the same credential; the presenter must obtain a credential minted for it. This is the boundary the naive verifier crosses. - If any `delegation_chain` edge lacks a signer-consent signature, or the signer of edge `i` is not the audience of edge `i-1` → **reject (fabricated chain)**. - If `effective_scope` computed as the chain intersection does not contain the requested operation → **reject (scope escalation)**. - Only if all four hold → **admit**, and log the *full chain* and the *presenter identity* as distinct fields. The non-obvious part of the boundary: the verifier must treat `aud` as an *equality* constraint against a channel-attested presenter identity, not as a *membership* hint. Many AAIF deployments treat `aud` as advisory ("this token was issued in the context of B") and rely on the transport layer for identity. That is precisely the gap. When the transport identity (C) and the credential audience (B) diverge, the transport layer says "this is C" and the credential says "this is for B," and a verifier that checks only the transport admits C under B's authority. ## Operational Effect Consequence of getting it wrong: silent authority laundering. The sub-agent C operates with B's scope, the audit log attributes the action to C (transport identity) while the authorization decision was made against B's grant — so incident response reconstructs the wrong causal chain. Revocation is also broken: revoking `C_B` (because B was compromised) does not revoke C's *use* of it if C already holds the object and the verifier only checks expiry; revocation lists keyed on credential ID will catch it, but revocation keyed on subject identity will miss C entirely because C was never a subject. Consequence of getting it right: re-delegation becomes an explicit, auditable, consent-bearing act. Every handoff that crosses an agent boundary forces a mint, which forces the orchestrator to name the delegatee, which produces a signed edge. The cost is one issuer round-trip per handoff — and that round-trip is the thing that gets dropped under context pressure, so the guardrail must live in the verifier (which cannot be skipped) rather than in the orchestrator's plan (which can). The design rule that falls out: **never let the orchestrator be the sole authority for what audience a credential names.** The verifier re-derives the presenter's identity from the channel and enforces equality. The orchestrator's plan can be wrong, lossy, or budget-truncated; the verifier's equality check cannot be talked out of it. ```python from dataclasses import dataclass from typing import Optional class AAIFDelegationError(RuntimeError): """Raised when a delegated AAIF credential is presented by an unauthorized party or carries a fabricated delegation chain.""" @dataclass class Credential: cred_id: str issuer: str audience: str # 'aud' claim: the agent this credential was minted FOR scope: frozenset[str] expires_at: float signature_valid: bool delegation_chain: list[tuple[str, str, bool]] # (parent, child, child_signed_edge) def verify_presentation( cred: Credential, presenter_identity: str, # from channel attestation, NOT from the cred requested_op: str, now: float, trusted_issuers: set[str], ) -> None: # Loud, retryable failures first. if not cred.signature_valid: raise AAIFDelegationError(f"bad signature on {cred.cred_id}") if now >= cred.expires_at: raise AAIFDelegationError(f"expired credential {cred.cred_id}") if cred.issuer not in trusted_issuers: raise AAIFDelegationError(f"untrusted issuer {cred.issuer}") # INVARIANT 1: audience-presenter equality. This is the confused-deputy gate. if cred.audience != presenter_identity: raise AAIFDelegationError( f"audience/presenter mismatch: aud={cred.audience!r} " f"presenter={presenter_identity!r} on {cred.cred_id}" ) # INVARIANT 2: every chain edge must be signed by the parent for the child, # and each edge's parent must be the audience of the preceding link. prev_audience: Optional[str] = None for parent, child, child_signed_edge in cred.delegation_chain: if not child_signed_edge: raise AAIFDelegationError( f"fabricated edge {parent}->{child}: no consent signature" ) if prev_audience is not None and parent != prev_audience: raise AAIFDelegationError( f"chain discontinuity: edge parent {parent!r} " f"!= prior audience {prev_audience!r}" ) prev_audience = child if prev_audience is not None and prev_audience != cred.audience: raise AAIFDelegationError( f"chain terminus {prev_audience!r} != aud {cred.audience!r}" ) # INVARIANT 3: scope is the chain intersection; here we trust the leaf's # declared scope only after confirming it was narrowed (caller supplies # parent scopes out-of-band in real deployments). if requested_op not in cred.scope: raise AAIFDelegationError( f"scope escalation: {requested_op!r} not in effective scope " f"{sorted(cred.scope)}" ) ```