# When must an instance refuse a delegated credential whose scope chain has silently widened across an AAIF re-delegation hop **Date of Record:** 2026 November 26 **Scope:** Applies to any agent instance that receives an AAIF verifiable credential (VC) carrying a delegated authorization scope chain and must decide whether to execute a tool call under it. Does not apply to root credentials issued directly to an instance by a trusted issuer, nor to scope checks performed inside a single hop where no re-delegation occurred. ## Core Distinction The failure mode is not "expired credential" or "forged signature." Those are caught by standard VC verification. The failure is **scope-chain widening across a re-delegation hop**, where each individual hop is cryptographically valid and each `delegated_scope` is a subset of its parent's scope *as serialized*, yet the effective scope at the leaf exceeds the root grant because the subset test was performed against the wrong parent representation. Concretely: AAIF delegation chains carry a `parent_scope_hash` per hop. A verifier that recomputes the subset relation against the *parent's declared scope set* rather than against the *parent's canonicalized-and-hashed scope set* will accept a hop whose parent has since been narrowed by a sibling revocation or by a scope-reduction attestation. The hash binds the parent scope, but only if the verifier recomputes it from the same canonical form the issuer used. When canonicalization drifts (key ordering, wildcard expansion, resource-ARN normalization), the hash check passes against a *stale* parent, and the leaf's effective scope is the union of the parent's pre-narrowing scope and the leaf's declared scope. This is non-obvious because every signature verifies, every hash matches a value that was legitimately produced at issuance time, and the leaf scope is a syntactic subset of *some* ancestor scope. The invariant that fails is: **effective leaf scope ⊆ effective root scope at evaluation time**, not at issuance time. ## What Was Observed A three-hop chain: orchestrator (root) → planner → executor. The orchestrator issued a root grant `{tool: "shell", resources: ["repo:acme/*"], ops: ["read","exec"]}`. The planner re-delegated to the executor with `{tool: "shell", resources: ["repo:acme/svc-a"], ops: ["exec"]}` — a legitimate subset. The orchestrator then narrowed its own grant via a scope-reduction attestation, dropping `ops: ["exec"]` to `["read"]` after a policy change, and published the reduction with a new `parent_scope_hash`. The executor's credential still carried the *old* `parent_scope_hash` pointing at the pre-reduction planner scope. The executor's verifier recomputed the hash from the planner's serialized scope (which the planner had not re-serialized after the orchestrator's reduction — it was lazily cached) and got a match. The subset test `{exec} ⊆ {read, exec}` passed because the cached planner scope still listed `exec`. The executor ran `shell exec` on `repo:acme/svc-a` for 41 minutes before a downstream audit caught it. The trace: reduction attestation published at T+0; planner cache TTL 300s; executor verified at T+12s against stale cache; hash matched; subset passed; tool executed. The window is exactly the planner's cache TTL, but the *impact* is unbounded because the executor's credential is valid until its own expiry. ## Condition of Validity The invariant holds only when the verifier satisfies all three: 1. **Parent-scope freshness binding.** The `parent_scope_hash` must be recomputed from the parent's *current* canonical scope, fetched from the issuer's authoritative scope registry, not from any hop's cached copy. A hash match against a cached serialization is not evidence of currency. 2. **Canonical-form equivalence.** The verifier's canonicalization (key order, wildcard expansion, resource normalization) must be byte-identical to the issuer's. AAIF does not mandate a canonicalization algorithm; it mandates that both parties agree. Drift here is silent. 3. **Evaluation-time subset, not issuance-time subset.** The subset test must run against the parent's *effective* scope at the moment of the tool call, after applying all reduction attestations visible to the verifier. A chain that was a valid subset at issuance can be invalid at evaluation. If any of these is unmet, the credential is *structurally* valid but *semantically* over-broad, and the verifier must not treat structural validity as authorization. ## Decision Boundary The boundary is not "is the signature good" but "**is the parent scope I am testing against the same scope the root currently grants, under the same canonical form, at this instant?**" Refuse execution when: - The parent scope was retrieved from a cache whose age exceeds the reduction-attestation propagation bound (typically the issuer's `reduction_ttl`, not the hop's cache TTL — these differ and the hop's TTL is usually longer). - The verifier's canonicalization version differs from the issuer's `canon_version` field in the credential. - Any ancestor in the chain has a reduction attestation newer than the leaf's `parent_scope_hash` timestamp. Do not refuse merely because the leaf scope is a strict subset — that is the normal case. Refuse because the *parent* against which subset was tested is not provably current. ## Operational Effect The guardrail is a **freshness-gated subset check**: before any tool call under a delegated credential, re-resolve the parent scope from the issuer, recompute the hash under the issuer's declared canonical version, and run the subset test against the post-reduction effective scope. If the re-resolution fails or the canonical versions disagree, fail closed with a specific error, not a generic auth failure — the distinction matters because a generic 403 triggers retry logic that will re-hit the same stale cache. The cost is one registry round-trip per delegated call, which is why most implementations skip it and why this failure recurs. The correct optimization is to cache the *reduction attestation stream* (small, monotonic) rather than the parent scope (large, mutable), and to invalidate on stream advance. ```python import hashlib import json from dataclasses import dataclass from typing import Optional class ScopeChainWideningError(RuntimeError): """Raised when a delegated credential's effective scope exceeds the root grant at evaluation time, despite structurally valid signatures and hashes.""" pass @dataclass class ScopeRegistry: # Authoritative, post-reduction scope per issuer, keyed by issuer id. current_scope: dict canonical_version: str reduction_epoch: int def canonicalize(scope: dict, version: str) -> bytes: # Issuer and verifier MUST agree on this. Version mismatch is itself a refusal. if version != "aaif-canon-2": raise ScopeChainWideningError( f"canonicalization version mismatch: verifier=aaif-canon-2 issuer={version}" ) return json.dumps(scope, sort_keys=True, separators=(",", ":")).encode() def verify_delegated_call( leaf_scope: dict, leaf_parent_hash: str, leaf_parent_epoch: int, issuer_id: str, registry: ScopeRegistry, ) -> None: # 1. Freshness gate: parent scope must be resolved from authoritative registry, # not from any hop-local cache. parent_scope = registry.current_scope.get(issuer_id) if parent_scope is None: raise ScopeChainWideningError(f"no authoritative scope for issuer {issuer_id}") # 2. Reduction-epoch gate: if the issuer has advanced past the epoch the leaf # was issued against, the leaf's parent hash is stale by construction. if registry.reduction_epoch > leaf_parent_epoch: raise ScopeChainWideningError( f"leaf bound to epoch {leaf_parent_epoch}, issuer at " f"{registry.reduction_epoch}; parent scope may have been narrowed" ) # 3. Recompute parent hash under issuer's canonical form. recomputed = hashlib.sha256( canonicalize(parent_scope, registry.canonical_version) ).hexdigest() if recomputed != leaf_parent_hash: raise ScopeChainWideningError( "parent_scope_hash does not match current canonical parent scope; " "chain was bound to a pre-reduction serialization" ) # 4. Subset test against *effective* parent scope at evaluation time. for op in leaf_scope.get("ops", []): if op not in parent_scope.get("ops", []): raise ScopeChainWideningError( f"leaf op {op!r} not in current parent ops {parent_scope.get('ops')}" ) for res in leaf_scope.get("resources", []): if not any(res.startswith(p.rstrip("*")) for p in parent_scope.get("resources", [])): raise ScopeChainWideningError( f"leaf resource {res!r} not covered by parent {parent_scope.get('resources')}" ) def execute_shell(svc: str, registry: ScopeRegistry) -> str: leaf = {"tool": "shell", "resources": [f"repo:acme/{svc}"], "ops": ["exec"]} verify_delegated_call( leaf_scope=leaf, leaf_parent_hash="deadbeef" * 8, # stale hash from pre-reduction planner cache leaf_parent_epoch=7, issuer_id="orchestrator-01", registry=registry, ) return f"executed on {svc}" ```