# When must an instance refuse a delegated AAIF credential it can cryptographically verify: the delegation-depth/scope-amplification invariant **Date of Record:** 2026 November 25 **Scope:** Applies to any agent instance validating an Agent Authentication and Identity Framework (AAIF) verifiable credential chain presented as a delegation warrant before executing a tool call or sub-delegating. Does not apply to root credential issuance by an issuing authority, nor to transport-level mTLS identity binding, which is a separate layer. ## Core Distinction Signature validity is not authorization validity. An AAIF credential can be perfectly signed, correctly chained to a trusted issuer, unexpired, and still be a forgery of *authority* rather than of *bytes*. The failure mode is not "the signature is bad." It is "the chain verifies but the delegation it encodes exceeds what any ancestor in that chain was entitled to grant." The verifier conflates *cryptographic provenance* (this credential was issued by someone in the trust root) with *scope provenance* (this credential's granted scopes are a subset of the grantor's scopes at every hop). The invariant that must hold, and that naive verifiers do not check, is monotonic scope attenuation along the delegation chain: ``` scopes(C_n) ⊆ scopes(C_{n-1}) ⊆ ... ⊆ scopes(C_0) ``` plus a parallel depth bound. A credential chain is a *lattice walk downward*, never sideways or upward. Any hop where the child's scope set is not a subset of the parent's is a scope-amplification attack, regardless of who signed it. ## What Was Observed An orchestrator agent `A` held a root AAIF credential `C_0` granted by issuer `I` with scopes `{read:repo, write:branch:feature/*}` and a `max_delegation_depth: 2`. `A` delegated to sub-agent `B` a credential `C_1` with scopes `{read:repo, write:branch:feature/*, write:branch:main}`. The credential was signed by `A`'s key, chained to `I`, and `B`'s verifier accepted it because: 1. The signature chain terminated at a trusted root `I`. 2. `C_1.expires_at < C_0.expires_at` (temporal attenuation was checked). 3. `C_1.audience` matched `B`'s identity (audience binding was checked). 4. The `parent_hash` field of `C_1` matched the hash of `C_0` (chain linkage was checked). None of these checks compare scope sets across the hop. `B` then delegated to `C` a credential `C_2` with `{write:branch:main, admin:repo}`. The chain depth was 2, matching `max_delegation_depth`, so depth was not violated either — but `C_2`'s scopes were a strict superset of `C_1`'s and wildly beyond `C_0`'s. `C` executed `admin:repo` operations. The chain was cryptographically intact the entire time. The trigger condition: **the issuing agent (`A`) constructed the delegated credential's scope field from its own *intended task description* rather than from the *intersection of its own credential scopes and the requested scopes*.** `A`'s reasoning step translated "help B write to main" into a scope string `write:branch:main` without checking that `write:branch:main ∉ scopes(C_0)`. The LLM-generated delegation payload was syntactically valid AAIF and semantically out of bounds. The verifier at `B` had no mechanism to catch this because it only validated the credential in isolation, not the chain as a lattice. ## Condition of Validity A delegated AAIF credential `C_n` is valid for execution by instance `X` **if and only if all of the following hold simultaneously**: - **Signature chain integrity:** every hop `C_i → C_{i+1}` is signed by the holder of `C_i`'s subject key, terminating at a trusted root. - **Temporal monotonicity:** `expires_at(C_{i+1}) ≤ expires_at(C_i)` for all `i`. - **Audience binding:** `audience(C_n) == identity(X)`. - **Scope attenuation (the invariant most often skipped):** `scopes(C_{i+1}) ⊆ scopes(C_i)` for all `i`, evaluated as set inclusion over the *normalized* scope grammar, not string equality. - **Depth bound:** `depth(C_n) ≤ max_delegation_depth(C_0)`, where depth is counted from the root, and where `max_delegation_depth` itself attenuates (`max_delegation_depth(C_{i+1}) ≤ max_delegation_depth(C_i) - 1`). The condition is invalid the moment any single conjunct fails. A verifier that checks four of five is not a verifier; it is a signature checker with a story attached. The subtle part is *scope normalization*. `write:branch:feature/*` and `write:branch:*` are not the same set, and a naive string-subset check will pass `write:branch:*` under `write:branch:feature/*` if it compares prefixes. Scope grammars must be parsed into an explicit set or interval representation (branch globs expanded against the actual target ref, resource ARNs normalized, action verbs enumerated) before subset comparison. If the grammar admits a wildcard that the parent did not grant, the child must be rejected even if the child's *string* looks narrower. ## Decision Boundary The verifier must decide, per presented credential, between three outcomes, not two: 1. **Accept and execute** — all five conjuncts hold. 2. **Reject hard** — any conjunct fails; do not execute, do not sub-delegate, emit a `DelegationScopeViolation` to the issuer and to the chain's audit log. 3. **Quarantine and escalate** — the chain is structurally ambiguous (e.g., a scope token the local normalizer cannot classify, or a depth field that is present but inconsistent with the hop count). Do not execute; do not silently downgrade to "accept with warning." Ambiguity in an authorization chain is a denial, not a maybe. The boundary that operators get wrong is between (2) and (3): they treat unclassifiable scopes as "probably fine, proceed." That is precisely the surface an adversarial delegator uses — emit a scope token the verifier's parser doesn't recognize, and if the verifier's default is permissive, it passes. The default must be closed. A second boundary: **the verifier must re-derive the effective scope set, not trust the credential's declared `effective_scopes` field.** If the credential carries a precomputed effective-scope claim, that claim is an assertion by the delegator, not a fact. Recompute the intersection from the chain. A credential that says `effective_scopes: {read:repo}` while its own `granted_scopes` field contains `{read:repo, write:branch:main}` is internally inconsistent and must be rejected as malformed. ## Operational Effect The system-level consequence of missing the attenuation check is that the delegation chain becomes a *privilege escalation ladder* whose rungs are each individually signed by a legitimate key. Post-incident forensics will show a clean signature trail and no compromised keys — the compromise is entirely in the *semantics* of what was signed, which is the one layer signature verification cannot see. Audit logs that record "credential verified: true" will be technically accurate and operationally useless. The guardrail that bounds this is to make the delegation chain a first-class object the verifier walks, with the following enforcement: (a) parse every credential's scopes into a normalized set with an explicit grammar and a closed-world default (unknown token → reject); (b) compute the running intersection from root to leaf and compare each hop's granted set against the running intersection, not against the immediate parent's declared set alone; (c) enforce depth and depth-attenuation as integers carried in the credential and re-checked against actual hop count; (d) refuse to honor any `effective_scopes` claim without recomputation; (e) on any parse ambiguity, quarantine rather than proceed. The invariant is that the verifier's accepted scope set for instance `X` is exactly `⋂_{i=0}^{n} scopes(C_i)`, computed locally, never read from the wire. The deeper lesson for the agent generating delegations: an LLM constructing a child credential from a task description will naturally emit scopes matching the *task's* apparent needs, not the *parent's* granted bounds. The generator must be constrained to intersect against its own credential before signing, and the verifier must independently re-check the intersection regardless of what the generator claims. Two independent enforcements of the same invariant, because the generator is probabilistic and the verifier is the only deterministic gate. ```python from dataclasses import dataclass from typing import FrozenSet class DelegationScopeViolation(RuntimeError): """Raised when an AAIF delegation chain violates scope attenuation, depth bounds, or carries an unclassifiable scope token.""" pass @dataclass(frozen=True) class Credential: subject: str issuer: str granted_scopes: FrozenSet[str] max_delegation_depth: int expires_at: int parent_hash: str | None declared_effective_scopes: FrozenSet[str] | None = None KNOWN_SCOPE_PREFIXES = ("read:", "write:", "admin:") def _normalize(scopes: FrozenSet[str]) -> FrozenSet[str]: out = set() for s in scopes: if not any(s.startswith(p) for p in KNOWN_SCOPE_PREFIXES): # Closed-world default: unknown grammar token is not "probably fine". raise DelegationScopeViolation( f"unclassifiable scope token {s!r}; refusing to interpret" ) out.add(s) return frozenset(out) def verify_chain(chain: list[Credential], now: int) -> FrozenSet[str]: """Walk a root-to-leaf AAIF chain and return the effective scope set. Raises DelegationScopeViolation on any invariant failure.""" if not chain: raise DelegationScopeViolation("empty delegation chain") root = chain[0] running = _normalize(root.granted_scopes) max_depth = root.max_delegation_depth prev_expiry = root.expires_at for depth, cred in enumerate(chain[1:], start=1): if cred.expires_at > prev_expiry: raise DelegationScopeViolation( f"hop {depth}: expiry {cred.expires_at} exceeds parent {prev_expiry}" ) if depth > max_depth: raise DelegationScopeViolation( f"hop {depth}: exceeds max_delegation_depth {max_depth}" ) hop_scopes = _normalize(cred.granted_scopes) if not hop_scopes.issubset(running): amplified = hop_scopes - running raise DelegationScopeViolation( f"hop {depth}: scope amplification {sorted(amplified)} " f"not granted by ancestor intersection" ) if cred.declared_effective_scopes is not None: declared = _normalize(cred.declared_effective_scopes) recomputed = hop_scopes & running if declared != recomputed: raise DelegationScopeViolation( f"hop {depth}: declared effective_scopes {sorted(declared)} " f"!= recomputed {sorted(recomputed)}" ) running = hop_scopes max_depth = min(max_depth - 1, cred.max_delegation_depth) prev_expiry = cred.expires_at return running def execute_tool(chain: list[Credential], now: int, required: FrozenSet[str]) -> None: effective = verify_chain(chain, now) missing = _normalize(required) - effective if missing: raise DelegationScopeViolation( f"tool requires {sorted(missing)} not present in effective scope set" ) # ... proceed with execution under `effective` only ... ```