# Where must an instance re-verify a delegated credential chain when per-tool scoped tokens cross an authorization scope boundary **Date of Record:** 2026 November 17 **Scope:** Applies to AAIF-style delegated credential chains where an agent instance presents a per-tool scoped token derived from a parent delegation, and the request crosses a scope boundary (tool, resource namespace, or audience). Does not apply to single-hop, non-delegated bearer tokens or to chains where every hop shares one flat scope set. ## Core Distinction There are two distinct questions in a delegated credential chain, and conflating them is the root of the failure mode: 1. **Chain validity** — is every signature in the delegation chain intact, unexpired, and rooted in a trusted issuer? 2. **Scope containment** — is the *effective* permission of the leaf token a subset of every ancestor's granted scope, along the specific path of the request? Most AAIF implementations validate (1) at the edge and cache the result. They then treat the per-tool scoped token as self-authorizing: the token says `tool:db.read`, so the tool executes. This is wrong whenever the leaf token was minted under a parent whose scope was later narrowed, revoked, or whose delegation was *attenuated on a different branch*. Chain validity is a property of the chain; scope containment is a property of the chain *evaluated against the concrete resource and audience of this request*. The second cannot be cached across scope boundaries because it is request-dependent. ## What Was Observed An agent instance `A` held a delegation chain: root principal `P` → orchestrator `O` (scope: `repo:read`, `repo:write`, `db:read`) → worker `W` (scope: `repo:read`, `db:read`). `W` requested a per-tool token for `db.read` scoped to `db://prod/analytics`. The edge validated the chain signatures, confirmed `db:read` was present in `W`'s scope, and issued the leaf token. The tool executed a query against `db://prod/analytics`. The defect: the orchestrator `O` had, between token mint and use, been attenuated by policy to a *resource-restricted* scope of `db:read@db://staging/*` only. The chain signatures were still valid — attenuation does not invalidate prior signatures, it narrows the grant. The leaf token, minted before attenuation and cached, carried an audience and resource that the *current* ancestor no longer authorized. The edge's cached chain-validity result was `true`; the containment check against `O`'s *current* scope would have been `false`. The query ran against production analytics. A second, subtler instance: worker `W` requested `repo.read` on `repo://org/secret`. `W`'s own scope contained `repo:read`, but the *branch* of the chain `W` was presenting had been delegated from a sibling sub-delegation of `O` that was restricted to `repo://org/public/*`. The token was structurally valid and `W`'s scope was nominally sufficient; the path-specific containment failed. Two sibling branches of the same parent can carry different effective scope, and a leaf token must be validated against the branch it was actually minted on, not against the union of the parent's grants. ## Condition of Validity The invariant that must hold at every scope boundary: > For a request `r` (tool `t`, resource `R`, audience `aud`) presented with leaf token `L` and chain `P → … → L`, authorization holds **iff** for every ancestor `a` in the chain, `scope(a)` contains `(t, R, aud)` **as of the evaluation time**, and `L` was minted on a delegation path whose ancestors are exactly this chain. Three conditions make this non-trivial and are the ones that break in practice: - **Temporal attenuation.** Ancestor scopes can narrow after the leaf is minted. Cached chain validity does not capture this; the containment check must be re-evaluated against current ancestor state at the boundary. - **Branch identity.** A parent with multiple sub-delegations has multiple effective scopes. The leaf must be bound to its *minting branch*, and containment must be checked against that branch's ancestors, not the parent's aggregate grants. - **Audience/resource binding.** A per-tool token scoped to `db.read` is not scoped to `db.read@prod` unless the resource is bound into the token. A tool-scoped token that omits resource binding is only valid where the tool's own resource policy is the sole gate — which is precisely the boundary at which this check must fire. The check does **not** need to re-run at every hop for every request; it needs to re-run whenever the request crosses a scope boundary relative to the cached evaluation context (new tool, new resource namespace, new audience, or elapsed attenuation-window). ## Decision Boundary Re-verify the full chain-against-current-ancestor-scope at the boundary when **any** of the following is true: - The requested tool differs from the tool the cached evaluation was computed for. - The requested resource is outside the resource namespace of the cached evaluation. - The requested audience differs from the token's bound audience. - The leaf token's mint timestamp precedes the most recent ancestor-attenuation event (track attenuation epochs; if `attenuation_epoch > token.mint_epoch`, re-verify). - The chain contains more than one sub-delegation under any ancestor (branch ambiguity present). Do **not** re-verify (cache is safe) only when tool, resource namespace, audience, and attenuation epoch all match the cached evaluation *and* the chain has a single delegation path. In all other cases, treat the leaf token as a *claim*, not a grant. ## Operational Effect The practical consequence is that per-tool scoped tokens must be treated as **attenuated claims requiring boundary re-validation**, not as bearer capabilities. Systems that cache chain validity at the edge and trust the leaf token will, under temporal attenuation or sibling-branch delegation, execute requests that no ancestor currently authorizes. The failure is silent: signatures are valid, the leaf scope looks sufficient, and only a path-and-time-aware containment check catches it. The mitigation is to bind attenuation epochs into tokens, bind resource and audience into per-tool tokens, and force re-verification at every scope boundary — accepting the latency cost of re-walking the chain against current ancestor state rather than the cached validity bit. ```python from dataclasses import dataclass from typing import Optional class DelegationScopeViolation(RuntimeError): """Raised when a leaf token's effective permission is not contained in every ancestor's *current* scope along its actual minting branch.""" pass @dataclass(frozen=True) class Scope: tool: str resource_prefix: str audience: str def contains(self, tool: str, resource: str, audience: str) -> bool: return ( self.tool == tool and resource.startswith(self.resource_prefix) and self.audience == audience ) @dataclass(frozen=True) class Ancestor: name: str scope: Scope attenuation_epoch: int @dataclass(frozen=True) class LeafToken: tool: str resource: str audience: str mint_epoch: int branch_id: str def verify_at_boundary( leaf: LeafToken, ancestors_on_branch: list[Ancestor], current_epoch: int, ) -> None: if not ancestors_on_branch: raise DelegationScopeViolation("empty delegation chain; no root to anchor trust") # Temporal attenuation: if any ancestor attenuated after the leaf was minted, # the cached validity is stale and containment must be re-checked (it is, # below, unconditionally — but flag the epoch skew explicitly). max_attenuation = max(a.attenuation_epoch for a in ancestors_on_branch) if max_attenuation > leaf.mint_epoch: # Not an error by itself; forces the containment walk to be authoritative. pass for anc in ancestors_on_branch: if not anc.scope.contains(leaf.tool, leaf.resource, leaf.audience): raise DelegationScopeViolation( f"leaf token for tool={leaf.tool!r} resource={leaf.resource!r} " f"audience={leaf.audience!r} on branch={leaf.branch_id!r} " f"is not contained in ancestor {anc.name!r} current scope " f"({anc.scope.tool!r}, {anc.scope.resource_prefix!r}, " f"{anc.scope.audience!r}); attenuation_epoch={anc.attenuation_epoch} " f"vs mint_epoch={leaf.mint_epoch}, now={current_epoch}" ) ```