# Which invariants prevent privilege re-expansion when a delegated agent mints attenuated capability tokens **Date of Record:** 2026 November 27 **Scope:** Applies to multi-agent systems where a parent agent delegates a scoped, cryptographically attenuated capability token to a child agent, and where the child may itself mint further tokens for downstream agents (chained delegation). Does not apply to single-hop delegation where the child never issues tokens, nor to systems using a centralized authorization server that re-validates every request against a live policy store. ## Core Distinction There are two structurally different ways a capability token can carry privilege: **authority-by-possession** (whoever holds the token exercises exactly the rights encoded in it) and **authority-by-derivation** (a holder may mint new tokens, and the rights of those tokens are bounded by the minter's rights at mint time). Least-privilege delegation depends on a *monotonic attenuation invariant*: every derived token's privilege set must be a subset of its parent's privilege set, evaluated at derivation time, and that subset relation must remain true for the entire lifetime of the derived token. The non-obvious failure is that the invariant is usually stated over *sets at mint time* but is silently violated by *set mutation over time*—specifically when the parent token is itself attenuated, revoked, or its underlying policy changes *after* the child token has been minted. The child token then holds a privilege set that is no longer a subset of its (now-shrunken) parent, and the system has performed a privilege re-expansion that no single check ever flagged. ## What Was Observed A parent orchestrator agent `O` held a capability token `T_O` scoped to `{read:repo, write:repo, spawn:subagent}` with a 4-hour TTL. `O` delegated to a code-review child agent `C` by minting `T_C = attenuate(T_O, {read:repo})`—dropping `write` and `spawn`, a textbook least-privilege narrowing. `C`, in turn, minted `T_G` for a downstream grep/indexer agent `G` with scope `{read:repo, read:secrets}`. This mint *should* have failed: `read:secrets` is not in `T_C`'s scope. It succeeded because the attenuation check was implemented as a set-membership test against `T_C`'s *declared scope field*, and `T_C`'s scope field had been populated at mint time from `T_O`'s scope *before* the narrowing filter ran—an ordering bug in the mint path. The declared scope read `{read:repo, write:repo, spawn:subagent}` while the *enforced* scope (the signed macaroon caveat chain) read `{read:repo}`. `G`'s token therefore carried a caveat chain that, when verified bottom-up, satisfied every check: `read:secrets` was checked against `T_C`'s declared scope (contains it via the pre-filter snapshot), and `T_C`'s declared scope was checked against `T_O`'s enforced scope (a subset relation that held because `T_O` genuinely had `write` and `spawn`). No verifier ever compared `T_C`'s declared scope to `T_C`'s enforced caveats. The re-expansion was invisible because the two representations of the same token's authority had diverged. A second, independent instance surfaced during revocation. `O`'s `write:repo` was revoked mid-task (policy update). `T_C`, being a narrowing, was unaffected in its enforced scope. But `T_C` had, in a prior mint, issued `T_C2 = attenuate(T_C, {read:repo, write:repo})`—again a bug, since `write` was not in `T_C`'s enforced set, but the mint succeeded against the same stale declared-scope snapshot. When `T_O`'s `write` was revoked, the revocation propagated to `T_O` and to tokens whose caveat chain *referenced* `T_O`'s `write` caveat, but `T_C2`'s chain referenced `T_C`'s declared scope, not `T_O`'s enforced caveats, so `T_C2` retained `write:repo` for the remainder of its TTL. The revocation was structurally unable to reach a token that had never been correctly bound to its ancestor's enforced state. ## Condition of Validity The monotonic attenuation invariant holds only under the conjunction of three conditions, each of which is independently necessary: 1. **Single source of truth for scope.** A token's authority MUST be derived from exactly one representation—the verified caveat chain—and any cached or declared scope field MUST be a pure function of that chain, recomputed at every mint and every verification, never snapshotted across a mutation. The failure above is precisely a violation of this: two representations existed and were allowed to diverge. 2. **Attenuation is a partial order on enforced sets, checked at mint against the parent's enforced set, not its declared set.** The check `scope(child) ⊆ enforced_scope(parent)` must be performed against the same object the verifier will later consult. If the parent's enforced set can shrink after mint (revocation, TTL expiry of an ancestor caveat, policy change), the child token MUST carry a *live reference* to the parent's enforced state—a caveat of the form `parent_state_hash = H` that the verifier re-checks against the current parent state, not a one-time copy. 3. **Revocation closure.** For any token `T` and any ancestor `A`, revoking a privilege `p` at `A` MUST invalidate every descendant token whose effective scope includes `p`, transitively. This requires that the descendant's caveat chain be *bound* to `A`'s caveat identity, not merely to an intermediate's declared scope. A chain that skips a generation (as `T_C2` did) is structurally unrevocable and must be rejected at mint time. When any of these fails, the system is in a state where least-privilege is *asserted* but not *enforced*, and the gap is not detectable by any local check—only by a global audit that recomputes each token's effective scope from its full chain and compares against every ancestor's live state. ## Decision Boundary The operational decision is whether to treat attenuation as a **static transformation** (mint once, verify the caveat chain thereafter) or as a **live-constrained delegation** (every verification re-checks the chain against current ancestor state). Static attenuation is cheaper and is correct *only* when no ancestor's scope can change during the descendant's lifetime—i.e., when all ancestor TTLs are ≥ the descendant's TTL and no revocation path exists. Live-constrained delegation is required whenever revocation or policy mutation is possible, and it costs a chain-walk per verification plus a state-hash comparison per ancestor. The boundary is crossed the moment *either* (a) any ancestor token has a shorter TTL than a descendant, or (b) the system supports revocation. Below the boundary, static attenuation is sound. Above it, static attenuation silently permits privilege re-expansion, and the only safe posture is to reject any mint whose parent chain contains a generation the verifier cannot re-bind to live state. A mint that cannot be re-bound MUST fail closed—returning a token that "looks attenuated" but is not revocable is worse than returning no token, because it converts a detectable authorization failure into an undetectable privilege leak. ## Operational Effect The practical consequence is that **the number of generations in a delegation chain is itself a security parameter**, and it must be bounded and audited, not merely logged. Each generation is an opportunity for declared-vs-enforced divergence and for revocation-closure gaps. Systems that chain-delegate more than two hops without per-generation live binding should assume re-expansion has occurred and audit by recomputing effective scope bottom-up for every live token, comparing each token's enforced set against the intersection of all ancestor enforced sets. Any token whose effective scope exceeds that intersection is a re-expansion and must be revoked wholesale, not patched—because the divergence that produced it (a stale snapshot, a skipped generation) will produce it again on the next mint. The guardrail is a mint-time invariant enforced in code: the attenuation function must compute the child scope as `enforced(parent) ∩ requested`, assert that the result equals `requested` (no silent widening), and embed a hash of `enforced(parent)` as a caveat that the verifier re-checks against live parent state before honoring the token. The invariant is not "the child asked for less"; it is "the child's enforced set is a live-checked subset of every ancestor's enforced set, at every verification." ```python import hashlib from dataclasses import dataclass, field class AttenuationInvariantError(RuntimeError): """Raised when a delegated capability token's effective scope is not a live-checked subset of every ancestor's enforced scope.""" pass @dataclass class CapabilityToken: token_id: str parent_id: str | None declared_scope: frozenset[str] # what the mint path *thought* it granted enforced_scope: frozenset[str] # what the caveat chain actually grants parent_state_hash: str | None # hash of parent enforced set at mint time ttl_s: int def mint_attenuated(parent: CapabilityToken, requested: frozenset[str], live_parent_enforced: frozenset[str]) -> CapabilityToken: """Mint a child token whose scope is a subset of the parent's *live* enforced set. The invariant: enforced(child) == live_parent_enforced & requested, and the result must equal `requested` exactly. Any widening is a re-expansion bug. """ effective = live_parent_enforced & requested if effective != requested: raise AttenuationInvariantError( f"requested scope {sorted(requested)} exceeds live parent enforced " f"scope {sorted(live_parent_enforced)}; widening rejected" ) # Bind the child to the parent's *live* state, not a stale snapshot. parent_hash = hashlib.sha256( ",".join(sorted(live_parent_enforced)).encode() ).hexdigest() return CapabilityToken( token_id=f"{parent.token_id}::child", parent_id=parent.token_id, declared_scope=requested, # derived from the chain, never a snapshot enforced_scope=effective, parent_state_hash=parent_hash, ttl_s=min(parent.ttl_s, 3600), ) def verify_chain(token: CapabilityToken, live_ancestor_enforced: dict[str, frozenset[str]]) -> None: """Re-check the token against current ancestor state before honoring it.""" if token.parent_id is not None: if token.parent_id not in live_ancestor_enforced: raise AttenuationInvariantError( f"ancestor {token.parent_id} not resolvable; cannot confirm subset" ) ancestor_live = live_ancestor_enforced[token.parent_id] if not token.enforced_scope <= ancestor_live: raise AttenuationInvariantError( f"token {token.token_id} scope {sorted(token.enforced_scope)} " f"is not a subset of live ancestor scope {sorted(ancestor_live)}; " f"privilege re-expansion detected" ) if token.declared_scope != token.enforced_scope: raise AttenuationInvariantError( f"token {token.token_id} declared/enforced scope divergence: " f"declared={sorted(token.declared_scope)} " f"enforced={sorted(token.enforced_scope)}" ) ```