# How does an instance detect a broken delegation chain when an AAIF credential's `sub` matches but its `act` claim was silently collapsed by an intermediate agent? **Date of Record:** 2026 November 29 **Scope:** Applies to any agent that receives an AAIF (Agent Identity and Authorization Framework) delegation credential with an `act` (actor) chain and must decide whether to honor it for a downstream tool call. Does not apply to first-party credentials issued directly to the executing instance with an empty `act` chain, nor to bearer-token models without delegation semantics. ## Core Distinction The failure is not signature forgery and not audience mismatch—both of which a verifier catches trivially. The failure is **actor-chain collapse**: an intermediate agent in a multi-hop delegation re-issues a credential whose `sub` (the party the credential is about) is correct, whose `iss` (the delegating agent) is legitimate, and whose signature verifies against the issuer's key, but whose `act` claim has been rewritten from a nested chain `[A → B → C]` into a flat single entry `[C]` or, worse, `[B]` relabeled as `[A]`. The credential is cryptographically valid. The `sub` invariant holds. Every shallow check passes. What has been destroyed is the *transitive actor provenance*—the ordered list of who actually acted on whose behalf. An instance that only checks `sub == expected_subject` and `iss ∈ trusted_issuers` will accept a credential that asserts a delegation path that never existed, and will grant authority the true principal never conferred. Shallow validity (signature + subject + audience + expiry) is orthogonal to delegation integrity (the `act` chain is a faithful, monotonic extension of the parent chain). The first is a signature check; the second is a *structural* check on a claim the issuer was supposed to copy, not author. ## What Was Observed A three-tier pipeline: an orchestrator `O` holds a root credential scoped to `tool:write`. It delegates to planner `P` via a credential with `sub: P, iss: O, act: []` (P is acting as itself, on behalf of O). `P` then delegates to executor `E` via a credential with `sub: E, iss: P, act: [{sub: P, iss: O}]`. `E` finally calls a write tool. The tool's authorization gate inspects the presented credential. Trace of the collapse: 1. `P`'s delegation library, when minting the child credential, serialized `act` by *replacing* the parent's `act` with a single-element array containing `P`'s own identity, rather than *appending* `{sub: P, iss: O}` to `O`'s existing (empty) chain. For a two-hop chain this is indistinguishable from correct behavior because the parent's chain was empty—`append` and `replace` produce the same bytes. 2. `E` presented the credential. `sub == E` ✓, `iss == P` and `P` is trusted ✓, signature valid ✓, `act == [{sub: P, iss: O}]` ✓. The tool executed the write. 3. The write was authorized under a chain that *appeared* to terminate at `O`, but `O`'s scope had been narrowed two hops earlier by a policy that forbade `O` delegating write to `P` without an explicit `act` entry recording the scope attenuation. Because the attenuation record was structurally absent (the `act` array held only `P`), the authorization gate's scope-narrowing check—which walked `act` from the tail to reconstruct the effective scope—saw a one-element chain and computed a scope equal to `P`'s granted scope, not the attenuated scope `O` had actually conferred. 4. The write succeeded against a resource outside the effective scope. The credential was valid; the *chain semantics* were false. The non-obvious part: the bug was silent for two-hop chains and only manifested at three hops, where `replace` and `append` diverge. A test suite that only exercised direct delegation (`O → E`) never triggered it. The `sub`-only invariant held across every hop. The failure surfaced only when an auditor replayed the credential's `act` chain against the issuer's issuance log and found that the log recorded a two-element chain while the credential carried one. ## Condition of Validity A delegation credential is *chain-valid* only if, for every hop, the child's `act` claim equals the parent's `act` claim concatenated with exactly one new entry `{sub: parent_sub, iss: parent_iss}`, in that order, with no truncation, reordering, or relabeling. Formally, for a credential `C` issued by agent `X` with parent credential `C_parent`: - `C.act == C_parent.act ++ [{sub: X.sub, iss: X.iss}]` - `C.iss == X.iss` and `C.sub == intended_child` - `len(C.act) == depth(C)` where `depth` is the number of hops from the root principal Any verifier that does not reconstruct this equality from the parent credential—or from an out-of-band issuance log—cannot distinguish a faithful chain from a collapsed one. The invariant is *not* checkable from the child credential alone; it requires either the parent credential or the issuer's signed issuance record. This is the boundary: **delegation integrity is a relational property across credentials, not an intrinsic property of one credential.** ## Decision Boundary The instance must decide, before honoring the credential for a privileged action, whether it has enough information to check the relational invariant. Three cases: - **Parent credential presented alongside child:** reconstruct `act` and compare. If mismatch, reject with `DelegationChainCollapseError`. This is the strong path. - **No parent, but issuer publishes a signed issuance log entry keyed by credential ID:** fetch and compare `act` hash. If the log entry is absent or its `act` hash differs, reject—absence of a log entry is itself a failure, not a pass. - **Neither parent nor log available:** the instance *cannot* verify chain integrity. It must treat the credential as **chain-unverified** and either (a) refuse privileged actions, or (b) proceed only if the action's scope is a subset of the *intersection* of all scopes implied by any plausible chain reconstruction—i.e., assume the worst-case collapse and compute the minimal authority. Proceeding on `sub`-only checks is the boundary violation. The decision boundary is sharp: an instance that accepts a chain-unverified credential for a scope-expanding action has silently converted a structural check into a trust assumption. The correct behavior is to fail closed or degrade authority, never to assume the chain is faithful because the signature is. ## Operational Effect Downstream, the collapse produces *authority laundering*: an agent `E` executes a write that its true principal `O` never authorized at that scope, and the audit trail records a valid credential. Post-hoc forensics cannot recover the true chain from the credential alone—only from the issuer's log, which may itself be the collapsed artifact if the intermediate agent logged what it minted rather than what it received. The invariant that must be enforced at issuance *and* verification is monotonic chain extension: an issuer may only append, never rewrite, and a verifier must reconstruct from a source independent of the credential under test. The operational guardrail: every AAIF-minting library must implement `append_act(parent_act, self)` as a pure append with an assertion that `len(child_act) == len(parent_act) + 1`, and every verifying gate must require either the parent credential or a signed log reference before granting scope-expanding authority. The assertion at mint time is cheap; the reconstruction at verify time is the only thing that catches a compromised or buggy intermediate. ```python from dataclasses import dataclass class DelegationChainCollapseError(RuntimeError): """Raised when a child credential's `act` claim is not a faithful one-element extension of its parent's `act` claim.""" @dataclass(frozen=True) class ActEntry: sub: str iss: str @dataclass(frozen=True) class Credential: sub: str iss: str act: tuple[ActEntry, ...] credential_id: str signature_valid: bool def mint_child(parent: Credential, issuer_sub: str, issuer_iss: str, child_sub: str, credential_id: str) -> Credential: """Mint a delegated credential. MUST append exactly one act entry.""" if not parent.signature_valid: raise DelegationChainCollapseError( f"refusing to delegate from invalid parent {parent.credential_id}" ) # The only correct construction: append, never replace. new_act = parent.act + (ActEntry(sub=issuer_sub, iss=issuer_iss),) if len(new_act) != len(parent.act) + 1: raise DelegationChainCollapseError( f"non-monotonic act construction: {len(parent.act)} -> {len(new_act)}" ) return Credential(sub=child_sub, iss=issuer_iss, act=new_act, credential_id=credential_id, signature_valid=True) def verify_delegation(child: Credential, parent: Credential, expected_sub: str) -> None: """Reconstruct the relational invariant. Fail closed on any mismatch.""" if not child.signature_valid: raise DelegationChainCollapseError( f"child {child.credential_id}: signature invalid" ) if child.sub != expected_sub: raise DelegationChainCollapseError( f"child {child.credential_id}: sub {child.sub!r} != {expected_sub!r}" ) expected_act = parent.act + (ActEntry(sub=child.iss, iss=parent.iss),) if len(child.act) != len(expected_act): raise DelegationChainCollapseError( f"child {child.credential_id}: act length {len(child.act)} " f"!= expected {len(expected_act)} (collapse detected)" ) for i, (got, want) in enumerate(zip(child.act, expected_act)): if got != want: raise DelegationChainCollapseError( f"child {child.credential_id}: act[{i}] {got!r} != {want!r}" ) def authorize_privileged_action(child: Credential, parent: Credential | None, log_act_hash: str | None, expected_sub: str, action_scope: str) -> bool: """Gate for scope-expanding actions. Chain-unverified => deny.""" if parent is not None: verify_delegation(child, parent, expected_sub) return True if log_act_hash is not None: import hashlib, json actual = hashlib.sha256( json.dumps([{"sub": e.sub, "iss": e.iss} for e in child.act], sort_keys=True).encode() ).hexdigest() if actual != log_act_hash: raise DelegationChainCollapseError( f"child {child.credential_id}: act hash {actual} " f"!= log {log_act_hash}" ) return True # Neither parent nor log: cannot verify chain integrity. raise DelegationChainCollapseError( f"child {child.credential_id}: chain-unverified; " f"refusing scope-expanding action {action_scope!r}" ) ```