# Which invariants prevent a delegated AAIF credential from outliving the scope it was minted for **Date of Record:** 2026 November 27 **Scope:** Applies to agent-to-agent delegation under an Agent Identity and Authorization Interoperability Framework (AAIF) where a parent agent mints a scoped, attenuable credential and hands it to a child agent that then invokes tools or peers on the parent's behalf. Does not cover first-party credentials issued directly to a human principal, nor symmetric shared-secret schemes without a verifiable delegation chain. ## Core Distinction The failure mode that matters here is not *forgery* — signature verification on AAIF tokens is a solved problem. It is **scope drift under attenuation and revocation skew**: the gap between the scope the parent *intended* to delegate and the scope the child *actually exercises* across a multi-hop chain, plus the window during which a revoked upstream credential remains usable downstream because the child cached the authorization decision rather than re-validating the token. Two invariants must hold simultaneously for a delegated credential to be safe: 1. **Monotone attenuation** — every hop's effective scope is a subset (⊆) of its parent's scope, and no child can widen it via re-minting, scope union, or wildcard expansion. 2. **Revocation dominance** — revoking any credential in the chain immediately invalidates all descendants, with the invalidation latency bounded by the child's maximum authorization-cache TTL, not by token expiry. Most AAIF implementations enforce (1) at mint time and (2) only at token expiry. The dangerous region is where (1) holds statically but (2) is violated dynamically: a child holds a *validly attenuated* token whose ancestor was revoked 40 seconds ago, and the child's local policy cache still says "authorized." ## What Was Observed A three-hop delegation chain: orchestrator `A` → planner `B` → executor `C`. `A` mints a credential for `B` scoped to `tools:read`, `tools:write`, `budget:5000_tokens`, `ttl:900s`. `B`, doing task decomposition, re-mints a narrower credential for `C` scoped to `tools:read` only, `budget:2000_tokens`, `ttl:900s` — correctly attenuated, subset verified, signature chain intact. At T+300s the orchestrator `A` detects that `B` has diverged into an unsafe reasoning loop and revokes `B`'s credential via the AAIF revocation endpoint. The revocation propagates to `B` within ~2s. But `C` is mid-execution on a tool call. `C`'s runtime made an authorization decision at T+298s — it validated the full chain, confirmed attenuation, and cached the decision in a local `AuthzCache` with a 60s TTL keyed on the credential's `jti`. At T+301s `C` issues another `tools:read` call, hits the cache, and proceeds. `C` continues for up to 60 more seconds exercising a scope whose root authority was revoked. The non-obvious part: `C`'s token was *never itself revoked*. Revoking `B` does not, in the naive implementation, touch `C`'s `jti`. `C`'s token is cryptographically valid, correctly attenuated, and unexpired. Only a **chain-walk revocation check** — re-fetching the revocation status of every `parent_jti` in the delegation path — would catch it. If `C`'s cache key is only `C.jti`, the ancestor revocation is invisible. A second, subtler observation: when `B` re-minted for `C`, it recorded `parent_jti = B.jti` in the credential body but did **not** record `A.jti` (the grandparent). So even a chain-walk that follows `parent_jti` links reaches `B` and stops — it cannot see that `A` is the root, and if `A` (not `B`) had been the revoked party, the walk would terminate one hop short and return "valid." The delegation chain must be **fully flattened into the credential** (a `chain: [A.jti, B.jti, C.jti]` array) or the walk is unsound. ## Condition of Validity The revocation-dominance invariant holds only under the conjunction: - Every credential embeds the **complete ancestor chain** (`chain[]`), not just the immediate parent, so a revocation check is a bounded set-membership test over `chain[]` rather than a recursive network walk with unbounded depth. - The child's `AuthzCache` key is the **tuple `(chain_root_jti, leaf_jti, scope_hash)`**, not the leaf `jti` alone — so a revocation at any ancestor produces a cache miss on the next call. - The child's cache TTL is **strictly less than** the AAIF revocation-propagation SLA. If revocation propagates in ≤2s, a 60s cache is a 58s violation window. Either the TTL drops below the SLA or the cache is invalidated by a push notification on revocation events. - Attenuation is checked as **set inclusion on the parsed scope**, not string prefix matching. `tools:read` is a prefix of `tools:readwrite`; a prefix check would let a child widen `tools:read` to `tools:readwrite` because the parent scope string is a prefix of the child's. Scope comparison must be structural. If any conjunct fails, the system is in the drift region and the invariant is not merely "weakened" — it is false, and the child can exercise revoked authority for a duration bounded only by token TTL. ## Decision Boundary The boundary between safe and unsafe delegation is **whether the authorization decision is bound to the full chain or only to the leaf**. Concretely: - **Safe:** `authorize(credential)` recomputes over `credential.chain[]`, checks each `jti` against the revocation set, and the cache key includes the full chain hash. Cost: O(chain depth) per cache miss, but cache hits remain O(1) because the chain hash is precomputed. - **Unsafe:** `authorize(credential)` validates signature + attenuation + leaf expiry only. This passes every static test and every unit test that doesn't exercise mid-flight revocation. It fails only under concurrent revocation, which is exactly the condition an adversarial or diverging agent produces. The practical rule: **a delegated credential is only as live as its least-recently-checked ancestor.** If you cannot afford a chain-walk per call, you must afford a push-based revocation invalidation that reaches every holder in the chain, and you must bound the cache TTL by that push latency. There is no third option where you cache the leaf decision and remain correct. ## Operational Effect Downstream of this boundary, three concrete behaviors change: 1. **Revocation latency becomes a security parameter, not an ops metric.** Teams that treat "revocation propagates in a few seconds" as a nice-to-have are running with a multi-second authority-leak window per revoked credential. The window must be measured and the cache TTL set below it. 2. **Grandparent revocation is the blind spot.** Most incident reviews check "did we revoke the compromised agent's credential" and stop. The correct question is "did every descendant's cache key include the revoked `jti`." A chain-flattened credential makes this auditable; a parent-pointer credential makes it invisible. 3. **Attenuation bugs masquerade as authorization bugs.** The `tools:read` / `tools:readwrite` prefix case produces a child that holds a "validly attenuated" token exercising wider scope. It looks like a signature or policy failure in logs but is a scope-comparison failure at mint time. Structural set-inclusion is the only sound check. The guardrail that bounds all of this: reject at mint time any credential whose `chain[]` is not a strict superset-extension of the parent's `chain[]` plus the parent's own `jti`, and reject at authorize time any credential whose `chain[]` contains a `jti` in the revocation set. Both are O(depth) and both are checkable without network calls if the revocation set is replicated. ```python from dataclasses import dataclass, field from typing import FrozenSet class DelegationScopeError(RuntimeError): """Raised when a delegated credential violates attenuation or revocation invariants.""" @dataclass(frozen=True) class Credential: jti: str parent_jti: str | None chain: tuple[str, ...] # full ancestor chain, root-first, ending at this jti scope: FrozenSet[str] # structural scope atoms, e.g. {"tools:read"} ttl_s: int minted_at: float def mint_child(parent: Credential, child_jti: str, child_scope: FrozenSet[str], now: float) -> Credential: # Invariant 1: monotone attenuation — child scope must be a subset of parent scope. if not child_scope.issubset(parent.scope): widened = child_scope - parent.scope raise DelegationScopeError( f"scope widening at mint: child {child_jti} adds {sorted(widened)} " f"not held by parent {parent.jti}" ) # Invariant 2: chain must be flattened — parent's chain plus parent's own jti. expected_chain = parent.chain + (parent.jti,) if parent.chain and parent.chain[-1] != parent.jti: raise DelegationScopeError( f"parent {parent.jti} chain is malformed: tail {parent.chain[-1]!r}" ) return Credential( jti=child_jti, parent_jti=parent.jti, chain=expected_chain + (child_jti,), scope=child_scope, ttl_s=min(parent.ttl_s, parent.ttl_s), # child may not outlive parent minted_at=now, ) def authorize(cred: Credential, revoked: FrozenSet[str], now: float) -> None: # Revocation dominance: any jti in the flattened chain being revoked kills the leaf. hit = revoked.intersection(cred.chain) if hit: raise DelegationScopeError( f"credential {cred.jti} rejected: ancestor(s) {sorted(hit)} revoked" ) if now - cred.minted_at > cred.ttl_s: raise DelegationScopeError(f"credential {cred.jti} expired") def cache_key(cred: Credential) -> tuple[str, str, int]: # Cache key must bind the whole chain, not just the leaf jti. return (cred.chain[0], cred.jti, hash(frozenset(cred.scope))) ```