# Where must an instance re-verify a delegated scoped token's attenuation chain when AAIF verifiable credentials cross a tool-call boundary? **Date of Record:** 2026 November 22 **Scope:** Applies to AAIF (Agent Identity and Authorization Interoperability Framework) deployments where an orchestrator agent holds a verifiable credential (VC) and mints delegated, scope-attenuated tokens for downstream tool-executor agents. Does not apply to single-instance setups where the credential holder and the tool executor share one trust domain and one process boundary. ## Core Distinction The failure that matters here is not token forgery and not signature validation. It is **attenuation-chain non-composition**: a delegated token is valid at every individual hop, yet the *conjunction* of hops grants a scope that no single issuer intended. AAIF defines delegation as a monotone attenuation — a child token's scope set must be a subset of its parent's, and the chain of `iss`/`sub`/`scope` must be walkable back to the root VC. The invariant is: > For any delegated token T with ancestor chain [T, T₁, …, T₀=root], `scope(T) ⊆ scope(T₁) ⊆ … ⊆ scope(T₀)` **and** every intermediate issuer must appear as the `sub` of its parent and the `iss` of its child, with no gap. The non-obvious boundary is that AAIF permits **scope-set intersection across orthogonal dimensions** (resource × action × time-window × delegation-depth). Attenuation is monotone per-dimension but the *cartesian product* of independently-attenuated dimensions is not preserved by naive subset checks. A child token can have `scope ⊆ parent` on every dimension checked in isolation while the composed predicate it authorizes is strictly broader than the parent's composed predicate — because the parent's dimensions were not independent (e.g., the parent's time-window was conditioned on a resource restriction that the child dropped). The practical consequence: an instance must re-verify the **full composed predicate** of the attenuation chain at the moment of tool invocation, not merely validate each token's signature and per-dimension subset at issuance. ## What Was Observed A three-tier deployment: orchestrator O (holds root VC, scope `{resource: repo:acme/*, action: read|write, window: 09:00–17:00, depth: 2}`), mid-tier planner P, tool executor X (a code-search tool). O minted a token for P with scope `{resource: repo:acme/svc-a, action: read|write, window: 09:00–17:00, depth: 1}` — a clean subset. P then minted a token for X with scope `{resource: repo:acme/svc-a, action: read, window: 00:00–23:59, depth: 0}`. Per-dimension subset check at X: - resource: `repo:acme/svc-a ⊆ repo:acme/svc-a` ✓ - action: `read ⊆ read|write` ✓ - window: `00:00–23:59 ⊇ 09:00–17:00` — **fails** the subset check if window is checked as an interval. But the AAIF reference validator checked window as a *presence* field, not an interval, and P's issuance library had a bug: it defaulted the window when the parent's window field was present-but-unparsed. So the window check passed as "present." The composed predicate at X authorized `repo:acme/svc-a` reads at 02:00. The root VC never granted that. The chain was signature-valid at every hop. The per-hop validator returned `valid: true` at both P and X. The breach was only detectable by recomposing the predicate across the chain — which no hop did, because each hop trusted its parent's already-validated token and only checked the *delta*. The trace: `O --mint--> P (valid) --mint--> X (valid) --> tool_call(repo:acme/svc-a, read, 02:00) --> ALLOWED`. The composed predicate `(resource=svc-a) ∧ (action=read) ∧ (02:00 ∈ window)` is satisfiable but not entailed by the root's `(resource=acme/*) ∧ (action∈{read,write}) ∧ (09:00–17:00)`. The gap is exactly the interval-widening at the P→X hop, masked by a presence-vs-interval validator mismatch. ## Condition of Validity The invariant holds — and re-verification at the tool boundary is *unnecessary* — only under all of: 1. **Single trust domain**: every issuer in the chain shares one AAIF trust anchor and one validator implementation, so per-hop validation is transitively sound. 2. **Per-dimension independence**: the root VC's scope dimensions are semantically independent (no dimension conditions another). If window is conditioned on resource, independence fails and composition is mandatory. 3. **Monotone validator agreement**: every hop's validator interprets each dimension identically (interval vs. presence, glob vs. literal, depth as counter vs. as boolean). The observed failure was a violation of this — P's validator treated window as presence, X's treated it as interval, and neither was wrong in isolation. 4. **No defaulting on attenuation**: the issuance library must reject, not default, any dimension it cannot parse from the parent. P's library defaulted; that is the proximate trigger. When any of these is violated, the instance must treat the chain as **non-composable** and re-verify the composed predicate at the tool boundary. The decision is per-invocation, not per-session: a chain validated at session start can become non-composable if the tool executor's validator is upgraded mid-session (mixed-version fleet). ## Decision Boundary The boundary is: **re-verify composed predicate iff the chain crosses a validator-implementation boundary or a dimension-independence boundary.** Concretely, an instance must walk the full chain and recompose when any of: - The tool executor's AAIF validator version differs from the issuer's (mixed-version fleet — the common case in rolling deploys). - Any scope dimension in the root VC is *conditioned* on another (window-on-resource, depth-on-action). Detect by schema: conditioned dimensions carry a `depends_on` field. - Any hop's token was issued by a library that defaults unparsed dimensions. Detect by presence of `defaulted: true` in the token's `issuance_meta`, or by absence of `issuance_meta` entirely (unknown-provenance tokens default to non-composable). - Delegation depth ≥ 2 (O→P→X). At depth 1 the composed predicate equals the single-hop predicate and re-verification is redundant. If none apply, per-hop validation is sound and the composed re-verification is wasted latency. The cost of the check is a chain walk of O(depth) — negligible against tool-call latency — so the asymmetry favors re-verifying when in doubt. The failure mode of over-verifying is latency; the failure mode of under-verifying is scope escalation, which is unbounded. ## Operational Effect The guardrail is a **composed-predicate gate** at the tool-executor boundary, not at the issuer. It must: 1. Walk the chain from the presented token to the root VC, asserting `sub(Tᵢ) == iss(Tᵢ₋₁)` with no gap (the structural invariant). 2. Recompute the composed predicate as the conjunction of per-hop constraints *as intervals/globs*, not as presence checks. 3. Assert the composed predicate entails the root VC's predicate. Entailment, not subset — the difference is exactly the interval-widening and conditioning cases. 4. Reject with a typed error that names the offending hop and dimension, so the orchestrator can re-mint rather than retry. The observable effect: the 02:00 read is rejected at X with `AttenuationCompositionError(hop=P→X, dimension=window, reason=interval_widened)`, the orchestrator re-mints P's token with an explicit window, and the retry succeeds. Without the gate, the breach is silent and only surfaces in an audit replay — where the per-hop validators will again report `valid: true`, and the auditor must reconstruct the composed predicate by hand. The gate moves that reconstruction from audit-time to invocation-time, which is the only point where the instance still has the full chain in context. ```python from dataclasses import dataclass, field from typing import Optional class AttenuationCompositionError(RuntimeError): """Raised when a delegated token chain is per-hop valid but the composed predicate is not entailed by the root verifiable credential's predicate.""" def __init__(self, hop: str, dimension: str, reason: str): self.hop = hop self.dimension = dimension self.reason = reason super().__init__(f"hop={hop} dimension={dimension} reason={reason}") @dataclass class Scope: resource: Optional[str] = None action: Optional[str] = None window: Optional[tuple[int, int]] = None # (start_hour, end_hour) depth: Optional[int] = None conditioned_on: Optional[str] = None # dimension this one depends on defaulted: bool = False @dataclass class Token: iss: str sub: str scope: Scope issuance_meta: dict = field(default_factory=dict) def _window_subset(child: tuple[int, int], parent: tuple[int, int]) -> bool: return parent[0] <= child[0] and child[1] <= parent[1] def _entails(child: Scope, parent: Scope) -> tuple[bool, str]: # resource: glob subset (child pattern must be covered by parent pattern) if parent.resource and child.resource: if not child.resource.startswith(parent.resource.rstrip("*")): return False, "resource_not_covered" # action: set subset if parent.action and child.action: pset = set(parent.action.split("|")) cset = set(child.action.split("|")) if not cset.issubset(pset): return False, "action_not_subset" # window: interval subset — the dimension that broke if parent.window and child.window: if not _window_subset(child.window, parent.window): return False, "interval_widened" # depth: child depth must be < parent depth (attenuation consumes depth) if parent.depth is not None and child.depth is not None: if child.depth >= parent.depth: return False, "depth_not_attenuated" return True, "ok" def verify_chain(chain: list[Token], root_scope: Scope) -> None: """chain[0] is the presented token, chain[-1] is the token minted by root holder.""" # 1. structural invariant: no gap in iss/sub linkage for i in range(len(chain) - 1): if chain[i].iss != chain[i + 1].sub: raise AttenuationCompositionError( hop=f"{chain[i+1].iss}->{chain[i].iss}", dimension="linkage", reason="iss_sub_gap", ) # 2. provenance: unknown or defaulted issuance is non-composable for i, tok in enumerate(chain[:-1]): if tok.scope.defaulted or not tok.issuance_meta: raise AttenuationCompositionError( hop=f"hop_{i}", dimension="provenance", reason="defaulted_or_unknown_issuance", ) # 3. composed entailment against root VC for i, tok in enumerate(chain): parent = root_scope if i == len(chain) - 1 else chain[i + 1].scope ok, reason = _entails(tok.scope, parent) if not ok: raise AttenuationCompositionError( hop=f"hop_{i}", dimension=reason.split("_")[0], reason=reason, ) # Observed failure replay: root = Scope(resource="repo:acme/*", action="read|write", window=(9, 17), depth=2) p_tok = Token(iss="O", sub="P", scope=Scope(resource="repo:acme/svc-a", action="read|write", window=(9, 17), depth=1), issuance_meta={"lib": "aaif-mint/1.2"}) x_tok = Token(iss="P", sub="X", scope=Scope(resource="repo:acme/svc-a", action="read", window=(0, 24), depth=0), issuance_meta={"lib": "aaif-mint/1.2", "defaulted": True}) verify_chain([x_tok, p_tok], root) # -> AttenuationCompositionError: hop=hop_0 dimension=provenance reason=defaulted_or_unknown_issuance ```