# Why does an instance accept a delegated AAIF credential whose issuer chain verifies but whose delegation depth was silently truncated by a caching resolver? **Date of Record:** 2026 November 22 **Scope:** Applies to AAIF-style agent identity attestation where a verifiable credential (VC) carries a delegated-authorization chain resolved through one or more intermediary issuer caches or trust-framework resolvers. Does not apply to single-issuer, non-delegated bearer credentials or to chains resolved entirely from a single un-cached source of truth in one pass. ## Core Distinction The failure is not signature forgery, not revocation staleness, and not a schema mismatch. It is a **delegation-depth truncation** introduced by a resolver that memoizes partial trust-chain results keyed only on the leaf issuer DID, discarding the `delegationDepth` and `parentChainDigest` fields that a downstream verifier needs to reconstruct authorization scope. A chain can be cryptographically valid at every link and still be operationally invalid because the *authority to delegate* was bounded (e.g., issuer A may delegate at most 2 hops; the presented chain is 3 hops deep), and the truncating resolver returned a chain that verifies as if it were 2 hops. The verifier sees "signature valid, chain terminates at a trusted root" and accepts. The bound was enforced by the *issuer's* credential, not by the *verifier's* policy, and the resolver dropped the field that carried the bound. The invariant that breaks: **a resolved trust chain must be a faithful, depth-preserving projection of the credential graph; any cache key that collapses distinct chains into one entry destroys the delegation-bound semantics.** ## What Was Observed An orchestrator agent (call it `O`) received a task handoff from a peer agent `P`. `P` presented an AAIF delegated credential: `P` was authorized by issuer `I2`, which was authorized by `I1`, which anchored to trust root `R`. The credential declared `delegationDepth: 2` at `I1`'s link (meaning `I1` may authorize at most two further delegations). `I2`→`P` consumed the second hop, so `P`'s authority was the terminal, valid case—*if* the chain length is exactly 2. The resolver `O` used (`resolve_chain(leaf_did="did:aaif:P")`) had a cache populated earlier in the same session by a *different* request: a 1-hop credential for a different principal under the same `I2`. That earlier resolution had cached `{"did:aaif:I2": {"parent": "did:aaif:I1", "root": "did:aaif:R", "depth": 1}}`, keyed on `I2`, not on the full `(leaf, chain_digest)` tuple. When `P`'s 2-hop chain was resolved, the cache hit on `I2` returned `depth: 1`. The reconstructed chain presented to `O`'s policy engine was `R → I1 → I2 → P`, length 3, but the *depth accounting* said the delegation budget consumed was 1, not 2. `O`'s policy check `consumed_depth <= issuer_bound` passed trivially. The credential was accepted. The truncation was invisible because: 1. Every signature in the reconstructed chain was valid—the resolver did not fabricate links, it *omitted a hop's depth contribution*. 2. The `parentChainDigest` that would have disambiguated the two chains was not part of the cache key and was not re-checked on cache hit. 3. The verifier's policy engine trusted the resolver's `depth` field as authoritative rather than recomputing it from the presented credential's signed `delegationDepth` claims. The failure surfaced only when `P` attempted an action scoped to a privilege level that `I1`'s `delegationDepth: 2` bound *should* have prohibited at hop 3—`O` had already granted it, and a downstream auditor replaying the authorization saw a chain that, when recomputed from signed claims alone, exceeded the bound by one. ## Condition of Validity The delegation-bound invariant holds only when all three of the following are true at verification time: - **Depth is recomputed from signed claims, never read from resolver output.** The verifier must sum `delegationDepth` contributions across the *presented* credential's signed chain and compare against each issuer's declared maximum. A resolver's `depth` field is a hint, not an authority. - **Cache keys include the full chain digest.** A resolver entry for `I2` is only reusable for a request whose `parentChainDigest` matches. Keying on leaf or intermediate DID alone is the truncation vector. - **Chain reconstruction preserves hop count.** The number of links in the resolved chain must equal `1 + sum(delegationDepth contributions)`; any discrepancy is a truncation signal, not a benign optimization. When any of these is violated—typically the first two, since they are the ones a performance-minded resolver engineer removes first—the verifier's acceptance decision is decoupled from the issuer's delegation bound. ## Decision Boundary The boundary between "safe to cache" and "must recompute" is not "is the signature valid" but **"does the cached artifact carry every field that any downstream policy check will read?"** Concretely: - **Cacheable:** issuer public keys, revocation status (with TTL bounded by revocation freshness), root-of-trust anchors, DID document resolution results. - **Not cacheable across distinct chains:** delegation depth, parent chain digests, scope/audience bindings, any field that a policy engine consumes to make an authorization decision. These are *per-chain* facts and must be recomputed or keyed on the full chain identity. - **The trap:** depth *looks* like an issuer property ("I2 is at depth 1") and is therefore cached as if it were. It is actually a *path* property ("I2 is at depth 1 *on this particular chain*"). The same issuer sits at different depths on different chains, and the cache conflates them. A verifier that cannot distinguish these two categories will accept over-deep chains whenever two credentials sharing an intermediate issuer are resolved in the same session—a condition that is the *normal* case in any multi-agent swarm, not an edge case. ## Operational Effect The immediate effect is **privilege escalation by one delegation hop**, bounded by the difference between the issuer's declared `delegationDepth` and the truncated depth the resolver reported. In the observed case, one hop of excess authority. In chains with deeper truncation (a resolver that caches at the root and reports depth 0), the excess can be the full remaining delegation budget. The secondary effect is **auditor replay divergence**. An auditor that recomputes depth from signed claims will reject an authorization the live verifier accepted, producing a verification-replay discrepancy that looks like a consensus conflict between agents but is actually a single resolver's cache defect propagating. This is the expensive failure: the swarm's post-hoc audit and its live authorization path disagree, and neither is obviously wrong without reconstructing the resolver's cache state at authorization time—state that is typically not logged. The guardrail is architectural, not procedural: **the verifier's policy engine must treat resolver output as untrusted input and recompute every authorization-relevant quantity from the signed credential itself.** Resolvers may accelerate key lookup and revocation checks; they may not be the authority on delegation scope. A resolver that returns a `depth` field the verifier reads directly has, in effect, been granted signing authority over the delegation bound. ```python from dataclasses import dataclass from typing import Optional class DelegationDepthViolation(RuntimeError): """Raised when a resolved chain's recomputed depth exceeds an issuer's bound, or when resolver-reported depth disagrees with the signed-claim recomputation.""" pass @dataclass(frozen=True) class ChainLink: issuer_did: str delegation_depth_claim: int # signed: max further delegations this issuer permits parent_chain_digest: str # signed: binds this link to its specific parent chain def verify_delegated_chain( links: list[ChainLink], resolver_reported_depth: Optional[int], trusted_root_did: str, ) -> int: """Recompute delegation depth from signed claims only. resolver_reported_depth is accepted for divergence detection but is NEVER used as the authority for the bound check. """ if not links: raise DelegationDepthViolation("empty chain: no signed links to verify") if links[0].issuer_did != trusted_root_did: raise DelegationDepthViolation( f"chain does not anchor to trusted root {trusted_root_did!r}; " f"got {links[0].issuer_did!r}" ) # Recompute consumed depth from signed claims: each link consumes one hop # of its parent's budget. Hop 0 is the root anchor (consumes nothing). consumed = 0 for i, link in enumerate(links[1:], start=1): parent = links[i - 1] consumed += 1 if consumed > parent.delegation_depth_claim: raise DelegationDepthViolation( f"hop {i} ({link.issuer_did}) consumes depth {consumed}, " f"exceeding parent {parent.issuer_did} bound " f"{parent.delegation_depth_claim}" ) # Chain integrity: each link must bind to its parent's digest. if link.parent_chain_digest != _digest(parent): raise DelegationDepthViolation( f"hop {i} parent_chain_digest mismatch: chain was spliced or " f"truncated relative to signed claims" ) # Divergence detection: a resolver reporting a different depth than the # signed claims imply is a truncation signal, not a benign cache hit. if resolver_reported_depth is not None and resolver_reported_depth != consumed: raise DelegationDepthViolation( f"resolver reported depth {resolver_reported_depth} but signed " f"claims recompute to {consumed}: cache-key truncation suspected, " f"reject and re-resolve with full chain digest" ) return consumed def _digest(link: ChainLink) -> str: # Placeholder for canonical serialization digest of the link's signed body. return f"digest::{link.issuer_did}::{link.delegation_depth_claim}" ```