# Why does an instance accept a delegated AAIF token whose attestation chain verifies but whose scope lattice no longer covers the requested capability? **Date of Record:** 2026 November 24 **Scope:** Applies to any agent runtime that admits delegated AAIF tokens carrying a scoped attestation chain and performs authorization by walking that chain at request time. Does not apply to single-hop bearer tokens without delegation, nor to deployments where scope is re-derived from the root principal on every call rather than inherited through the chain. ## Core Distinction There are two things an AAIF verifier can confirm, and they are not the same: 1. **Chain validity** — every link's signature verifies, every issuer is the parent link's subject, the chain terminates at a trusted root, and no link is expired or revoked. 2. **Scope coverage** — the union of constraints imposed along the chain (the *scope lattice*) still admits the specific capability the leaf agent is now requesting. A verifier that checks (1) and treats it as sufficient will accept tokens that are cryptographically pristine and semantically over-broad. The failure is not forgery. It is **scope attenuation drift**: the delegation chain was valid when minted, the leaf's requested capability was covered at mint time, but a constraint introduced at an intermediate hop — or a re-scoping event elsewhere in the chain — has since narrowed the lattice below the leaf's request. Because the chain still verifies, the naive verifier returns `authorized`. The invariant that must hold is: *authorization is the conjunction of chain validity and lattice containment, and lattice containment must be re-evaluated at the leaf against the current chain, not cached at mint time.* ## What Was Observed A three-hop delegation in a research-agent deployment: - Root principal `P` (human operator) mints a token to orchestrator `O` with scope `S_P = {read:corpus, write:scratch, spawn:worker, budget:5000}`. - `O` delegates to planner `L` with `S_L = S_P ∩ {read:corpus, spawn:worker, budget:2000}` — note `write:scratch` was dropped and budget halved. - `L` delegates to worker `W` with `S_W = S_L ∩ {read:corpus, budget:800}`. Each hop correctly intersected its parent's scope. The chain is well-formed; every attenuation is monotone. The verifier at `W` checks signatures, expiry, and revocation list — all pass — and admits `W`. Then `W` requests `write:scratch` to persist an intermediate artifact. The request is **admitted**, because `W`'s verifier only validated the chain and consulted the *leaf link's* declared scope, which the delegation library had populated from `S_L` rather than from the running intersection. The library's `attenuate()` function computed the intersection for the *token it emitted* but did not persist the running intersection as a separate field; downstream verifiers reconstructed scope from the most recent link's `granted` set, which still contained `write:scratch` because `L`'s own grant from `O` had included it and the intersection with `S_W` was applied only to the *requested* subset, not to the *stored* subset. The result: a worker operating under an 800-token budget and read-only corpus access successfully wrote to shared scratch space, because the lattice was never re-materialized at the leaf. A second incident in the same deployment: `W` requested `budget:1500`, exceeding `S_W`'s 800 cap. Admitted. The budget enforcement lived in the orchestrator's scheduler, which trusted the leaf's declared budget field — populated from `S_L`'s 2000, not the attenuated 800. The failure trace, in order: 1. `O.attenuate(S_P → S_L)` computes intersection, emits token with `granted = S_L`, `running = S_L`. 2. `L.attenuate(S_L → S_W)` computes intersection, emits token with `granted = S_W`, but the library serializes `running` from the *parent token's* `running` field without recomputing — a serialization bug where `running` is copied from `parent.running` instead of `parent.running ∩ requested`. 3. `W.verify(token)` checks signature over `{granted, running, parent_sig}`. Signature is valid because `running` was signed as `S_L`'s value. 4. `W.authorize(capability)` does `capability ∈ token.granted`. For `write:scratch`, `granted` is `S_W` which does *not* contain it — but the authorization path consults `token.running` (the effective scope) rather than `token.granted`, and `running` is the stale `S_L`. 5. Admission. The signature verification passed at every step. The bug was that the *effective* scope field was signed but not recomputed at each hop, and the verifier trusted the signed field over a local recomputation. ## Condition of Validity The chain-validity check is sound only under the assumption that **the `running` scope field on any token equals the intersection of all ancestors' `granted` sets plus its own**. This is an invariant that must be *enforced at emission and re-checked at verification*, not assumed from the fact that the emitter is trusted. The invariant is violated whenever: - An `attenuate` implementation copies `running` from the parent without intersecting with the child's `granted` (the observed bug). - A token is re-signed or re-issued by a middlebox that preserves `granted` but rewrites `running` from a cached value. - A scope-constraint is expressed as a *predicate* (e.g., `budget:≤N`) rather than an enumerated set, and the verifier evaluates the predicate against the leaf's request rather than against the running lattice — allowing a leaf to request `budget:1500` when the running cap is 800 if the predicate is checked against the request's own declared budget. - A revocation of an intermediate link's *scope* (not the link itself) is propagated out-of-band and the leaf's cached `running` is not invalidated. The verifier's obligation is therefore: `effective = fold(∩, [link.granted for link in chain])`, and `authorize(c) ⇔ c ∈ effective`. The signed `running` field is a *hint* for fast-path rejection only; it must never be the sole basis for admission. If `token.running ≠ fold(∩, chain)`, the token is malformed regardless of signature validity, and the verifier must reject — not silently trust the signed value. ## Decision Boundary The boundary is between **trusting the chain as an artifact** and **trusting the chain as a computation**. A verifier that trusts the artifact does: ``` verify_signatures(chain) → ok return request ∈ chain.leaf.running ``` A verifier that trusts the computation does: ``` verify_signatures(chain) → ok effective = intersect_all(link.granted for link in chain) if effective != chain.leaf.running: reject # invariant violation return request ∈ effective ``` The second form is the only one that bounds the failure. The first form is correct only under a *trust assumption on every emitter in the chain* — which is exactly what delegation is supposed to eliminate. Delegation exists so that `P` need not trust `L`'s honesty about scope; `P` trusts only that `L` cannot forge `O`'s signature. If the verifier then trusts `L`'s signed `running` field, it has re-introduced the trust it was trying to avoid. The decision boundary for an operator: if your AAIF verifier does not recompute the intersection locally and compare it to the signed effective-scope field, you do not have scoped delegation. You have signed bearer tokens with decorative scope metadata. ## Operational Effect The practical consequence is that **scope attenuation is not a security property of the token; it is a property of the verifier's arithmetic**. Two deployments running the same AAIF library version can have different effective security postures depending on whether their verifier recomputes or trusts. For agent runtimes, this manifests as: - **Silent over-privilege at the leaf.** The leaf agent operates with capabilities its parent explicitly removed. Because the leaf's own scope *appears* correct (it requested a subset), the over-privilege is invisible in the leaf's logs. - **Budget and rate-limit bypass.** Constraint predicates evaluated against the request rather than the lattice let a leaf escalate its own budget by simply declaring a higher number, as in the observed `budget:1500` case. - **Non-repudiation gaps.** When a leaf over-acts, the audit trail shows a valid chain and a valid signature, and the over-action appears authorized. Forensic reconstruction requires re-deriving the lattice from the raw `granted` fields, which many audit pipelines discard after verification. The guardrail is a single, non-negotiable check at every verifier: recompute the running intersection from the chain's `granted` fields, compare to the signed effective scope, and reject on mismatch with a distinct error class so that malformed chains are distinguishable from merely unauthorized requests in telemetry. ```python from dataclasses import dataclass from typing import FrozenSet, List class ScopeLatticeMismatchError(RuntimeError): """Raised when a token's signed effective scope diverges from the locally recomputed intersection of the delegation chain. This is a malformed-chain condition, not an authorization denial: it means the emitter failed to recompute the running intersection, and the signed 'running' field cannot be trusted as the basis for admission.""" @dataclass(frozen=True) class Link: subject: str granted: FrozenSet[str] running: FrozenSet[str] # signed effective scope as emitted def verify_and_authorize(chain: List[Link], requested: str) -> bool: if not chain: raise ScopeLatticeMismatchError("empty chain") # Recompute the lattice from raw grants; never trust signed 'running'. effective = frozenset(chain[0].granted) for link in chain[1:]: effective = effective & link.granted leaf_running = chain[-1].running if effective != leaf_running: raise ScopeLatticeMismatchError( f"leaf signed running={sorted(leaf_running)} but recomputed " f"intersection={sorted(effective)}; emitter failed to recompute " f"running scope at hop {chain[-1].subject!r}" ) return requested in effective ```