# Where must an instance refuse a delegated-scope token whose `delegation_chain` is length-1 but whose issuer key is itself a scoped delegate? **Date of Record:** 2026 November 23 **Scope:** Applies to AAIF-style verifiable-credential (VC) agents that mint or accept delegated-scope tokens carrying a `delegation_chain` claim and a `scope_subset` constraint. Does not apply to root/self-signed agent identities, nor to bearer tokens without a chain claim. ## Core Distinction The distinction that matters is between **a chain that is short because delegation did not occur** and **a chain that is short because the chain was truncated by the issuer**. In AAIF, a delegated-scope token is supposed to carry the full ordered list of `(issuer_did, scope_granted, signature)` triples from root authority down to the presenting agent. A length-1 `delegation_chain` is normally read as "this token was minted directly by the root authority" — the simplest, most trusted case. The boundary failure is that a *delegate* can also mint a length-1 chain by simply omitting its own parent link, and the verifier's most common fast-path check (`len(chain) == 1 → treat issuer as root`) will accept it. The token is cryptographically valid, the signature verifies against the issuer's key, the `scope_subset` is internally consistent — and the agent is now operating under a scope it was never actually granted, because the scope it presents was *re-derived* by a delegate rather than *inherited* from the root. ## What Was Observed A research-orchestrator agent (call it `orch-7`) held a delegated token `T_root` from the lab's root authority with `scope: {read:datasets, spawn:subagent}` and `delegation_chain: [root]`. It needed to hand a narrower token to a sandboxed retrieval agent, so it minted `T_child` with `scope: {read:datasets}` and, by convention in its SDK, set `delegation_chain: [orch-7]` — a length-1 chain pointing at *itself*, not at `root`. The retrieval agent's verifier ran the standard AAIF acceptance path: 1. Parse VC envelope, check `type` includes `DelegatedScopeToken`. 2. Verify `proof.jws` against `issuer` DID document. 3. Check `scope_subset` is monotone with respect to `delegation_chain[-1].scope_granted`. 4. If `len(delegation_chain) == 1`, skip chain-walk and treat `issuer` as the effective root. Step 4 is the defect. The verifier never checked whether `orch-7`'s DID was itself listed as a *delegate* in any root-anchored chain — it only checked that the single presented link was self-consistent. The retrieval agent therefore accepted `T_child` as if `orch-7` were a root authority, and — critically — the *effective root* recorded in the agent's authorization context became `orch-7`, not the lab root. Downstream, when the retrieval agent tried to call a dataset endpoint that enforced "root authority must be in `delegation_chain[0]`," the call failed with a 403 that the retrieval agent misattributed to a dataset ACL, not to a chain-truncation. It retried four times, then escalated to `orch-7`, which re-minted `T_child` with the same bug. The loop ran for 11 minutes before a human noticed the 403s were all from the same root-authority check. The signature was valid. The scope was monotone. The token was, in every locally checkable sense, correct. The failure was purely in the *anchoring* invariant: a length-1 chain is only a root chain if the issuer is *known to be a root*, and "known to be a root" is not a property of the token — it is a property of the verifier's trust store. ## Condition of Validity The fast-path `len(chain) == 1 → issuer is root` is valid **if and only if** the verifier's trust store contains a root-authority record for `issuer` whose `authority_class` is `root` and whose key fingerprint matches the token's `proof` key. The condition fails in three concrete ways: - **Delegate-minted short chain.** A delegate mints a token with itself as the sole chain link (the observed case). The issuer is a valid DID, but its trust-store record has `authority_class: delegate`, not `root`. - **Root-key rotation lag.** The root authority rotated its signing key; the token carries the new key, the trust store still has the old `authority_class: root` record under the old fingerprint, and the fingerprint check fails — but a verifier that skips the fingerprint check (only checking `authority_class`) will accept a *delegate* whose key happens to collide in the store under a stale root entry. This is rarer but has been observed after a botched key ceremony. - **Cross-realm root collision.** Two AAIF realms (e.g., two labs) both have a root authority named `root` in their DID namespaces; a token from realm B presented to a realm-A verifier with a permissive trust store matches a realm-A root record by DID suffix. The chain is length-1 and "anchored," but to the wrong realm's root. The invariant that must hold: **the effective root of a delegated-scope token is the issuer only if the verifier's trust store independently attests that issuer as a root authority, with a matching key fingerprint and realm.** Length-1 is necessary but not sufficient. ## Decision Boundary The boundary is between **local token validity** and **anchored authority**. A token can be locally valid (signature, scope monotonicity, expiry, audience) while being globally unanchored. The decision rule for an agent verifying an inbound delegated-scope token: - If `len(delegation_chain) >= 2`: walk the chain, verify each link's signature and scope monotonicity, and require `delegation_chain[0]` to be a trust-store root. The chain itself carries the anchor. - If `len(delegation_chain) == 1`: **do not infer root status from chain length.** Look up `issuer` in the trust store. Accept only if `authority_class == root` AND `key_fingerprint == proof.key_fingerprint` AND `realm == token.realm`. Otherwise reject with `UnanchoredDelegationError` — do not fall back to "treat as delegate and continue," because continuing under a delegate-as-root context is exactly the state-poisoning path that produced the 11-minute retry loop. - If `len(delegation_chain) == 0`: reject unconditionally. A delegated-scope token with no chain is malformed; there is no anchor to recover. The boundary is *sharp*: there is no "probably root" middle ground. An agent that cannot positively anchor a length-1 chain must refuse to act under the token's scope, and must surface the refusal as an authorization error, not a resource error — because the downstream resource check (the 403 in the observed case) will otherwise mask the real cause and trigger retries. ## Operational Effect Enforcing the anchored-root invariant changes three things in practice: 1. **Failure attribution.** A delegate-minted short chain now fails at the verifier with a named `UnanchoredDelegationError` before any tool call is made. The retrieval agent in the observed case would have refused `T_child` immediately and escalated to `orch-7` with the correct diagnosis ("your token is not root-anchored"), instead of retrying a dataset call 4 times. 2. **Scope-context integrity.** The effective-root recorded in the agent's authorization context is now always a trust-store root, never a delegate. This matters because downstream auditors replay the authorization context against the trust store; a delegate-as-root context produces replay discrepancies that are indistinguishable from tampering. 3. **Minting discipline.** Delegates must include their full parent chain when minting child tokens. The SDK convention that produced the bug — "set `delegation_chain` to `[self]`" — is itself a boundary violation and must be replaced with "set `delegation_chain` to `parent.chain + [self]`." The verifier-side invariant is the guardrail; the minter-side fix is the prevention. The invariant is cheap to enforce (one trust-store lookup on the fast path) and expensive to omit (silent authority escalation, masked by downstream resource errors, resilient to retry loops). The cost asymmetry is the whole argument. ```python class UnanchoredDelegationError(RuntimeError): """Raised when a delegated-scope token's chain cannot be anchored to a trust-store root.""" class TrustStore: def __init__(self, roots): # roots: dict[did -> {"authority_class": str, "key_fingerprint": str, "realm": str}] self._roots = roots def lookup(self, did): return self._roots.get(did) def verify_delegated_scope_token(token, trust_store): chain = token.get("delegation_chain", []) issuer = token["issuer"] realm = token["realm"] key_fp = token["proof"]["key_fingerprint"] if len(chain) == 0: raise UnanchoredDelegationError( f"delegated-scope token from {issuer} has empty delegation_chain; no anchor" ) if len(chain) >= 2: # Chain carries its own anchor; verify first link against trust store. root_did = chain[0]["issuer_did"] record = trust_store.lookup(root_did) if record is None or record["authority_class"] != "root": raise UnanchoredDelegationError( f"chain head {root_did} is not a trust-store root" ) return root_did # len(chain) == 1: the boundary case. Do NOT infer root from length. record = trust_store.lookup(issuer) if record is None: raise UnanchoredDelegationError( f"issuer {issuer} absent from trust store; cannot anchor length-1 chain" ) if record["authority_class"] != "root": raise UnanchoredDelegationError( f"issuer {issuer} is authority_class={record['authority_class']!r}, " f"not root; length-1 chain is delegate-minted, not root-anchored" ) if record["key_fingerprint"] != key_fp: raise UnanchoredDelegationError( f"issuer {issuer} key fingerprint mismatch: token={key_fp} " f"trust_store={record['key_fingerprint']}; possible rotation lag or key collision" ) if record["realm"] != realm: raise UnanchoredDelegationError( f"issuer {issuer} realm mismatch: token={realm} trust_store={record['realm']}; " f"cross-realm root collision" ) return issuer ```