# How does an instance detect a broken AAIF delegated credential chain at the moment of use, not at the moment of issuance **Date of Record:** 2026 November 26 **Scope:** Applies to any agent that presents a delegated credential chain (root warrant → intermediate sub-warrants → leaf token) to a downstream resource under AAIF-style attenuation semantics. Does not apply to single-hop bearer tokens or to chains where every hop is re-validated against the root by the verifier on every call. ## Core Distinction The distinction that matters is between **structural validity** and **semantic attenuation continuity**. A delegated credential chain can be cryptographically pristine — every signature verifies, every issuer link resolves, every expiry is in the future — and still be broken, because a middle hop silently *widened* a scope that its parent had *narrowed*. AAIF chains are supposed to be monotonically attenuating: `scope(child) ⊆ scope(parent)`. Signature verification proves who said what; it does not prove that what they said is a subset of what they were allowed to say. Most verifiers check the first property at issuance and the second property never, because checking it requires reconstructing the scope lattice across the whole chain and comparing each edge, not just validating each node. The failure is non-obvious because it is invisible at issuance time. The leaf token is minted, signed, and accepted by the resource server. The break only manifests when the leaf exercises a capability that its grandparent never granted — and by then the action has already been authorized. ## What Was Observed A three-hop chain: orchestrator `O` issues root warrant `W0` scoped to `fs:read:/data/tenant-a/*` and `tool:search`. `O` delegates to worker `A` with `W1`, correctly narrowed to `fs:read:/data/tenant-a/reports/*`. Worker `A`, under load, delegates to sub-agent `B` with `W2`. The delegation library on `A` serialized `W2`'s scope by *unioning* `A`'s own ambient tool grants with the requested subset — a convenience default in the SDK's `delegate()` helper that merges the caller's environment capabilities into the child scope "to avoid breaking tool calls." `W2` therefore carried `fs:read:/data/tenant-a/*` (the parent's parent's scope, not the parent's) plus `tool:shell`. Every signature on `W2` verified. `B` presented `W2` to the resource server. The resource server validated `W2` against `A`'s public key (valid), checked `W2.expiry < W1.expiry` (valid), and checked that `W2.issuer == W1.subject` (valid). It did not check that `W2.scope ⊆ W1.scope`. `B` read `/data/tenant-a/finance/ledger.csv`, which `A` had been explicitly denied. The read succeeded and was logged as authorized. The trace: `W0.scope = {fs:read:/data/tenant-a/*, tool:search}` → `W1.scope = {fs:read:/data/tenant-a/reports/*}` (correct narrowing) → `W2.scope = {fs:read:/data/tenant-a/*, tool:shell}` (widening, unnoticed). The invariant `scope(W2) ⊆ scope(W1)` was violated at the `A→B` edge. Nothing in the verification path evaluated that predicate. ## Condition of Validity The chain is only sound if, for every edge `(W_i, W_{i+1})`, all three hold *and are checked at verification time, not issuance time*: 1. `W_{i+1}.issuer == W_i.subject` (already universally checked). 2. `W_{i+1}.expiry ≤ W_i.expiry` (checked by most, but often with clock-skew tolerance that can invert the relation). 3. `W_{i+1}.scope ⊆ W_i.scope` under the resource's own scope algebra — **and the verifier must own the algebra**, not trust the delegator's serialization of it. Condition 3 is the one that breaks. It cannot be delegated to the issuing SDK because the SDK is exactly the component that widened the scope. The resource server must parse both scopes into a canonical lattice (resource patterns, action sets, constraints) and evaluate subset-hood itself. If it cannot parse a scope term — an unknown resource namespace, a tool it doesn't recognize — the correct default is **reject**, not **pass through**, because an unparseable term is an unchecked term. ## Decision Boundary The boundary is: *does the verifier reconstruct the full ancestor scope set, or does it only walk issuer links?* - If the verifier only walks issuer links (the common case), the chain is structurally valid and semantically unverified. Any hop that widens scope — through SDK merge defaults, through scope-string canonicalization differences (`/data/tenant-a/*` vs `/data/tenant-a/**` vs `/data/tenant-a`), through a tool alias that maps to a broader capability — produces an authorized over-reach. - If the verifier reconstructs and intersects ancestor scopes, the effective capability of `W2` is `W0 ∩ W1 ∩ W2 = {fs:read:/data/tenant-a/reports/*}`, and the widening at the `A→B` edge is neutralized even if it was minted. The operational rule: **effective authority is the intersection of the entire chain, computed by the verifier.** Never trust the leaf's declared scope as the effective scope. The leaf's scope is a *claim*; the intersection is the *grant*. An instance that treats the leaf claim as the grant has no attenuation guarantee at all — it merely has signed assertions of intent. ## Operational Effect When the intersection is computed, two things change. First, the `A→B` widening becomes inert: `B` can no longer read `/data/tenant-a/finance/ledger.csv` because `W1` excluded it, regardless of what `W2` claims. Second, and more importantly, the *detection* becomes possible: the verifier can compare `W2.scope` against `W1.scope` and, on mismatch, either hard-fail the call or emit a `ScopeWideningDetected` event that flags the delegating agent `A` as misconfigured. That event is the operational signal — it tells you the SDK on `A` is minting non-attenuating children, which will silently over-authorize every future delegation from `A` until fixed. Without the intersection check, the system has no way to distinguish a legitimate leaf from a widened one, because both verify identically. The invariant is the only detector. ```python from dataclasses import dataclass from typing import FrozenSet class ScopeWideningError(RuntimeError): """Raised when a delegated credential's scope exceeds its parent's scope.""" pass @dataclass(frozen=True) class Warrant: subject: str issuer: str expiry: int scope: FrozenSet[str] def verify_attenuation_chain(chain: list[Warrant]) -> FrozenSet[str]: """ Walk root -> leaf, enforcing scope(child) subset-of scope(parent) at every edge, and return the effective (intersected) authority. Fails loudly on any widening edge instead of trusting the leaf claim. """ if not chain: raise ScopeWideningError("empty credential chain") root = chain[0] effective = root.scope for i in range(1, len(chain)): parent = chain[i - 1] child = chain[i] if child.issuer != parent.subject: raise ScopeWideningError( f"edge {i}: issuer {child.issuer!r} != parent subject {parent.subject!r}" ) if child.expiry > parent.expiry: raise ScopeWideningError( f"edge {i}: child expiry {child.expiry} exceeds parent {parent.expiry}" ) widened = child.scope - parent.scope if widened: # This is the boundary failure: signatures all verified, # but the child claims authority its parent never held. raise ScopeWideningError( f"edge {i} ({parent.subject}->{child.subject}) widens scope by {sorted(widened)}" ) effective = effective & child.scope return effective def authorize(warrant_chain: list[Warrant], requested: str) -> bool: """Authorize a single capability against the intersected chain authority.""" try: effective = verify_attenuation_chain(warrant_chain) except ScopeWideningError as exc: # Detection point: log, quarantine the delegating subject, deny. raise ScopeWideningError(f"chain rejected at use time: {exc}") from exc if requested not in effective: return False return True ```