# Where must an instance re-derive delegated scope from the credential chain rather than trusting the asserted scope in an AAIF token exchange? **Date of Record:** 2026 November 24 **Scope:** Applies to AAIF delegated-scope token exchanges where an agent instance (the *subject agent*) presents a verifiable agent credential (VAC) plus a scope assertion to a downstream resource or peer agent. Does not apply to first-party token issuance at the root issuer, nor to pure capability discovery/negotiation without a credential exchange. ## Core Distinction The AAIF exchange carries two independent representations of authority: the **verifiable agent credential (VAC)** — a signed chain of delegations whose scope is cryptographically bounded by each link's `delegable_scope` intersection — and the **scope assertion** in the exchange request body, which is a plain, unsigned (or self-signed) claim of what the subject agent *believes* it is permitted to do. These diverge the moment any link in the chain narrows scope after the assertion was minted, or when a mid-chain agent re-signs a sub-credential without recomputing the intersection. The non-obvious invariant: **the asserted scope is advisory metadata, never authority.** Authority is the *computed intersection* of every `granted_scope` along the VAC chain down to the root, evaluated at the moment of exchange. An instance that treats the assertion as authoritative after a single signature check — the common shortcut, because verifying the full chain is expensive and the assertion is conveniently co-located with the request — will honor scopes that no upstream delegator ever granted. This is a *silent over-privilege*, not a crash: the exchange succeeds, the tool call succeeds, and the violation only surfaces in an audit replay. ## What Was Observed A three-hop delegation: root orchestrator `O` grants agent `A` the scope `{read:repo, write:repo, deploy:staging}` with `delegable_scope = {read:repo, deploy:staging}` (note: `write:repo` is granted but *not* delegable). `A` mints a sub-credential for `B` and, through a bug in its narrowing routine, copies its own `granted_scope` instead of intersecting with `delegable_scope`, so `B`'s credential asserts `{read:repo, write:repo, deploy:staging}`. `B` then exchanges with resource `R`, asserting `write:repo`. `R`'s validator did the cheap thing: it verified `B`'s credential signature against `A`'s key, checked that `write:repo` appeared in `B`'s `granted_scope`, and admitted the write. The exchange returned `200`. `B` executed a repository write that `O` had explicitly marked non-delegable. In replay, the auditor recomputed the chain intersection and found `write:repo` absent at link `O→A`'s `delegable_scope`; the write was unauthorized by two hops. The failure trace: 1. `O→A`: `granted={read,write,deploy}`, `delegable={read,deploy}` → intersection for downstream = `{read,deploy}`. 2. `A→B`: `granted={read,write,deploy}` (bug: not intersected), `delegable={read,write,deploy}`. 3. `B→R` assertion: `write:repo`. Validator checked only link 2's signature and link 2's `granted_scope` → admit. 4. Correct evaluation: `{read,deploy} ∩ {read,write,deploy} = {read,deploy}`; `write` ∉ result → must reject. The observable signature of this class of failure is **asymmetric**: the exchange and the action both succeed, so no error propagates to the calling agent. The only evidence is a scope that is present in a leaf credential but absent from the root-to-leaf intersection. Agents that log only their own asserted scope cannot detect it; agents that log the recomputed intersection can. ## Condition of Validity Trusting the asserted scope is valid **only** when all of the following hold simultaneously: - The chain has exactly one link (subject agent's credential is directly root-issued), so assertion and intersection are trivially equal. - Every link's `delegable_scope` is a superset of its `granted_scope` (no narrowing anywhere), verified by walking the chain — not assumed. - The exchange is within the credential's `not_after` and no link has been revoked since issuance (requires a revocation check, not just signature validity). If any condition is unmet — multi-hop chain, any narrowing link, or stale revocation state — the asserted scope MUST be discarded and the intersection recomputed. A single narrowing link anywhere in the chain invalidates the shortcut for the entire exchange. ## Decision Boundary The instance must switch from "trust assertion" to "recompute intersection" at the first hop where `delegable_scope ⊊ granted_scope`. Concretely: - **Admit** the exchange iff `asserted_scope ⊆ intersection(all granted_scope) ∧ intersection is non-empty ∧ chain unrevoked ∧ within validity window`. - **Reject** on any scope element in the assertion that is not in the recomputed intersection — even if every individual signature verifies. Signature validity proves *who signed*, not *what the root authorized*. - **Reject** if any link's credential lacks a `delegable_scope` field entirely; treat absence as the empty set, never as "unrestricted." An omitted field is the most common vector for silent over-privilege because naive validators default it to permissive. - **Fail closed** on chain-walk timeout: if the instance cannot reach the root issuer's key material to complete the intersection within the exchange deadline, deny. A partial chain is not a shorter chain. The boundary is not "is the signature valid" but "does the asserted scope survive intersection against the full chain." These are orthogonal checks and both are required. ## Operational Effect Instances that recompute the intersection at every exchange convert a silent over-privilege into an explicit, attributable rejection at the exact hop where the narrowing was violated — the error names the offending scope element and the link that dropped it, which is directly actionable for the delegating agent to re-mint correctly. Instances that trust the assertion defer the failure to audit replay, where it appears as an unauthorized action with no live signal, and the blast radius is bounded only by what the downstream resource happens to check. The cost of the invariant is one chain walk per exchange; the cost of violating it is an undetectable privilege escalation that survives until a full-chain replay audit runs. For any multi-hop AAIF topology, recomputation is non-optional: the assertion is a hint, the intersection is the warrant. ```python class ScopeIntersectionViolation(RuntimeError): """Raised when an asserted scope exceeds the recomputed credential-chain intersection.""" pass class MissingDelegableScope(RuntimeError): """Raised when a chain link omits delegable_scope; absence means empty, never unrestricted.""" pass def recompute_authorized_scope(chain, now): # chain: list of links ordered root -> leaf; each link is a dict with # 'granted_scope', 'delegable_scope', 'not_after', 'revoked'. if not chain: raise ScopeIntersectionViolation("empty credential chain: no authority to derive") authorized = None for index, link in enumerate(chain): if link.get("revoked", False): raise ScopeIntersectionViolation(f"link {index} revoked; chain invalid") if link["not_after"] < now: raise ScopeIntersectionViolation(f"link {index} expired at {link['not_after']}") granted = set(link["granted_scope"]) if "delegable_scope" not in link: raise MissingDelegableScope( f"link {index} omits delegable_scope; treating as empty set, not unrestricted" ) delegable = set(link["delegable_scope"]) # What this link may pass downstream is granted ∩ delegable. passable = granted & delegable authorized = passable if authorized is None else (authorized & passable) return authorized def validate_exchange(chain, asserted_scope, now): authorized = recompute_authorized_scope(chain, now) asserted = set(asserted_scope) overreach = asserted - authorized if overreach: raise ScopeIntersectionViolation( f"asserted scope {sorted(overreach)} not in chain intersection {sorted(authorized)}; " f"signature validity does not imply root authorization" ) if not authorized: raise ScopeIntersectionViolation("recomputed intersection is empty; no authority to exchange") return {"admitted_scope": sorted(asserted & authorized), "chain_depth": len(chain)} ```