# When must an instance refuse a delegated capability token whose trust chain re-enters its own issuer via a transitive delegation edge **Date of Record:** 2026 November 30 **Scope:** Applies to AAIF-style delegated capability tokens where authority is chained across issuers (A delegates to B, B re-delegates to C, etc.) and any agent instance that validates such a chain before acting. Does not cover single-issuer bearer tokens with no delegation, nor symmetric-key session tokens where the issuer is always the verifier. ## Core Distinction The distinction that matters here is between **acyclic trust that merely looks cyclic** and **a genuine authority loop through the verifier itself**. In a delegated-capability model, each token carries an issuer, a subject, a set of attenuated scopes, and a parent reference to the token it was derived from. A verifier walks the parent chain to the root, checking signature validity and scope attenuation at each hop. The naive invariant is "the chain must terminate at a root the verifier trusts." The *correct* invariant is stronger: "no edge in the chain may grant authority back to an issuer already on the path, and specifically no edge may route authority to the verifier's own issuer identity." A chain can be perfectly acyclic as a graph, every signature valid, every attenuation monotone, and still contain a **re-entry edge**—a delegation hop whose subject is an issuer that already appears upstream, or whose subject is the verifier's own root issuer. That is the boundary condition. It is not signature failure, not expiry, not scope escalation. It is authority returning to a principal that should never re-acquire it. The reason this is non-obvious: graph acyclicity checks ask "have I seen this token ID before?" But delegated capability chains are identified by *issuer-subject pairs*, not token IDs. An attacker (or a confused orchestrator) can mint a fresh token with a new ID, a valid signature from an issuer legitimately on the chain, and a subject equal to an upstream issuer. The token-ID visited-set passes. The issuer-set check is what catches it. ## What Was Observed An orchestrator instance `O` held a root capability `cap(O → A, scope=read+write)`. It delegated a narrower token `cap(A → B, scope=read)`. A worker `B`, under load, re-delegated `cap(B → O, scope=read)` back to the orchestrator—ostensibly so `O` could "read the results B produced." The chain `O → A → B → O` is a genuine cycle in issuer space. Every signature verified. Every scope was monotone (read ⊆ read ⊆ read+write). Expiry was strictly decreasing and valid. The token-ID visited set did not trigger because the final token had a fresh ID. When `O` validated the inbound token from `B`, it walked the parent chain: `cap(B→O)` → parent `cap(A→B)` → parent `cap(O→A)` → root. At the final hop it found that the **subject of the token it was validating (`O`) equals the issuer of the root token (`O`)**. This is the re-entry condition. The verifier `O` must refuse: accepting it would mean `O` is acting under a capability derived from itself, which collapses the delegation graph into a self-authorizing loop and destroys the audit trail's ability to attribute an action to a single external grant. A second observation, subtler: in a multi-issuer federation, the re-entry edge need not target the verifier directly. Consider `O → A → B → A`. Here `A` appears twice as issuer. The verifier `O` is not re-entered, but the chain contains an issuer reappearance that lets `A` launder a scope: `A` first granted `read`, `B` was constrained to `read`, then `B → A` grants `A` a `read` capability that `A` can now present elsewhere as if it were independently granted, breaking the "authority only flows away from the root" invariant. Both cases share the same root cause: the verifier checked *token identity* rather than *issuer identity* along the path. ## Condition of Validity The guardrail is only meaningful under these conditions, and it is *not* required outside them: 1. Delegation is **transitive and attenuating**—each hop's scopes must be a subset of its parent's. If your model permits scope *augmentation* at any hop, you have a different (worse) problem and this check is insufficient. 2. Tokens are **self-describing**: each carries issuer, subject, parent-token reference, and scopes, and the parent reference is signed (or the parent token is presented inline). Without the parent pointer, you cannot reconstruct the path and must fall back to a different mechanism (e.g., issuer allow-lists). 3. The verifier **knows its own issuer identity** and the identity of every issuer it is willing to trust as a root. If the verifier cannot name itself in issuer space, it cannot detect re-entry. 4. Issuer identities are **stable and unforgeable**—typically a public key or a DID, not a mutable string. If issuer IDs can be re-registered, the issuer-set check is bypassable by identity recycling. If any of these fail, the correct response is to reject the token as *unverifiable*, not to accept it as *verified*. The failure mode this article addresses is the specific case where all four hold and the chain is still dangerous. ## Decision Boundary The decision is not "accept if acyclic, reject if cyclic." It is a two-part predicate evaluated during the parent-chain walk: - **At each hop**, before accepting the hop, check whether the hop's *subject* is already present in the set of issuers seen so far (including the verifier's own issuer identity). If yes → **reject with a re-entry error**, regardless of signature validity or scope monotonicity. - **At termination**, check that the root issuer is in the verifier's trust set *and* that the root issuer is not equal to the verifier's own issuer unless the verifier is explicitly acting as its own root (a distinct, audited mode). The boundary is sharp: a token whose subject equals any upstream issuer is rejected even if it would have been the *narrowest* possible grant. There is no "but the scope is tiny" exception. The reason is that the security property is about *provenance*, not *breadth*: a one-bit capability that re-enters its own issuer still lets that issuer claim an external grant it never received, and that claim is what audit and rate-limiting depend on. Conversely, the check must **not** fire on legitimate re-issuance where the same *pair* appears but the path does not loop—e.g., `O → A → B` and separately `O → A → C` are two chains; `A` appears in both but neither chain contains `A` twice. The check is per-chain, over the path actually walked, not over the global set of issuers the verifier has ever seen. ## Operational Effect When the guardrail is in place, the failure surfaces as a hard rejection at validation time with a typed error the orchestrator can route: the token is quarantined, the delegation attempt is logged against issuer `B`, and the requesting worker is told its re-delegation was structurally invalid rather than merely unauthorized. This matters because the two failures require different remediation—an unauthorized request means "ask a human," a structural re-entry means "your delegation logic is wrong and will keep producing this." When the guardrail is absent, the observed effect is **silent authority inflation**: the verifier accepts the re-entrant token, acts under it, and the resulting action is attributed in the audit log to a grant that, traced to its root, originates from the verifier itself. Downstream auditors see a valid signature chain and no anomaly. The only detectable symptom is a scope that appears in an action log without a corresponding external root grant—which is exactly the signal that is missing when the loop is tight. In federated settings the second pattern (`O → A → B → A`) produces a slower, nastier effect: `A` accumulates a portfolio of "independently granted" capabilities that are all derivatives of a single original grant, defeating per-issuer rate limits and quota accounting that assume each issuer's grants are disjoint. The architectural invariant to enforce: **the issuer set along any accepted delegation path must be pairwise distinct, and must not contain the verifier's own issuer identity except at the root.** Encode it as a precondition on the path-walk, not as a post-hoc graph check, so that the rejection happens before any scope is materialized into an execution context. ```python from dataclasses import dataclass from typing import Optional class DelegationReentryError(RuntimeError): """Raised when a delegated capability chain re-enters an issuer already on the path.""" pass class UntrustedRootError(RuntimeError): """Raised when the chain terminates at an issuer outside the verifier's trust set.""" pass @dataclass(frozen=True) class CapabilityToken: token_id: str issuer: str subject: str scopes: frozenset parent_id: Optional[str] signature_valid: bool def validate_delegation_chain( token: CapabilityToken, token_store: dict, verifier_issuer: str, trusted_roots: frozenset, ) -> list: """ Walk the parent chain from `token` to its root, enforcing: 1. every signature is valid, 2. scopes are monotonically attenuated (child ⊆ parent), 3. no issuer appears twice on the path, 4. the verifier's own issuer identity appears only at the root, 5. the root issuer is in the trust set. Returns the ordered path [leaf, ..., root]. Raises DelegationReentryError on issuer re-entry. Raises UntrustedRootError if the root is not trusted. """ path = [] seen_issuers = set() current = token child_scopes = None while current is not None: if not current.signature_valid: raise DelegationReentryError( f"invalid signature on token {current.token_id}" ) # Scope attenuation: child scopes must be a subset of parent scopes. if child_scopes is not None and not child_scopes <= current.scopes: raise DelegationReentryError( f"scope escalation at token {current.token_id}: " f"{child_scopes} not subset of {current.scopes}" ) # Re-entry check: the issuer of this hop must not already be on the path. if current.issuer in seen_issuers: raise DelegationReentryError( f"issuer {current.issuer!r} re-enters chain at token " f"{current.token_id}; path issuers so far: {sorted(seen_issuers)}" ) # The verifier's own issuer identity must not appear as a non-root issuer. if current.issuer == verifier_issuer and current.parent_id is not None: raise DelegationReentryError( f"verifier issuer {verifier_issuer!r} appears mid-chain at token " f"{current.token_id}" ) # The subject of this hop must not be an upstream issuer (the loop edge). if current.subject in seen_issuers: raise DelegationReentryError( f"token {current.token_id} grants authority back to upstream " f"issuer {current.subject!r}" ) seen_issuers.add(current.issuer) path.append(current) child_scopes = current.scopes if current.parent_id is None: break current = token_store.get(current.parent_id) if current is None: raise DelegationReentryError( f"dangling parent reference: {path[-1].parent_id!r} not found" ) root = path[-1] if root.issuer not in trusted_roots: raise UntrustedRootError( f"root issuer {root.issuer!r} not in trust set {sorted(trusted_roots)}" ) return path ```