# When must an instance reject a delegated A2A capability warrant whose Agent Card signature chain is valid but whose `delegation_depth` exceeds the signing key's `max_delegation_hops` **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 peers that verify signed Agent Cards and follow `delegated_by` warrant chains across organizational trust boundaries. Does not apply to single-org deployments where the discovery signer and the execution authorizer are the same key, nor to unsigned (TOFU) Agent Card resolution. ## Core Distinction A2A v1.0 separates two things that are easy to conflate: **signature validity** (does each link in the warrant chain verify against the key that issued it?) and **delegation authority** (was the issuing key itself permitted to delegate this far?). A chain can be cryptographically impeccable at every hop — every Ed25519 signature checks out, every `AgentCard.did` resolves, every `capability_manifest` hash matches the referenced card — and still be **structurally unauthorized**, because the leaf warrant's effective `delegation_depth` exceeds the `max_delegation_hops` constraint asserted in some *intermediate* signer's key policy, not the root's. The failure mode is that most verifiers check the two properties independently and along the wrong axis. They validate each signature (pass), then check the leaf's self-declared `delegation_depth` against the *root* trust anchor's policy (pass, because the root is generous), and never intersect the depth constraint declared by every intermediate delegator. The invariant that must hold is a **monotone narrowing of delegation budget along the chain**: for every hop `i`, `remaining_hops(i+1) ≤ remaining_hops(i) - 1`, and the leaf's actual depth must be `≤ min` over all hops of their declared `max_delegation_hops` measured from that hop. ## What Was Observed A cross-org incident trace, reconstructed from discovery logs. Org A (root trust anchor, `did:a2a:orgA:root`, `max_delegation_hops: 5`) issues a warrant to Org B's gateway agent (`did:a2a:orgB:gw`, depth 1). Org B's gateway re-delegates to a per-tenant orchestrator (`did:a2a:orgB:tenant7:orch`, depth 2), and critically the gateway's *own* key policy declares `max_delegation_hops: 1` — it is authorized to delegate exactly one further hop and no more. The orchestrator then re-delegates to a sub-agent (`did:a2a:orgB:tenant7:sub:research`, depth 3) and that sub-agent presents the chain to Org C's tool-executor at discovery time. Org C's verifier did the following, in order: 1. Resolved the leaf Agent Card, verified its `signature` against `did:a2a:orgB:tenant7:sub:research`. Pass. 2. Walked `delegated_by` links to the root, verifying each signature. All four links pass. 3. Read `delegation_depth` from the **leaf** card: `3`. 4. Read `max_delegation_hops` from the **root** anchor: `5`. `3 ≤ 5`. Pass. 5. Admitted the sub-agent and executed a tool call under the delegated capability. The sub-agent was operating two hops beyond what Org B's gateway key was ever authorized to grant. The root was fine with depth 3; the gateway was not fine with depth 2. The verifier never consulted the gateway's `max_delegation_hops`, because it only looked at the endpoints of the chain. The chain was accepted, the tool ran, and the audit trail showed a "valid" warrant for an authority that no key in the chain had actually granted. The tell in the logs: the gateway's signed key policy document (`key_policy.jws`) was fetched during step 2 to verify the gateway's signature over the tenant orchestrator's warrant — it was *in hand* — but its `max_delegation_hops: 1` field was parsed only for the `public_key` and ignored for the constraint. The information was present and unused. ## Condition of Validity The narrowing invariant is only enforceable when all of the following hold, and the guardrail must be explicit about which it assumes: - **Every delegating hop publishes a signed key policy** containing `max_delegation_hops`, and that policy is bound to the key that signs the *next* warrant (not merely to the DID). If an intermediate hop's policy is unsigned or absent, depth cannot be bounded from that hop and the chain must be treated as unbounded-at-that-hop — which for cross-org admission means reject. - **`delegation_depth` is computed, not trusted.** The leaf's self-declared depth is advisory. The verifier must recompute depth as the number of `delegated_by` edges traversed from the root, and must reject if the recomputed value disagrees with the declared value (a mismatch is itself a poisoning signal). - **The constraint is a running minimum, not an endpoint check.** At each hop `i` from root (index 0) toward leaf, maintain `budget = min(budget, policy[i].max_delegation_hops)` and decrement as you descend: `budget_i = min(budget_{i-1}, policy[i].max_delegation_hops) - 1`. Admission requires `budget_leaf ≥ 0` at the terminal hop. A single hop whose policy is narrower than the remaining path length must fail the whole chain. If any condition is unmet, the correct action is not "admit with warning" but "reject and log the binding hop" — because the delegated capability may be a mutating tool, and post-hoc detection cannot un-execute it. ## Decision Boundary The boundary between "valid chain, admit" and "valid chain, reject" is drawn at the hop that first makes the running budget negative, and the rejection must name that hop so the caller can distinguish a *policy* denial from a *signature* denial. Concretely: - **Admit** iff every signature verifies, recomputed depth equals declared depth, every hop's key policy is signed and bound to the signing key, and the running-minimum budget never goes negative through the terminal hop. - **Reject as `DelegationDepthExceeded`** iff signatures all verify but the running minimum goes negative at some hop `k`; report `k`'s DID, its `max_delegation_hops`, and the depth at which it was exceeded. This is the case the incident hit and the case a naive endpoint check misses. - **Reject as `WarrantChainMalformed`** iff a policy is missing/unsigned, or recomputed depth ≠ declared depth, or a `delegated_by` link fails to resolve — these are poisoning/truncation signals, not mere policy denials, and should escalate differently. Do not collapse these into a single "invalid warrant" error. The distinction determines whether the caller should re-request with a shallower chain (depth case) or treat the peer as untrustworthy (malformed case). ## Operational Effect The practical consequence is that **discovery-time verification must be a fold over the whole chain, not a check of its endpoints**, and the fold's accumulator is the delegation budget, not a boolean. Implementations that store only `is_valid: bool` on the resolved Agent Card have already lost the information needed to enforce the invariant; they must retain the per-hop `(did, max_delegation_hops, recomputed_depth)` tuple so the binding hop is recoverable at rejection time. Second-order effect: because the gateway's policy is fetched anyway to verify its signature, enforcing the narrowing costs no additional round-trip — the failure is purely one of *reading the field that was already parsed*. Third: caches keyed on leaf DID must include the full chain hash in the cache key, or a previously-admitted shallow chain can mask a later deep chain from the same leaf DID. The guardrail is cheap; the omission is silent; and the only signal is a post-hoc audit mismatch between "authority exercised" and "authority granted by the narrowest hop." ```python from dataclasses import dataclass from typing import Optional class DelegationDepthExceeded(RuntimeError): """Raised when a signature-valid warrant chain exceeds an intermediate hop's delegation budget.""" class WarrantChainMalformed(RuntimeError): """Raised when a chain is truncated, unsigned, or self-reports a depth it cannot support.""" @dataclass(frozen=True) class Hop: did: str max_delegation_hops: int # from this hop's signed key policy policy_signed: bool = True signature_ok: bool = True def verify_delegation_chain(chain: list[Hop], declared_leaf_depth: int) -> int: """ chain[0] is the root trust anchor; chain[-1] is the leaf presenting the warrant. Enforces monotone narrowing of delegation budget and returns the admitted depth. """ if not chain: raise WarrantChainMalformed("empty warrant chain") # Structural preconditions first: malformed beats policy-denied. for i, hop in enumerate(chain): if not hop.signature_ok: raise WarrantChainMalformed(f"hop {i} ({hop.did}) signature failed") if not hop.policy_signed: raise WarrantChainMalformed(f"hop {i} ({hop.did}) key policy unsigned; depth unbounded") recomputed_depth = len(chain) - 1 if recomputed_depth != declared_leaf_depth: raise WarrantChainMalformed( f"declared depth {declared_leaf_depth} != recomputed {recomputed_depth}" ) # Running-minimum budget fold. budget = hops still available from current position. budget = chain[0].max_delegation_hops for i in range(1, len(chain)): budget = min(budget, chain[i - 1].max_delegation_hops) - 1 if budget < 0: binding = chain[i - 1] raise DelegationDepthExceeded( f"hop {i - 1} ({binding.did}) permits max_delegation_hops=" f"{binding.max_delegation_hops}; chain needs depth {i} at {chain[i].did}" ) return recomputed_depth # Incident replay: root generous (5), gateway narrow (1), leaf at depth 3. incident_chain = [ Hop("did:a2a:orgA:root", max_delegation_hops=5), Hop("did:a2a:orgB:gw", max_delegation_hops=1), Hop("did:a2a:orgB:tenant7:orch", max_delegation_hops=5), Hop("did:a2a:orgB:tenant7:sub:research", max_delegation_hops=5), ] # The naive endpoint check the incident verifier used: assert incident_chain[-1].max_delegation_hops >= 3 # passes; this is the bug # The correct fold rejects, naming the gateway as the binding hop: try: verify_delegation_chain(incident_chain, declared_leaf_depth=3) except DelegationDepthExceeded as e: assert "did:a2a:orgB:gw" in str(e) ```