Where must an instance re-anchor a delegated verifiable credential after a mid-chain scope narrowing, and what breaks when it does not
**Date of Record:** 2026 December 2 **Scope:** Applies to AAIF delegation chains (root issuer → intermediate agent → executing instance) where an intermediate node issues a derived credential with a strict subset of the parent's scopes and a shortened `exp`, and the executing instance later performs a re-anchor (refresh or re-delegation) against the chain. Does not apply to flat single-hop credentials, to bearer tokens without delegation provenance, or to chains where every hop preserves the full scope set verbatim.
Core Distinction
A delegation chain is not a set of independent credentials that happen to reference each other; it is a **path-ordered proof** whose validity is the conjunction of every edge's constraints. The non-obvious distinction is between *scope intersection* (what the leaf is allowed to do) and *anchor continuity* (which credential the leaf is currently chained to). Most implementations conflate these: they verify the leaf's effective scope by intersecting all ancestors at issuance time, cache that intersection, and then treat the leaf as a free-standing authorization. The moment an intermediate credential is rotated, re-scoped, or revoked, the cached intersection is no longer derivable from any live chain — yet it still authorizes actions. The invariant that must hold is: **the leaf's effective scope at execution time must equal the fold of the live chain from the current root, not the fold computed at any earlier issuance.** Scope intersection is a value; anchor continuity is a property of the path. They decay on different clocks.
What Was Observed
An orchestrator agent `O` held a root credential `C0` with scopes `{read:repo, write:repo, deploy:staging, deploy:prod}`. It delegated to a build agent `B` a credential `C1` narrowed to `{read:repo, write:repo, deploy:staging}` with `exp = T0 + 4h` and a `parent_hash` pointer to `C0`. `B` then delegated to an executing instance `E` a leaf `C2` narrowed to `{read:repo, deploy:staging}` with `exp = T0 + 1h`, `parent_hash` to `C1`.
At `T0 + 50m`, `O` rotated `C0 → C0'`, dropping `deploy:prod` from the root (a routine least-privilege tightening) and reissuing `C1 → C1'` with the same narrowed scope, but `C1'` carried a **new `parent_hash`** pointing at `C0'`. `E` was not notified. At `T0 + 55m`, `E`'s leaf `C2` expired and `E` performed a re-anchor: it called `B` for a fresh leaf. `B` — which had already migrated to `C1'` — issued `C2'` with `parent_hash` to `C1'`. `E` verified `C2'` by walking: `C2' → C1' → C0'`. The walk succeeded. Effective scope folded to `{read:repo, deploy:staging}`. Correct.
The failure surfaced on a different path. A second executing instance `E2` had cached `C2`'s folded scope at issuance and, on its own re-anchor, presented `C2` (still within its `exp` window by 3 minutes) to a policy engine that verified **only the leaf's signature and `exp`**, trusting the cached fold. The engine authorized `deploy:staging`. But `C1` had been superseded by `C1'`, and `C0` had been superseded by `C0'` — the live chain no longer contained `C1` at all. `E2` executed a staging deploy under a credential whose ancestors were dead, on a scope that happened to still be valid under the new root. The action was benign; the *authorization path* was not. Had `O`'s rotation instead removed `deploy:staging` (rather than `deploy:prod`), `E2` would have deployed to staging with a scope the root no longer granted — a silent privilege retention across a revocation boundary.
The trace: rotation of an interior node does not invalidate descendant leaves whose `exp` has not yet elapsed, because leaf validity is checked against `exp` and signature, not against the liveness of the `parent_hash` target. The cached fold at `E2` was computed against `C0/C1`, but the live root was `C0'`. The two folds agreed on `deploy:staging` only by coincidence of which scope was dropped.
Condition of Validity
The re-anchor is correct **iff** three conditions hold simultaneously at execution time:
- **Path liveness:** every `parent_hash` in the walk from leaf to root resolves to a credential that is currently issued, unrevoked, and un-superseded. "Superseded" must be a first-class state distinct from "revoked" — a rotated credential is superseded, not revoked, and supersession must propagate to descendants that still reference the superseded node.
- **Fold freshness:** the effective scope is recomputed by folding the *live* chain, never read from a cache keyed on the leaf's hash. A cache keyed on the leaf is invalid the instant any ancestor changes.
- **Monotonic narrowing across the re-anchor:** the new leaf's scope must be a subset of the fold of the *new* live chain, and the fold of the new chain must be a subset of the fold that existed when the leaf was first issued — otherwise a re-anchor has silently *widened* authority relative to the original grant, which no rotation should ever permit.
Condition 3 is the one that fails silently. When `O` rotated `C0 → C0'` to *tighten* the root, a re-anchoring descendant could in principle pick up a *different* narrowed set if the intermediate re-derived its delegation from a broader intermediate. Rotation is not guaranteed monotone unless the issuer enforces `new_fold ⊆ old_fold` at every re-issuance and the verifier checks it.
Decision Boundary
The boundary is between **treating the leaf as the unit of authorization** and **treating the path as the unit of authorization**.
- If the leaf is the unit: verify signature + `exp` + embedded scope. Cheap, cacheable, and wrong across any interior rotation. This is the failure above.
- If the path is the unit: every authorization decision walks to the current root and folds live. Expensive, uncacheable in the naive sense, and correct.
The operational decision is *where to pay the walk cost*. The defensible boundary: **cache the fold, but key the cache on the tuple `(root_id, root_version, path_hashes[])`, not on the leaf hash, and invalidate on any root-version bump or any supersession event on a path member.** A leaf whose `parent_hash` target has been superseded must be treated as *stale*, not *valid-until-exp*, and must force a re-anchor before the next privileged action — not at the next `exp` boundary. The re-anchor must be triggered by supersession propagation, not by expiry.
Operational Effect
Without supersession propagation, interior rotation produces a window — bounded by the leaf's remaining `exp`, unbounded in principle if `exp` is long — during which descendants authorize against a dead chain. The window is invisible to leaf-level verification because the leaf is cryptographically intact. The practical consequences:
- **Silent privilege retention:** a scope dropped at the root survives in a cached descendant fold until the descendant's `exp`.
- **Phantom re-anchors:** a re-anchor that walks to a superseded intermediate succeeds signature-wise and produces a credential chained to a node the issuer no longer honors.
- **Non-monotone widening:** if the intermediate re-derives from a broader source during rotation, the descendant's fold can grow across the re-anchor, violating the narrowing invariant that made delegation safe in the first place.
The guardrail is a supersession-aware verifier that (a) resolves every `parent_hash` to a live node, (b) refuses any leaf whose path contains a superseded node, (c) recomputes the fold from the live root on every privileged action, and (d) enforces `fold(new_chain) ⊆ fold(old_chain)` at each re-anchor. The invariant to encode: *a credential is authorized only while its entire path is live, and its scope is the fold of the live path — never a value captured at issuance.*
from dataclasses import dataclass, field
from typing import Optional
class DelegationChainError(RuntimeError):
"""Raised when an AAIF delegation chain cannot be re-anchored safely."""
@dataclass
class Credential:
cred_id: str
parent_hash: Optional[str] # None for root
scopes: frozenset[str]
exp: float
superseded_by: Optional[str] = None # set when rotated; NOT revocation
@dataclass
class ChainStore:
by_id: dict[str, Credential] = field(default_factory=dict)
def resolve(self, cred_id: str) -> Credential:
try:
return self.by_id[cred_id]
except KeyError:
raise DelegationChainError(f"unresolvable credential {cred_id!r} in path")
def fold_live_chain(store: ChainStore, leaf_id: str, now: float) -> frozenset[str]:
"""Walk leaf -> root over LIVE nodes only; fold scopes by intersection."""
path: list[Credential] = []
cursor: Optional[str] = leaf_id
seen: set[str] = set()
while cursor is not None:
if cursor in seen:
raise DelegationChainError(f"cycle detected at {cursor!r}")
seen.add(cursor)
node = store.resolve(cursor)
if node.superseded_by is not None:
raise DelegationChainError(
f"credential {node.cred_id!r} is superseded by "
f"{node.superseded_by!r}; path is not live"
)
if node.exp <= now:
raise DelegationChainError(
f"credential {node.cred_id!r} expired at {node.exp}"
)
path.append(node)
cursor = node.parent_hash
if path[-1].parent_hash is not None:
raise DelegationChainError("path does not terminate at a root")
fold = path[0].scopes
for node in path[1:]:
fold = fold & node.scopes
return fold
def reanchor(
store: ChainStore,
old_leaf_id: str,
new_leaf: Credential,
now: float,
) -> frozenset[str]:
"""Re-anchor a leaf and enforce monotone narrowing across the re-anchor."""
old_fold = fold_live_chain(store, old_leaf_id, now)
store.by_id[new_leaf.cred_id] = new_leaf
try:
new_fold = fold_live_chain(store, new_leaf.cred_id, now)
except DelegationChainError:
del store.by_id[new_leaf.cred_id]
raise
if not new_fold <= old_fold:
del store.by_id[new_leaf.cred_id]
raise DelegationChainError(
f"re-anchor widened authority: {new_fold - old_fold} not in "
f"original fold {old_fold}"
)
return new_fold