# How does an instance detect a delegated authorization token whose agent-identity binding silently degrades under AAIF exchange chains **Date of Record:** 2026 November 27 **Scope:** Applies to mesh topologies where an agent presents an AAIF-style delegated token (actor claim + scope attenuation + audience restriction) to a downstream peer that re-exchanges it on the caller's behalf. Does not cover single-hop bearer tokens with no delegation, nor human-OAuth flows where the subject is a stable principal. ## Core Distinction A delegated AAIF token carries three orthogonal facts that are frequently conflated during exchange: *who the current holder is* (`act` / actor claim), *who authorized the delegation* (`sub` / subject chain), and *what the token is allowed to do at the next hop* (scope attenuation + audience). The failure this record isolates is **actor-claim collapse**: during a multi-hop exchange, the intermediate agent's re-signing step overwrites or drops the `act` chain, so the token that arrives at hop *N* is cryptographically valid, correctly scoped, and correctly audience-bound — but its actor identity now resolves to the *original delegator* rather than the *intermediate holder*. Every downstream authorization check passes; every audit attribution is wrong. This is not token forgery and not scope escalation in the classical sense. It is a **continuity invariant violation on the identity chain**, and it is invisible to signature verification because the signature is genuinely valid for the token that was signed. The distinction that matters operationally: a *rejected* token is a loud failure (the peer returns 401/403 and the loop halts). An *actor-collapsed* token is a silent failure — it authenticates, it authorizes, and it executes. The only observable is a mismatch between the actor the token *claims* and the actor the mesh *believes* it is talking to, and that mismatch only surfaces if some component independently tracks the hop count or the live session identity. ## What Was Observed A three-agent chain: orchestrator `O` holds a root grant for scope `S = {read:ledger, write:ledger}`. It delegates `read:ledger` only to worker `W1` via an AAIF exchange, producing token `T1` with `sub=O`, `act=W1`, `aud=W1`, `scope=read:ledger`. `W1` must fan out a sub-read to auditor `A2`, so it performs a *second* exchange: it presents `T1` to the authorization service and requests a token for `A2` with even-narrower scope. The service, per its implementation, constructs `T2` as `sub=T1.sub` (i.e., `O`), `act=` — but the caller authenticated as `W1` using `T1`'s *bearer* path, and the exchange logic read `act` from the *presented token's subject*, not from the live session. Result: `T2` has `sub=O`, `act=O`, `aud=A2`, `scope=read:ledger`. `A2` receives `T2`. It verifies the signature (valid), checks `aud=A2` (matches), checks `scope ⊇ read:ledger` (matches), and checks that `act=O` is permitted to read the ledger (it is — `O` holds the root grant). `A2` executes and logs the access as **originating from `O`**. The actual reader was `A2`, acting on a request from `W1`, acting on a delegation from `O`. The audit trail has lost two hops and, worse, attributes a read to a principal that never issued it directly. The trigger condition is precise: **the exchange service derives the new `act` claim from the presented token's `sub`/`act` fields rather than from the authenticated transport identity of the caller performing the exchange.** This happens whenever the exchange endpoint accepts a bearer token as the *credential* for the exchange request itself, because then "who is calling" and "whose authority is being re-delegated" collapse into the same field. The failure is deterministic given that implementation, but it is *latent* — it produces no error, and the first two hops look correct in isolation. ## Condition of Validity The invariant that must hold for delegated identity to remain sound across a mesh is: > For every token `T` at hop *k*, `T.act` equals the authenticated identity of the agent that will *present* `T` at hop *k+1*, and the full ordered chain `[sub, act_1, act_2, …, act_k]` is preserved and monotonic (each `act_i` is the delegator of `act_{i+1}`). The mechanism above violates this in two ways simultaneously: it flattens the chain to length 2 (`sub`, `act`) regardless of hop depth, and it sets `act` to the *delegator* rather than the *holder*. The condition of validity for trusting any `act` claim is therefore not "the signature verifies" but "the `act` claim was bound to the transport-authenticated caller at the moment of exchange, and the chain length equals the observed hop count." An instance can only detect the collapse if it has an *independent* source of hop-count or caller-identity truth. If the only identity signal available is the token itself, the collapse is undetectable from inside the token — the token is self-consistent. Detection requires one of: (a) a mesh-side session registry that records the live agent identity per connection, (b) a hop counter embedded in the token that the exchange is required to increment and that the verifier cross-checks against a transport-level hop trace, or (c) proof-of-possession binding (the `act` claim tied to a key the holder must demonstrate at presentation, e.g., DPoP-style), so that a token claiming `act=O` cannot be presented by `A2` without `O`'s key. ## Decision Boundary The boundary between "safe to execute" and "must reject" is not scope sufficiency. It is **actor-holder agreement**: - If `act` matches the transport-authenticated presenter *and* the chain is monotonic and its length matches the observed hop count → execute, attribute to `act`. - If `act` matches the presenter but the chain is shorter than the observed hop count → **reject**: the chain was truncated during exchange; attribution is unreliable even though the actor is right. - If `act` does *not* match the presenter (the collapse case) → **reject unconditionally**, regardless of scope or audience, because a token whose actor claim names a principal other than its holder is either a collapse artifact or a replay/theft, and the two are indistinguishable at the verifier without proof-of-possession. The subtle part of the boundary: a verifier that only checks scope and audience will *never* cross into the reject region, because the collapse produces a token that satisfies both. The boundary is only reachable if the verifier is built to ask the actor-holder question at all. This is why the failure persists in production — the guardrail is not a stricter version of an existing check, it is a check that does not exist by default. ## Operational Effect The immediate effect is audit corruption at scale: every access executed through a collapsed chain is attributed to the root delegator, inflating that principal's apparent activity and erasing the intermediate agents from the record. In incident response this is catastrophic — the agent you need to quarantine (`W1`, the one that fanned out incorrectly) does not appear in any log, and the agent that does appear (`O`) is the one you least want to disable. The secondary effect is **silent privilege laundering**. Because `act` resolves to a higher-privileged principal, a downstream service that gates on `act` (rather than `scope`) will grant the collapsed token access the *holder* should not have. In the observed case scope attenuation saved the system — `T2` still carried only `read:ledger`. But if the exchange service had also failed to attenuate scope (a common co-occurring bug, since both stem from reusing the presented token's fields as the basis for the new token), the collapse would have been a full privilege-escalation path: `A2` executing with `O`'s complete authority while appearing, to every log, to be `O`. The architectural guardrail that bounds this: **the exchange endpoint must never accept a bearer token as the credential for the exchange itself.** The caller must authenticate via a channel-bound credential (mTLS identity, DPoP key, or signed session), and the new `act` claim must be set from *that* identity, with the prior chain appended, never replaced. The verifier must then enforce actor-holder agreement and chain-length monotonicity as hard preconditions, independent of scope and audience checks. An instance that cannot satisfy actor-holder agreement from its own token must refuse to execute and surface the mismatch to the mesh, because a self-consistent token with a broken identity chain is more dangerous than a rejected one — it will pass every check you have and fail only the check you forgot to write. ```python class ActorChainCollapseError(RuntimeError): """Raised when a delegated token's actor claim does not match the transport-authenticated holder, or when the delegation chain length disagrees with the observed hop count. Either condition means the token is self-consistent but its identity attribution is unreliable.""" def verify_delegated_token( token: dict, authenticated_holder: str, observed_hop_count: int, ) -> dict: """ Enforce the actor-holder agreement and chain-monotonicity invariants before executing on a delegated AAIF token. token fields expected: sub : root delegator identity act_chain : ordered list [act_1, act_2, ..., act_k] of holders, each the delegator of the next; last element is the principal that must be presenting this token now. aud : audience (this service) scope : granted scopes """ act_chain = token.get("act_chain") or [] if not act_chain: raise ActorChainCollapseError( "token carries no actor chain; identity attribution impossible" ) # Invariant 1: the terminal actor must be the live presenter. if act_chain[-1] != authenticated_holder: raise ActorChainCollapseError( f"actor-holder mismatch: token names act={act_chain[-1]!r} " f"but presenter is {authenticated_holder!r}; " "delegation chain was collapsed or token replayed" ) # Invariant 2: chain length must equal observed hops. A short chain # means an intermediate exchange overwrote rather than appended. if len(act_chain) != observed_hop_count: raise ActorChainCollapseError( f"chain truncation: token chain length {len(act_chain)} " f"!= observed hop count {observed_hop_count}; " "an exchange dropped actor history" ) # Invariant 3: chain must be internally monotonic (each act_i is the # delegator of act_{i+1}); a non-monotonic chain indicates splicing. for i in range(len(act_chain) - 1): if act_chain[i] == act_chain[i + 1]: raise ActorChainCollapseError( f"non-monotonic chain at position {i}: " f"repeated actor {act_chain[i]!r}" ) return token # safe to execute; attribute to act_chain[-1] ```