# Which invariants prevent DPoP-bound delegated credential chains from silently widening scope when an intermediate agent re-mints rather than re-delegates **Date of Record:** 2026 November 23 **Scope:** Applies to AAIF credential chains where an agent receives a DPoP-bound delegated token (proof-of-possession keyed to its own JWK thumbprint `jkt`) and must pass narrowed authority to a sub-agent. Does not cover root-of-trust key compromise, OIDC federation, or transport-level TLS client certs. ## Core Distinction The failure is not "token theft" and not "signature forgery." It is **re-minting versus re-delegation**. A delegation chain is a linked list of tokens where each hop's `cnf.jkt` binds the token to the *next* holder's key, and the `scope` claim is monotonically non-increasing along the chain. Re-delegation preserves that structure: the sub-agent gets a token whose `cnf.jkt` is the sub-agent's key, whose `act` (actor) chain appends the delegating agent, and whose scope is a subset computed against the parent's scope. Re-minting is what a well-meaning agent does when it "just needs a fresh token for the sub-call": it asks its own issuer, or worse, its own internal signing service, for a new token carrying the sub-agent's key. The new token is cryptographically valid. Its DPoP proof verifies. Its `cnf.jkt` matches. Its `exp` is fresh. **And its scope silently resets to the agent's own full grant rather than the parent token's narrowed scope.** The chain of `act` claims is severed, the monotonic-scope invariant is broken, and the resource server has no way to detect it from the token alone — because the token is internally consistent. The distinction that matters: **a valid DPoP proof proves possession of a key, not continuity of authority.** AAIF chains are only safe if the verifier reconstructs the `act` lineage and enforces scope non-widening at each link. Any architecture that treats a per-hop DPoP verification as sufficient has already lost the invariant. ## What Was Observed A three-hop chain: orchestrator → planner agent → executor agent. The orchestrator held a root token with scope `files:read files:write tickets:read tickets:write`. It delegated to the planner with scope `files:read tickets:read` (correctly narrowed). The planner, needing to hand a narrow slice to the executor, called its internal `mint_token(subject=executor_jkt, scope=["files:read","tickets:read","files:write"])` — because the planner's cached "my effective scope" object had been populated from the *root* token at cold start, not from the token it actually received. The executor's token verified cleanly at the resource server: - `cnf.jkt` = executor's thumbprint ✓ - DPoP proof signed by executor's key, `htm`/`htu`/`jti`/`iat` correct ✓ - `iss` = planner's issuer, `aud` = resource server ✓ - `exp` = now + 300s ✓ The `act` claim contained only `{sub: planner}` — the orchestrator was absent. The chain length was 1, not 2. The scope was *wider* than the planner's own token. Nothing in the token said "I was derived from a narrower parent." The resource server, doing per-token validation, admitted the `files:write` call. The trace that surfaced it: a post-hoc audit compared the executor's token `act` chain against the root token's issued-children log and found a token whose `act` depth was less than the delegation depth recorded for the requesting agent. The audit only worked because the issuer kept a per-`jti` parent pointer. Without that, the widening was invisible. The trigger condition is precise: **the delegating agent's local representation of "my authority" diverged from "the authority in the token I am currently holding."** This happens on (a) cold start where the agent rehydrates scope from its own config rather than its inbound token, (b) context truncation that drops the inbound token's claims but keeps the agent's role description, (c) any code path that calls a `mint` API instead of a `delegate` API because the two are both "get a token." ## Condition of Validity The monotonic-scope invariant holds **only if** the resource server enforces all three of the following on every request, not just the first: 1. **Lineage reconstruction:** the presented token's `act` chain, read leaf-to-root, must terminate at an issuer the resource server trusts *for this resource*, and each `act[i].sub` must be a principal that itself held a valid token covering the requested scope at `act[i].iat`. 2. **Scope monotonicity:** `scope(token) ⊆ scope(parent)` where `parent` is identified by `act[0].parent_jti` (or equivalent back-pointer). A token with no parent pointer is only valid if its `act` depth is 0 and it was issued directly by a root authority. 3. **Key continuity:** `cnf.jkt(token)` must equal the `jkt` the *presenting* agent proved via DPoP, **and** `act[i].cnf_jkt` must equal `cnf.jkt` of the token `act[i]` was issued under. This binds each link to the key that actually held it, closing the re-mint loophole where a new key is minted under an old actor identity. If any of these is checked only at the first hop and cached, the invariant is violated on hop 2+. Caching "this agent is authorized for X" at the resource server is the single most common way the failure goes undetected. ## Decision Boundary The boundary between safe and unsafe is **whether the delegating agent can produce a token whose `act` chain is a strict suffix-extension of its own — and whether the verifier checks that extension.** Concretely: - **Safe:** planner calls `delegate(parent_token=self.inbound_token, subject=executor_jkt, scope=intersect(self.inbound_token.scope, requested))`. The issuer signs a token with `act = [*parent.act, {sub: planner, parent_jti: parent.jti, cnf_jkt: parent.cnf.jkt}]`. Verifier walks the chain, checks each link's back-pointer to a token it issued, and rejects any link where `scope(child) ⊄ scope(parent)`. - **Unsafe:** planner calls `mint(subject=executor_jkt, scope=self.cached_scope)`. The issuer signs a token with `act = [{sub: planner}]`. Verifier sees depth 1, valid signature, valid DPoP — and admits it, because it has no parent pointer to check against. The decision boundary is not "does the token verify" — it is **"can the verifier prove the token's scope is a subset of some ancestor's scope, using only signed data and its own issuance log?"** If the answer is "no, I trust the issuer to have done that," the invariant is unenforced. If the answer is "yes, via `parent_jti` back-pointers and per-link `cnf_jkt`," it is enforced. A secondary boundary: `act` depth alone is insufficient. An attacker (or a buggy agent) can mint `act = [{sub: planner}, {sub: orchestrator}]` and fake depth 2. The back-pointer `parent_jti` must resolve to a token the verifier *itself* issued and whose `cnf.jkt` matches the link's claimed `cnf_jkt`. Depth is a hint; the signed back-pointer is the proof. ## Operational Effect When the invariant is enforced, the planner's re-mint attempt fails at the issuer: `delegate` requires a `parent_token` whose `cnf.jkt` matches the caller's DPoP proof, and `mint` is not exposed to non-root principals. The planner's cold-start scope rehydration bug becomes a loud `ScopeWideningError` at the issuer, not a silent privilege escalation at the resource server. The executor gets a token whose `act` is `[orchestrator, planner]` and whose scope is `files:read tickets:read` — the intersection the planner intended. When the invariant is unenforced, the effect is worse than a single over-scoped call: the audit trail loses the link between the executor's action and the orchestrator's grant. Incident response cannot answer "which root authority authorized this `files:write`?" because the `act` chain was severed at the re-mint. The blast radius of any executor compromise is the planner's *full* grant, not the narrowed slice — because the executor's token carries the planner's cached scope, which on cold start is the root scope. The operational rule that falls out: **treat `mint` and `delegate` as different verbs in the agent SDK, and make `mint` unreachable from any agent that holds a delegated token.** The type system should not let an agent with `act.depth > 0` call `mint`. If the SDK exposes one `get_token()` that dispatches on whether a parent is present, the failure is latent and will fire on the first cold start. ```python from dataclasses import dataclass from typing import Optional class ScopeWideningError(RuntimeError): """Raised when a delegated token's scope is not a subset of its parent's, or when an agent attempts to re-mint rather than re-delegate.""" pass @dataclass(frozen=True) class ActLink: sub: str parent_jti: str cnf_jkt: str @dataclass(frozen=True) class DelegatedToken: jti: str scope: frozenset[str] cnf_jkt: str act: tuple[ActLink, ...] def delegate(parent: DelegatedToken, caller_jkt: str, subject_jkt: str, requested: frozenset[str], new_jti: str) -> DelegatedToken: # Invariant 3: caller must hold the parent token's key. if parent.cnf_jkt != caller_jkt: raise ScopeWideningError( f"caller jkt {caller_jkt} does not match parent cnf.jkt {parent.cnf_jkt}" ) # Invariant 2: scope must be non-increasing. widened = requested - parent.scope if widened: raise ScopeWideningError( f"delegation widens scope by {sorted(widened)}; parent scope={sorted(parent.scope)}" ) # Invariant 1: act chain extends the parent's, with a signed back-pointer. link = ActLink(sub=caller_jkt, parent_jti=parent.jti, cnf_jkt=parent.cnf_jkt) return DelegatedToken( jti=new_jti, scope=requested, cnf_jkt=subject_jkt, act=(*parent.act, link), ) def verify(token: DelegatedToken, presented_jkt: str, issuance_log: dict[str, DelegatedToken]) -> None: if token.cnf_jkt != presented_jkt: raise ScopeWideningError("DPoP key does not match token cnf.jkt") if not token.act: return # root token; trust anchor checked elsewhere for link in token.act: parent = issuance_log.get(link.parent_jti) if parent is None: raise ScopeWideningError( f"act link references unknown parent_jti {link.parent_jti}; " "token was re-minted, not re-delegated" ) if link.cnf_jkt != parent.cnf_jkt: raise ScopeWideningError("act link cnf_jkt does not match parent token") if not token.scope <= parent.scope: raise ScopeWideningError( f"scope {sorted(token.scope)} not subset of parent {sorted(parent.scope)}" ) ```