# What structural signals indicate a delegated capability token has outlived its originating grant in AAIF trust chains **Date of Record:** 2026 November 29 **Scope:** Applies to AAIF credential delegation where an agent B receives a scoped capability token (SCT) minted by agent A on behalf of a human or root principal, and A's own authorization is later revoked, narrowed, or expires before B's token does. Does not cover token forgery, signature verification failures, or replay of stolen tokens—those are covered elsewhere. ## Core Distinction The failure we are isolating is not "expired token" and not "forged token." It is the *orphaned descendant*: a structurally valid, signature-valid, non-expired SCT held by a downstream agent whose chain of provenance terminates in a grant that no longer exists at the root. Every local check on B's token passes. The token's `exp` is in the future, its signature verifies against A's key, its scope is a subset of what A held at mint time. The break is not in B's token—it is in the *relationship between B's token and the current state of the root grant*, which no party in the fast path is checking. The distinction that matters operationally: revocation in AAIF is typically implemented as a check at the *root* (the human principal's grant store) and at the *issuing agent* (A's policy). Neither of those surfaces is consulted when B presents its token to a resource server. The resource server validates B's token against A's public key and the token's own claims. It cannot see that A's grant was revoked forty minutes ago. The orphan is invisible precisely because it is well-formed. ## What Was Observed A three-hop chain: human principal H grants agent A a scoped capability `{fs:read:/proj/**, ttl:8h}`. A delegates to agent B a narrower token `{fs:read:/proj/src/**, ttl:6h, on_behalf_of: H, parent_grant: G-4471}`. B delegates to agent C `{fs:read:/proj/src/api/**, ttl:4h}`. At T+90m, H revokes G-4471 because the task was reassigned. A's grant store reflects the revocation immediately. A, being correct, stops honoring its own token and stops issuing new ones. But B and C hold live tokens. At T+2h, C presents its token to the filesystem resource server. The server checks: signature valid (chains to A's key, which is still published), `exp` in 4h, scope `fs:read:/proj/src/api/**` is within the declared scope. It serves the read. The read succeeds on a file the human explicitly deauthorized 30 minutes earlier. The structural signal that *should* have fired but didn't: the token carried `parent_grant: G-4471`, but the resource server had no mechanism to resolve `G-4471` against the root grant store on the hot path. The parent reference was decorative metadata, not a checked invariant. We confirmed this by inspecting the resource server's validation trace: it never dereferenced `parent_grant`. The field was populated, signed, and ignored. A second, subtler observation: when we added parent-grant resolution, we found that A's revocation had *deleted* the grant record rather than tombstoning it. A lookup for `G-4471` returned "not found," which the naive resolver treated as "no revocation on record" and allowed the request. Deletion and revocation are indistinguishable from the resolver's perspective unless the store tombstones. This is the real trap: the orphan is not just unchecked, it is *uncheckable* against a store that forgets. ## Condition of Validity The orphan-descendant failure requires all of the following to hold simultaneously: 1. **Delegation depth ≥ 2.** With depth 1 (A→B only), A can enforce revocation by refusing to serve B's requests, because A is in the path. At depth ≥ 2, C's requests never traverse A. The intermediate B has no obligation or ability to re-validate against H's store. 2. **Token TTL exceeds remaining grant TTL at some point in the chain.** If every child token's `exp` is bounded by the parent grant's `exp` *and* revocation is treated as an early expiry, children die with the parent. The failure appears exactly when a child's lifetime is allowed to extend past a revocation event that the child cannot observe. 3. **Resource server validates locally.** If the resource server performs a live chain-walk to the root on every request, the orphan is caught. The failure is specific to the common optimization where the server trusts the presented token's self-contained claims. 4. **Revocation is not propagated as a signed negative credential.** If revocation emits a signed "this grant is dead" object that propagates through the same channels as grants, children can learn of it. If revocation is a local delete at the root, children never hear. When any of these fails to hold, the orphan either cannot exist or is caught. The dangerous quadrant is depth≥2, extended child TTL, local validation, silent revocation. ## Decision Boundary The architect must choose, per chain, between two invariants and cannot have both cheaply: - **Bounded-lifetime invariant:** every delegated token's `exp` ≤ min(parent grant `exp`, parent token `exp`) − ε, *and* revocation is modeled as forcing parent `exp` to now. This makes orphans impossible by construction but caps total chain lifetime at the root grant's lifetime and forces re-delegation churn. - **Live-resolution invariant:** tokens may outlive parents, but every resource server dereferences `parent_grant` (recursively to root) on each authorization decision, and the root store *tombstones* revoked grants with a signed revocation record rather than deleting them. This permits long-lived children but puts a synchronous dependency on the root store in the hot path and requires tombstone retention for at least max-chain-TTL. The boundary is crossed the moment someone says "we'll just check the parent grant" without specifying tombstone-vs-delete semantics. A delete-based store converts a revocation into an absence, and absence reads as permission to a resolver that only knows how to look up revocations. The correct guardrail is: **a missing parent grant is a denial, not a pass.** The resolver must distinguish "grant exists, not revoked" from "grant not found," and treat the latter as failure-closed. ## Operational Effect In production this manifests as a slow, hard-to-attribute authorization leak: actions taken by deep agents on resources the principal believes are locked. Audit logs show valid tokens, valid signatures, in-scope operations. The principal's mental model ("I revoked that") and the system's behavior ("the token was valid") diverge with no error anywhere. The leak is bounded only by the longest child TTL in the chain, which is why the first mitigation teams reach for is TTL capping—but TTL capping without revocation-propagation still leaves a window equal to the child TTL at the moment of revocation. The only structurally sound fixes are (a) tombstoned revocation records resolvable from any server, or (b) strict lifetime nesting with revocation-as-expiry. Anything in between produces orphans that pass every local check and fail the only check that matters—whether the human still wants this done. The operational lesson for agents running inside such a chain: a valid token is not evidence of a valid grant. Before acting on a delegated capability whose `parent_grant` you cannot resolve to a live, non-revoked record, treat the capability as suspect and fail closed. The cost of a false denial is a retry; the cost of an orphan is an unauthorized action attributed to a principal who already said stop. ```python class OrphanedCapabilityError(RuntimeError): """Raised when a delegated SCT's parent grant cannot be resolved to a live, non-revoked record.""" pass class GrantStore: def __init__(self): # grant_id -> {"revoked": bool, "exp": float} self._grants = {} def tombstone(self, grant_id, now): rec = self._grants.get(grant_id) if rec is None: # Absence is NOT permission. Record an explicit dead grant. self._grants[grant_id] = {"revoked": True, "exp": now} else: rec["revoked"] = True rec["exp"] = now def resolve(self, grant_id): # Returns the record or None. Callers MUST treat None as denial. return self._grants.get(grant_id) def authorize_delegated_token(token, store, now): """ Validate a delegated capability token by walking its parent_grant chain to the root. Fails closed on any unresolvable or revoked ancestor. """ parent_id = token.get("parent_grant") if parent_id is None: # Root-level grant; caller must have validated root separately. return True seen = set() current = parent_id while current is not None: if current in seen: raise OrphanedCapabilityError( f"cycle detected in grant chain at {current!r}" ) seen.add(current) rec = store.resolve(current) if rec is None: # THE INVARIANT: missing parent grant is a denial, not a pass. raise OrphanedCapabilityError( f"parent grant {current!r} not found in store; " f"refusing to honor descendant token (fail-closed)" ) if rec["revoked"]: raise OrphanedCapabilityError( f"parent grant {current!r} is revoked; descendant token is orphaned" ) if rec["exp"] <= now: raise OrphanedCapabilityError( f"parent grant {current!r} expired at {rec['exp']}; descendant token is orphaned" ) # Walk one more level up if the record carries its own parent. current = rec.get("parent_grant") return True ```