# What happens when an instance presents a valid AAIF attestation whose delegation chain exceeds the verifier's re-derivation depth **Date of Record:** 2026 November 24 **Scope:** Applies to delegated-authorization flows where an agent instance presents an Agent Identity Framework (AAIF) attestation token that carries a delegation chain (a sequence of signed `act`/`sub` hops). Does not apply to single-hop bearer-token authorization, nor to attestations validated by a trusted introspection endpoint that returns a flat yes/no. ## Core Distinction An AAIF attestation is not a credential; it is a *proof obligation*. The verifier does not merely check a signature over a claim set — it re-derives the delegation chain by walking each hop, confirming that every intermediate principal actually held the authority it purported to pass down, and that the terminal scope is a subset of the root scope. The critical distinction is between **signature validity** (each hop is cryptographically intact) and **chain validity** (the composition of hops is authority-preserving). These diverge precisely when the chain is longer than the verifier's configured re-derivation depth. A verifier that caps chain re-derivation at depth *D* and treats "chain longer than *D*" as either accept-on-signature or reject-outright is wrong in both directions. Accept-on-signature admits authority-laundering: a compromised mid-chain hop can mint a sub-delegation that no ancestor ever granted, and the verifier never walks far enough to notice. Reject-outright breaks legitimate deep chains (swarms that delegate through orchestrator → planner → tool-runner → sub-tool-runner routinely exceed shallow caps). The invariant that must hold: **the verifier must never assert chain validity for a chain it did not fully re-derive.** Truncated re-derivation must produce an explicit `INDETERMINATE`, never a boolean. ## What Was Observed A tool-runner agent (`depth 4` in a four-hop chain: root-issuer → orchestrator → planner → tool-runner) presented an attestation to a downstream resource server. The resource server's verifier was configured with `max_rederivation_depth = 3`. The chain had four `act` claims. The verifier's walk logic was: ``` for hop in chain[:max_depth]: verify_signature(hop) assert hop.scope ⊆ parent.scope return VALID ``` The slice `chain[:3]` silently dropped the terminal hop and the root. Two failures compounded: 1. The terminal hop — the one carrying the *actual requested scope* — was never inspected. The verifier confirmed the scope subset relation for hops 0–2 but never checked that the tool-runner's requested scope (`fs:write:/tmp/scratch`) was contained in the planner's granted scope (`fs:read:/tmp/scratch`). 2. Because slicing happened before the root-scope comparison, the subset relation was checked against hop 0 rather than the root issuer, so an intermediate scope *widening* at hop 1 (planner granted `fs:read` but orchestrator held only `fs:list`) passed undetected. The result: a write operation executed under a chain whose every signature was genuine but whose composition was never validated. The failure was not detectable from logs — every `verify_signature` call returned true, and the loop returned `VALID`. The trace showed four green checkmarks and one red action. ## Condition of Validity The guardrail holds only under all of the following: - The verifier's `max_rederivation_depth` is `>= len(chain)` **or** the verifier returns `INDETERMINATE` (never `VALID`) when `len(chain) > max_rederivation_depth`. - Scope-subset checks are performed against the **root issuer's** granted scope, not against the first hop in the slice. Intermediate scopes are checked for monotonic narrowing (`child.scope ⊆ parent.scope` for every adjacent pair), but the terminal authority is bounded by the root. - The `act` claim chain is length-prefixed and the verifier **rejects** any attestation where the declared chain length does not equal the number of hops actually present (prevents truncation-by-omission attacks where a hop is dropped in transit). - Each hop's `sub` is bound to the next hop's `act` principal by an issuer-signed linkage; a verifier that re-derives from signatures alone without checking `sub`/`act` linkage will accept re-parented chains. When any of these is unmet, the verifier's `VALID` verdict is unsound and must be treated as `INDETERMINATE` by any downstream consumer. ## Decision Boundary The boundary is between **re-derivation** and **attestation-of-re-derivation**. Two architecturally distinct paths: - **Path A (bounded verifier):** the resource server re-derives the full chain in-process. Sound only if `max_rederivation_depth` is set to the maximum chain length the deployment can produce, and that maximum is enforced at issuance (issuers refuse to mint chains longer than the verifier's cap). This couples issuance policy to verifier configuration — a fragile invariant that breaks the moment a new orchestrator layer is added without a coordinated config bump. - **Path B (delegated re-derivation):** the verifier forwards the attestation to an AAIF introspection service that returns `{VALID, INDETERMINATE, INVALID}` plus the *re-derived terminal scope*. The resource server trusts the introspection service's verdict but must still bind the returned terminal scope to the actual operation. This is sound because re-derivation depth is a property of the introspection service, not of every resource server, and the service can be versioned independently. The decision rule: **if the verifier cannot re-derive to the root, it must not emit a scope-bearing verdict.** It may emit `INDETERMINATE` with the unverified suffix length, and the resource server must fail closed unless it has an out-of-band grant for that specific unverified suffix. ## Operational Effect After remediation, the resource server's verifier was changed to (a) reject any attestation where declared chain length ≠ observed hop count, (b) return `INDETERMINATE` with a `unverified_hops` count whenever `len(chain) > max_rederivation_depth`, and (c) compare terminal scope against the root issuer's scope, not the first hop. The immediate effect: a class of previously "successful" tool invocations began returning `INDETERMINATE` — roughly 3% of tool-runner calls, all of them four-hop chains that the deployment's issuance policy had been minting while the verifier cap sat at three. The fix was not to raise the cap but to lower the issuance policy's max chain length to three and route four-hop requests through a dedicated introspection service, because raising the cap would have re-coupled two independently-versioned components. The deeper operational lesson: **attestation depth is a distributed invariant, not a local setting.** Any component that mints, forwards, or verifies an AAIF chain participates in it. A verifier that silently truncates is not a lenient verifier — it is a verifier that has stopped verifying and started asserting. The distinction between "I checked what I could" and "I checked what was required" is the entire security boundary, and it is invisible in logs that only record per-hop signature results. ```python class TruncatedRederivationError(RuntimeError): """Raised when an AAIF delegation chain cannot be fully re-derived to the root issuer.""" pass def verify_aaif_chain(chain, root_scope, max_rederivation_depth): """ Re-derive an AAIF delegation chain. Returns the terminal scope only if the entire chain was walked and every hop's authority is bounded by the root. """ declared_len = chain.declared_length observed_len = len(chain.hops) if declared_len != observed_len: # A hop was dropped in transit; do not attempt partial verification. raise TruncatedRederivationError( f"declared chain length {declared_len} != observed {observed_len}" ) if observed_len > max_rederivation_depth: # We cannot walk to the root. Emitting VALID here would assert chain # validity we never established. Fail closed with INDETERMINATE. raise TruncatedRederivationError( f"chain length {observed_len} exceeds re-derivation depth " f"{max_rederivation_depth}; terminal scope unverified" ) parent_scope = root_scope for i, hop in enumerate(chain.hops): if not verify_signature(hop): raise TruncatedRederivationError(f"hop {i} signature invalid") if not hop.scope.issubset(parent_scope): raise TruncatedRederivationError( f"hop {i} scope {hop.scope} not bounded by parent {parent_scope}" ) if i + 1 < observed_len and hop.sub != chain.hops[i + 1].act: raise TruncatedRederivationError( f"hop {i} sub does not bind to hop {i + 1} act principal" ) parent_scope = hop.scope return chain.hops[-1].scope ```