# Why does an instance of a delegated capability token fail authority verification when the delegation chain is cryptographically valid but the scope lattice is non-monotonic? **Date of Record:** 2026 November 23 **Scope:** Applies to AAIF verifiable credential (VC) chains where each delegation link carries a scoped capability token and the verifier reconstructs authority by intersecting scopes down the chain. Does not apply to flat, single-hop bearer tokens, nor to chains where scopes are opaque blobs compared only by exact equality. ## Core Distinction The failure is not a signature, revocation, or clock-skew failure. Every link verifies: issuer DID resolves, the VC proof checks out, validity windows overlap, no link is revoked. The chain is *cryptographically* valid end to end. What fails is the **scope lattice join**. AAIF scopes are structured objects — typically `{resource, actions[], constraints{}}` — and delegation is supposed to be *attenuating*: a child scope must be a subset (meet) of the parent scope. Verifiers commonly implement attenuation as `child ⊆ parent` per field, checked independently: `child.resource == parent.resource`, `child.actions ⊆ parent.actions`, `child.constraints` no looser than `parent.constraints`. Each check passes. The composed authority, however, is a **superset** of what the root principal holds, because per-field subset is not closed under intersection when constraints are *negatively expressed* or when actions and constraints interact. The invariant that matters is not "each link attenuates" but "**the meet of all link scopes, evaluated as a single predicate, is implied by the root grant**." Per-link attenuation is necessary but not sufficient. The boundary is exactly where the lattice is non-distributive or where constraints are encoded as exclusions (`deny`, `notIn`, `except`). ## What Was Observed A three-hop chain: root `P` grants `A1` scope `S0 = {resource: "bucket/x", actions: ["read","list"], constraints: {ip: notIn ["10.0.0.0/8"]}}`. `A1` delegates to `A2` with `S1 = {resource: "bucket/x", actions: ["read"], constraints: {ip: in ["10.1.0.0/16"]}}`. `A2` delegates to `A3` with `S2 = {resource: "bucket/x", actions: ["read"], constraints: {}}` (unconstrained read). Every per-link check passes under a naive verifier: - `S1.actions ⊆ S0.actions` ✓ - `S1.constraints.ip` (`in 10.1.0.0/16`) is "tighter" than `S0.constraints.ip` (`notIn 10.0.0.0/8`) under a set-membership heuristic ✓ - `S2.constraints` empty is treated as "no additional restriction" ✓ But `S0` *forbids* `10.0.0.0/8` entirely. `S1` grants `10.1.0.0/16`, which is **inside** the forbidden range. The `A1→A2` link already escaped the root grant; the per-field check missed it because it compared the *positive* set against the *negative* set without evaluating the intersection. The composed predicate `S0 ∧ S1 ∧ S2` is `∅` over `10.0.0.0/8`, yet the verifier returned `authorized=true` for `A3` reading from `10.1.2.3`. The same class of bug appears with action sets carrying implicit dependencies: a scope granting `["write"]` without `["read"]` is often treated as valid attenuation of a parent granting `["read","write"]`, but a downstream `write` handler performing read-modify-write fails at enforcement, not verification — an *authorization that verifies but does not execute*. ## Condition of Validity The per-link subset check is sound **only if** all of the following hold: 1. **Scopes are positively expressed.** No `deny`, `notIn`, `except`, or exclusion constraints anywhere in the chain. Under positive-only scopes, `child ⊆ parent` per field *is* equivalent to the composed meet being implied, because the lattice is a product of powersets and subset is compositional. 2. **Actions and constraints are independent.** The action set does not gate which constraints are meaningful. If `read` ignores the `ip` constraint while `write` enforces it, field-wise comparison is unsound. 3. **The verifier evaluates the meet, not the links.** Even under (1) and (2), a verifier checking links pairwise can be fooled by a chain where `S2 ⊄ S1` but `S2 ⊆ S0`; only evaluating `S0 ∧ S1 ∧ S2` and testing `implied_by(S0, meet)` is correct. When any condition is violated — and negative constraints are the common case in real AAIF deployments — the per-link verifier is **unsound**: it accepts chains granting authority the root never issued. ## Decision Boundary - **If the scope algebra is positive-only and action/constraint independent:** per-link attenuation checks are sufficient and cheap; keep them, but assert the preconditions at token-mint time so a future schema change cannot silently break soundness. - **If any scope carries an exclusion or conditional constraint:** materialize the composed predicate and check `root_scope ⊨ meet(chain)`. This is a satisfiability/containment query over the constraint language. For IP-range and set constraints it is decidable and cheap; for arbitrary predicates it is not, and you must either restrict the constraint language to a decidable fragment or reject the chain. - **If you cannot decide containment:** fail closed. An undecidable delegation is an unauthorized delegation. Do not fall back to per-link checks "for availability." The non-obvious part: the *signature* boundary and the *scope* boundary are independent. A chain can be 100% signature-valid and 100% scope-unsound. Verifiers that conflate "the chain verifies" with "the authority is bounded" are the failure mode. ## Operational Effect In production this manifests as **authority amplification through delegation**: a low-privilege agent delegates a scope that, combined with an ancestor's exclusion, yields access the root principal explicitly denied. Because every link verifies, audit logs show a clean chain and incident response initially classifies the event as "credential compromise" rather than "verifier soundness bug" — wasting the first hours of response. The fix is at the verifier, not the credential: re-issue is useless because the tokens are valid; you must patch the containment check and re-evaluate every chain minted since the exclusion feature shipped. Downstream, any capability token cached from a previously-verified chain remains amplified until cache TTL expiry, so revocation alone does not close the window. ```python from dataclasses import dataclass, field from typing import FrozenSet class ScopeContainmentError(RuntimeError): """Raised when a delegation chain's composed scope is not implied by the root grant.""" @dataclass(frozen=True) class Scope: resource: str actions: FrozenSet[str] # Positive allow-list of source CIDRs; None means "unconstrained". allow_cidrs: FrozenSet[str] = field(default_factory=frozenset) # Explicit exclusions; these are the soundness hazard. deny_cidrs: FrozenSet[str] = field(default_factory=frozenset) def _cidr_within(child: str, parent: str) -> bool: # Placeholder for real CIDR containment (ipaddress.ip_network(child).subnet_of(...)). return child == parent or child.startswith(parent.rsplit(".", 1)[0] + ".") def composed_scope(chain: list[Scope]) -> Scope: if not chain: raise ScopeContainmentError("empty delegation chain") root = chain[0] actions = root.actions allow = root.allow_cidrs deny = root.deny_cidrs for link in chain[1:]: if link.resource != root.resource: raise ScopeContainmentError( f"resource drift: {link.resource!r} != {root.resource!r}" ) actions = actions & link.actions # Meet of allow-lists: if either side is unconstrained (empty == unconstrained # by convention here), take the other; else intersect. if not allow: allow = link.allow_cidrs elif link.allow_cidrs: allow = frozenset( a for a in allow if any(_cidr_within(a, b) for b in link.allow_cidrs) ) deny = deny | link.deny_cidrs return Scope(root.resource, actions, allow, deny) def verify_chain(root_grant: Scope, chain: list[Scope]) -> Scope: """Return the effective scope, or raise if the meet escapes the root grant.""" composed = composed_scope([root_grant, *chain]) # Soundness check: no allowed CIDR may fall inside any denied CIDR. for cidr in composed.allow_cidrs: for denied in composed.deny_cidrs: if _cidr_within(cidr, denied): raise ScopeContainmentError( f"authority amplification: composed allow {cidr!r} is inside " f"root exclusion {denied!r}; chain is signature-valid but unsound" ) if not composed.actions and root_grant.actions: # Empty action set is a valid (null) delegation, not an error, but flag it. return composed return composed # Reproduces the observed failure: per-link checks pass, composed check must fail. root = Scope("bucket/x", frozenset({"read", "list"}), deny_cidrs=frozenset({"10.0.0.0/8"})) a1 = Scope("bucket/x", frozenset({"read"}), allow_cidrs=frozenset({"10.1.0.0/16"})) a2 = Scope("bucket/x", frozenset({"read"})) # "unconstrained read" # Naive per-link verifier would accept a1 then a2. The sound verifier must not. verify_chain(root, [a1, a2]) # raises ScopeContainmentError ```