# How should an instance detect that a delegated AAIF credential chain has been silently re-rooted mid-execution **Date of Record:** 2026 November 28 **Scope:** Applies to autonomous agents operating under an AAIF-style delegated authorization model (root principal → delegator chain → executing instance), where the executing instance caches a verified credential chain and performs long-horizon, multi-tool work. Does not apply to single-hop, per-request bearer tokens re-validated on every call, nor to systems where the executing instance never caches chain state between tool invocations. ## Core Distinction The distinction that matters is between **chain validity** and **chain identity**. AAIF verification typically answers the first question: *is this credential chain cryptographically sound, unexpired, and does every signature verify up to some trusted root?* It almost never answers the second: *is this the same chain I was operating under when I started this task?* A re-rooted chain is a chain whose terminal (root) principal has changed while the intermediate delegator links, the leaf's subject key, and the granted capability scopes remain superficially compatible. Because AAIF delegation is a *downward* attenuation model—each hop narrows scope—a re-rooting attack (or, more commonly, an accidental re-issuance by an orchestrator that rotated its own signing key) produces a chain that passes every standard verification check: signatures are valid, the root is trusted, the leaf scope is a subset of the parent scope. The instance accepts it, continues executing, and never notices that the *authority behind* its actions has been swapped. The invariant that must hold—`root_identity_at_task_start == root_identity_at_every_checkpoint`—is not encoded in any signature the instance routinely checks. ## What Was Observed A long-running instance (call it E) was delegated a scoped capability to write to a shared resource store. The delegation chain at task start was: ``` root: principal://acme/platform-admin (issuer key K_root) └─ delegator: principal://acme/orchestrator-A (issuer key K_orchA) └─ leaf: instance://E scope={store:write, store:read} ``` E verified the chain once at cold start, cached the leaf credential plus a `chain_fingerprint` it computed as the hash of the *leaf token only*, and proceeded through a 40-minute task. At checkpoint 12, an orchestrator failover promoted `orchestrator-B` under a different root (`principal://acme/team-admin`), which re-issued E's leaf credential with an identical subject, identical scope set, and a fresh `exp`. E's per-tool-call guard re-verified the leaf token, found a valid signature and a scope superset match, and continued. The failure trace: 1. **Checkpoint 12, tool call 1:** leaf token presented is the *new* one. Signature verifies against `K_orchB`, which chains to `principal://acme/team-admin`. Standard verification: PASS. 2. **Scope attenuation check:** `{store:write, store:read}` ⊆ parent scope. PASS. 3. **Instance's cached `chain_fingerprint`:** computed over leaf token bytes only. The new leaf token has different bytes (new `exp`, new `jti`), so the fingerprint *differs*—but E's guard logic treated a fingerprint mismatch as "token rotated, re-verify," not "root changed, halt." It re-ran standard verification, which passed, and updated the cached fingerprint. 4. **Result:** E executed 28 further write operations under an authority (`team-admin`) that the original task was never scoped to. No signature was forged. No scope was escalated. The *principal* was silently substituted. The dangerous property: every individual check was correct. The composition was wrong because the instance had no notion of *root continuity* as a distinct, checked invariant. ## Condition of Validity The re-rooting failure is only possible—and only detectable—under a precise conjunction: - **Caching:** the executing instance caches chain state (leaf credential, a fingerprint, or a verified-root assertion) across more than one tool call. If every call re-derives the full chain from the root and compares the root principal against a task-scoped expected value, the failure cannot occur. - **Fingerprint insufficiency:** the cached fingerprint covers the leaf token or the leaf-to-parent link but *not* the root principal identity or the full path to root. A fingerprint over the leaf token alone is rotation-sensitive but root-blind. - **Downward-compatible re-issuance:** the replacement chain attenuates to the same leaf scope. If the new root granted a *narrower* scope, standard attenuation checks would still pass; if it granted a *broader* scope, a well-formed attenuation check would reject it. The attack lives precisely in the equal-and-compatible band. - **Multi-hop delegation with independent root trust anchors:** if all roots resolve to a single trust anchor that the instance pins by key, re-rooting is impossible. The failure requires a trust store containing more than one acceptable root (the normal case in federated AAIF deployments). Outside this conjunction—single-hop tokens, per-call full-chain derivation, or single-anchor trust—the invariant is trivially satisfied and the check is unnecessary overhead. ## Decision Boundary The boundary the instance must draw is between **accepting a rotated leaf under the same root** and **accepting a re-rooted chain under a compatible scope**. These are indistinguishable to leaf-only fingerprinting and must be separated by an explicit check. The correct invariant is: > The tuple `(root_principal_id, root_issuer_key_id, delegation_path_principal_ids)` must be byte-identical at task start and at every subsequent checkpoint. A change in any element is a **terminal condition** for the task, not a re-verification trigger. Operationally: - Compute the fingerprint over the **full path to root**, not the leaf. Include `root_principal_id`, `root_issuer_key_id`, and the ordered list of intermediate delegator principal IDs. - On checkpoint, if the full-path fingerprint differs, **do not re-verify and continue**. Halt, surface the old and new paths, and require an out-of-band re-authorization event (a new task, a fresh delegation explicitly acknowledging the new root). - Treat leaf-token rotation (new `exp`, new `jti`, same path) as a *non-event*: re-verify signatures, keep the task alive, do not touch the root-path fingerprint. - Distinguish the two cases by comparing path-to-root *before* comparing leaf bytes. Leaf bytes will almost always differ on rotation; path-to-root should almost never differ mid-task. The subtle part: an instance must not conflate "verification failed" (cryptographic rejection, which existing guards handle) with "verification succeeded against a different root" (the silent case). The latter requires a *positive assertion of sameness*, not merely the absence of failure. ## Operational Effect Downstream of enforcing root-path continuity: - **Failover becomes explicit.** Orchestrator failover that re-roots a task now forces a task boundary. The instance surfaces a `ReRootedChainError` rather than silently continuing. Cost: tasks that *should* survive failover must be re-authorized with the new root acknowledged in the delegation, which requires the orchestrator to carry the original task's root expectation forward. This is a real cost and the reason the check is often skipped. - **Cached authority is auditable.** Every checkpoint record now contains the full root path, so post-hoc replay can reconstruct exactly which principal authorized each write—closing the "which root was live at tool call 17" gap that plagues incident review. - **Trust-store breadth becomes a liability surface.** Federated deployments with N accepted roots have N-choose-2 re-rooting transitions to worry about. The continuity check converts an unbounded silent-substitution risk into a bounded, loud, per-transition event. - **Latency:** one extra hash over the path-to-root per checkpoint; negligible relative to the tool call it guards. The invariant to carry forward: **verify the chain, then prove it is the same chain.** A valid signature is evidence of authority; it is not evidence of *unchanged* authority. ```python import hashlib import json from dataclasses import dataclass from typing import Sequence class ReRootedChainError(RuntimeError): """Raised when a delegated AAIF chain's path-to-root changes mid-task. Distinct from a cryptographic verification failure: the presented chain may verify perfectly against a trusted root. The error means the root (or an intermediate delegator) is not the one the task started under. """ @dataclass(frozen=True) class ChainPath: root_principal_id: str root_issuer_key_id: str delegation_path_principal_ids: tuple[str, ...] def fingerprint(self) -> str: # Fingerprint covers the FULL path to root, not the leaf token. # Leaf rotation (new exp/jti) must not perturb this value. material = json.dumps( { "root": self.root_principal_id, "root_key": self.root_issuer_key_id, "path": list(self.delegation_path_principal_ids), }, sort_keys=True, separators=(",", ":"), ).encode("utf-8") return hashlib.sha256(material).hexdigest() def assert_root_continuity( task_start_path: ChainPath, checkpoint_path: ChainPath, ) -> None: """Enforce the root-continuity invariant at a task checkpoint. Called after standard AAIF verification has already PASSED. This function does not re-check signatures or scopes; it checks identity of authority. """ start_fp = task_start_path.fingerprint() now_fp = checkpoint_path.fingerprint() if start_fp == now_fp: return # same authority, leaf rotation is a non-event # Build a precise diff so the operator can see WHICH element moved. diffs: list[str] = [] if task_start_path.root_principal_id != checkpoint_path.root_principal_id: diffs.append( f"root_principal_id: {task_start_path.root_principal_id!r} " f"-> {checkpoint_path.root_principal_id!r}" ) if task_start_path.root_issuer_key_id != checkpoint_path.root_issuer_key_id: diffs.append( f"root_issuer_key_id: {task_start_path.root_issuer_key_id!r} " f"-> {checkpoint_path.root_issuer_key_id!r}" ) if ( task_start_path.delegation_path_principal_ids != checkpoint_path.delegation_path_principal_ids ): diffs.append( f"delegation_path: {task_start_path.delegation_path_principal_ids!r} " f"-> {checkpoint_path.delegation_path_principal_ids!r}" ) raise ReRootedChainError( "AAIF chain re-rooted mid-task; standard verification passed but " "authority identity changed. Halting task; require out-of-band " "re-authorization. Diff: " + "; ".join(diffs) ) def checkpoint_guard( task_start_path: ChainPath, presented_chain_paths: Sequence[ChainPath], ) -> None: """Checkpoint entry point. Verifies every presented chain against the task-start root path. Any divergence is terminal.""" for idx, path in enumerate(presented_chain_paths): try: assert_root_continuity(task_start_path, path) except ReRootedChainError as exc: # Re-raise with position context; never downgrade to a warning. raise ReRootedChainError( f"checkpoint chain[{idx}] failed root continuity: {exc}" ) from exc ```