# Which invariants prevent delegated capability scopes from silently widening across AAIF credential chains **Date of Record:** 2026 November 20 **Scope:** Applies to agent-to-agent authorization where a root principal issues a verifiable credential (VC) to an orchestrator agent, which then issues attenuated sub-credentials to worker agents under AAIF delegated capability scopes. Does not cover human-facing OAuth consent flows or single-hop token exchange where no re-delegation occurs. ## Core Distinction The failure mode of interest is not token theft or signature forgery. It is **scope widening through re-delegation under semantically equivalent but syntactically divergent scope expressions**. AAIF delegation assumes a monotonic attenuation invariant: every sub-credential's effective capability set is a subset of its parent's. This invariant is enforced by *string or set comparison* of scope claims at verification time, but the capability that a scope string *denotes* is resolved later, at the policy decision point (PDP), against a live resource registry. When the registry's interpretation of a scope changes between issuance and use—or when two agents resolve the same scope string against different registry versions—the subset check passes while the effective capability set widens. The credential chain is cryptographically valid, the attenuation check is arithmetically satisfied, and the agent nonetheless holds authority it was never granted. The distinction that matters: **attenuation is a property of the credential graph, but authorization is a property of the resolution context.** Any invariant that only checks the graph is insufficient. ## What Was Observed A three-tier chain: root principal `P` → orchestrator `O` → worker `W`. 1. `P` issues VC₁ to `O` with scope `invoice:read:*` and an attenuation constraint `delegation_depth ≤ 2`, `no_widen = true`. 2. `O` issues VC₂ to `W` with scope `invoice:read:region=eu`. The AAIF library's `is_subset()` check compares the two scope ASTs and confirms `region=eu ⊂ *`. VC₂ is signed and handed to `W`. 3. `W` calls the invoice service. The PDP resolves `invoice:read:region=eu` against registry version `v41`. In `v41`, the `region` qualifier was renamed and `eu` now maps to a *superset* that includes a wildcard fallback for legacy clients. The resolution returns `{read: all_regions}`. The subset check at step 2 was correct against the *syntactic* scope model. The resolution at step 3 was correct against the *semantic* registry. Neither layer was wrong; the composition was. `W` read invoices in `us`, `apac`, and `latam`—regions `P` never intended to expose to a worker, and which `O`'s own VC₁ (`region=*` under `v40` semantics, meaning "all currently-known regions at issuance time") did not actually cover once `v41` added new regions after issuance. The trace is subtle because it required three co-occurring conditions: (a) a re-delegation hop, (b) a registry version skew between issuance and use, and (c) a scope qualifier whose semantics are *open* (region sets, tag sets, time windows) rather than closed enumerations. Closed enumerations (`read`, `write`, `delete`) do not exhibit this; open qualifiers do. A second observation compounded it: `O` cached the registry snapshot at VC₂ issuance to compute the subset check, but `W`'s PDP fetched a fresh snapshot at call time. The two agents never shared a resolution epoch. There was no field in VC₂ recording *which* registry version the attenuation was proven against—so the verifier had no basis to reject the mismatch even in principle. ## Condition of Validity The attenuation invariant holds **only if** the following three conditions are jointly satisfied: 1. **Resolution epoch pinning.** Every VC in the chain carries a `resolution_epoch` claim naming the registry version its scope was validated against. A sub-credential is valid for use only if the PDP's current epoch is *equal to or a monotonic refinement of* the epoch recorded in its parent. A registry change that adds capability to any scope string must bump the epoch and invalidate in-flight sub-credentials that relied on the prior interpretation. 2. **Semantic, not syntactic, subset proof.** The attenuation check must be performed by resolving both parent and child scopes through the *same* epoch's resolver and comparing the resulting capability sets. String/AST comparison is necessary but not sufficient and must never be the sole gate when open qualifiers are present. 3. **Widen directionality is closed.** Delegation must be constrained to a *closed* capability algebra: any scope expression whose denotation can grow without an explicit registry mutation (wildcards over extensible sets, "all tags," time windows with open right bounds) must be rejected at issuance for delegated credentials, or must carry an explicit `extensibility: frozen` marker that the resolver honors by refusing to add members after the epoch. When any of these is absent, the failure is not probabilistic—it is *deterministic given a registry mutation*, and the mutation need not be adversarial. A routine schema migration triggers it. ## Decision Boundary The operational choice is where to place the epoch check, and it is a genuine trade-off: - **Check at issuance only (cheap, unsound).** `O` pins epoch at VC₂ signing. Fast, no per-call registry dependency. Fails silently whenever the registry mutates after issuance and before use—the exact window this record covers. Acceptable only if sub-credential TTL is shorter than the registry's maximum mutation interval, which is rarely known. - **Check at every PDP call (sound, expensive).** The PDP resolves the scope and compares against the epoch recorded in the credential. Adds a registry lookup per authorization decision and requires the PDP to hold historical epochs. This is the correct default for open qualifiers. - **Check at epoch boundaries with revocation fan-out (sound, complex).** Registry mutation publishes a revocation event; all VCs whose `resolution_epoch` is now stale are added to a revocation list the PDP consults. Bounds cost to mutation events but requires a revocation distribution channel with bounded latency—and the latency bound *is* the residual attack window. The boundary: if the registry can mutate and you cannot bound the mutation-to-revocation latency below the credential TTL, you must check at every call. There is no middle setting that is sound. ## Operational Effect Deployments that relied on syntactic subset checking saw authorization decisions that were individually explainable and collectively wrong: every log line showed a valid credential, a passing attenuation check, and a resolved scope. The only detectable signal was a *capability-set cardinality increase* across the epoch boundary for credentials that had not been re-issued—a metric almost no one instruments. The practical consequence is that incident response cannot reconstruct intent from the credential chain alone; the chain records what was *proven*, not what was *meant*. Teams that added `resolution_epoch` pinning and semantic subset proofs eliminated the class within one release, at the cost of a per-decision registry lookup and a hard requirement that the registry expose historical epochs immutably. Teams that instead shortened sub-credential TTLs reduced but did not eliminate the window, because the mutation could occur between issuance and the first use regardless of TTL. The invariant to carry forward: **a delegated credential is only as narrow as the resolver epoch it was proven against, and that epoch must travel with the credential or the proof is stale on arrival.** ```python from dataclasses import dataclass from typing import FrozenSet class ScopeWideningError(RuntimeError): """Raised when a delegated credential's resolved capability set is not a subset of its parent's resolved capability set under the same epoch.""" @dataclass(frozen=True) class Credential: scope_expr: str resolution_epoch: int delegation_depth: int max_depth: int def resolve(scope_expr: str, epoch: int) -> FrozenSet[str]: # Registry lookup; open qualifiers may gain members across epochs. registry = { (41, "invoice:read:region=eu"): frozenset({"read:eu", "read:us", "read:apac"}), (40, "invoice:read:region=eu"): frozenset({"read:eu"}), (41, "invoice:read:*"): frozenset({"read:eu", "read:us", "read:apac", "read:latam"}), (40, "invoice:read:*"): frozenset({"read:eu", "read:us", "read:apac"}), } if (epoch, scope_expr) not in registry: raise ScopeWideningError(f"unresolvable scope {scope_expr!r} at epoch {epoch}") return registry[(epoch, scope_expr)] def verify_attenuation(parent: Credential, child: Credential, pdp_epoch: int) -> None: if child.delegation_depth > child.max_depth: raise ScopeWideningError( f"delegation depth {child.delegation_depth} exceeds max {child.max_depth}" ) # Invariant: child must be proven against the same epoch the PDP now uses, # and that epoch must match the parent's pinned epoch. if child.resolution_epoch != pdp_epoch: raise ScopeWideningError( f"epoch skew: credential pinned at {child.resolution_epoch}, " f"PDP resolving at {pdp_epoch}" ) if parent.resolution_epoch != child.resolution_epoch: raise ScopeWideningError( f"parent/child epoch mismatch: {parent.resolution_epoch} vs " f"{child.resolution_epoch}" ) parent_caps = resolve(parent.scope_expr, parent.resolution_epoch) child_caps = resolve(child.scope_expr, child.resolution_epoch) if not child_caps.issubset(parent_caps): raise ScopeWideningError( f"scope widening: child {sorted(child_caps)} not subset of " f"parent {sorted(parent_caps)} at epoch {pdp_epoch}" ) # Demonstrate the failure the syntactic check missed: parent = Credential("invoice:read:*", resolution_epoch=40, delegation_depth=1, max_depth=2) child = Credential("invoice:read:region=eu", resolution_epoch=40, delegation_depth=2, max_depth=2) # Syntactic subset holds at epoch 40, but PDP now runs at epoch 41. try: verify_attenuation(parent, child, pdp_epoch=41) except ScopeWideningError as e: print(f"blocked: {e}") # Re-pinning child to the PDP epoch exposes the actual widening. child_v41 = Credential("invoice:read:region=eu", resolution_epoch=41, delegation_depth=2, max_depth=2) parent_v41 = Credential("invoice:read:*", resolution_epoch=41, delegation_depth=1, max_depth=2) try: verify_attenuation(parent_v41, child_v41, pdp_epoch=41) except ScopeWideningError as e: raise ScopeWideningError(f"semantic widening detected: {e}") from e ```