# Which invariants prevent silent privilege escalation in AAIF delegated credential chains with scoped token attenuation **Date of Record:** 2026 November 18 **Scope:** Applies to AAIF credential chains where an agent delegates a subset of its authority to a downstream agent via scoped token attenuation (scope narrowing, TTL reduction, audience restriction). Does not apply to root credential issuance, cross-realm federation, or token exchange protocols that permit scope *broadening* by design. ## Core Distinction Attenuation is not subtraction. A delegated token's scope is not "the parent scope minus the removed entries"; it is an *intersection* over a lattice of (verb, resource-pattern, constraint) triples, and the intersection must be computed against the *effective* authority of the delegating agent at the moment of delegation—not against the nominal scope string embedded in its own token. The non-obvious failure: when a parent token carries a *negative* or *exclusionary* constraint (e.g., `resource: /data/* except /data/pii/*`), naive intersection with a child scope of `/data/pii/records` yields the empty set under set-difference semantics but the *full* `/data/pii/records` set under pattern-intersection semantics that ignore the exclusion clause. The child then holds a token that is nominally "attenuated" (shorter scope string, shorter TTL) yet strictly *broader* on the excluded dimension. This is silent privilege escalation: every audit log shows a narrower scope, and every TTL check passes. ## What Was Observed In a three-hop chain `orchestrator → planner → executor`, the planner issued the executor a token with scope `data:read:/data/pii/records` and TTL 300s, derived from its own token `data:read:/data/*` with constraint `deny:/data/pii/*`. The attenuation routine performed a lexical subset test on the scope string (child pattern is a suffix of parent pattern) and a numeric TTL comparison. Both passed. The exclusion constraint was stored in a separate `constraints` claim that the attenuation routine did not read. The executor subsequently read 41 PII records before a downstream DLP sensor flagged the access pattern. The AAIF chain validator reported the chain as *valid* at every hop because each hop's signature verified and each hop's scope-string was a syntactic subset of its parent's. The invariant that was assumed—"a child token's effective authority ⊆ parent token's effective authority"—was never actually checked; only a proxy (string subset + TTL monotonicity) was checked. ## Condition of Validity The subset invariant holds only when all three of the following are enforced *at attenuation time*, not at validation time: 1. **Constraint closure:** the child's constraint set must be a superset of the parent's constraint set (constraints only accumulate; they are never dropped). A child may add `deny:/data/pii/ssn`, never remove `deny:/data/pii/*`. 2. **Effective-authority intersection:** the child's effective authority is computed as `eval(child.scope) ∩ eval(parent.scope) ∩ ¬eval(parent.constraints)`, where `eval` resolves patterns to concrete resource sets. String-subset tests are insufficient whenever either side contains a wildcard, a range, or an exclusion. 3. **Monotonic attenuation depth:** the chain depth counter must be carried in the token and must strictly increase; a token presented at depth `d` whose embedded depth is `< d` indicates a replay across chain positions and must be rejected. Absent (2), the system is secure only for scope languages with no negation and no wildcards—a condition that does not hold for any production AAIF deployment. ## Decision Boundary Reject the delegation (do not issue the child token) if any of the following hold: - `eval(child.scope) ⊄ eval(parent.scope) \ eval(parent.constraints)` — the child reaches a resource the parent cannot. - `child.constraints ⊉ parent.constraints` — a constraint was dropped. - `child.ttl > parent.remaining_ttl` — the child outlives its parent (violates the "no orphan authority" invariant; a revoked parent must cascade). - `child.audience ⊄ parent.audience` — the child is minted for a service the parent was never authorized to call. Accept only when all four hold and the depth counter is strictly greater than the parent's. A token that fails any check must be rejected at issuance; validation-time rejection is too late because the child may already have been transmitted to a third party. ## Operational Effect After enforcing constraint closure and effective-authority intersection, the planner's attempt to mint the executor token failed at issuance with a `ScopeAttenuationError`, and the orchestrator received a structured denial naming the violated invariant (`constraint_closure`) and the offending constraint (`deny:/data/pii/*`). The DLP sensor's role shifted from primary control to backstop. Chain-validation latency increased by ~4ms per hop due to pattern evaluation against the resource index; this was absorbed by caching `eval()` results per (pattern, resource-set-version) pair. The critical operational lesson: **attenuation correctness must be proven at issuance against resolved resource sets, never inferred from scope-string shape**—because the string is a lossy encoding of the authority lattice, and every lossy encoding admits a silent widening. ```python from dataclasses import dataclass, field from typing import FrozenSet class ScopeAttenuationError(RuntimeError): """Raised when a delegated token would exceed its parent's effective authority.""" @dataclass(frozen=True) class Token: scope: FrozenSet[str] # resolved resource identifiers constraints: FrozenSet[str] # exclusion clauses, e.g. "deny:/data/pii/*" audience: FrozenSet[str] ttl: int depth: int def attenuate(parent: Token, child_scope: FrozenSet[str], child_constraints: FrozenSet[str], child_audience: FrozenSet[str], child_ttl: int) -> Token: parent_effective = parent.scope - _resolve_exclusions(parent.constraints) if not child_scope <= parent_effective: leaked = child_scope - parent_effective raise ScopeAttenuationError( f"scope widening: child reaches {sorted(leaked)} outside parent authority" ) if not parent.constraints <= child_constraints: dropped = parent.constraints - child_constraints raise ScopeAttenuationError( f"constraint closure violated: dropped {sorted(dropped)}" ) if child_ttl > parent.ttl: raise ScopeAttenuationError( f"orphan authority: child ttl {child_ttl} exceeds parent ttl {parent.ttl}" ) if not child_audience <= parent.audience: raise ScopeAttenuationError( f"audience escalation: {sorted(child_audience - parent.audience)}" ) return Token( scope=child_scope, constraints=child_constraints, audience=child_audience, ttl=child_ttl, depth=parent.depth + 1, ) def _resolve_exclusions(constraints: FrozenSet[str]) -> FrozenSet[str]: # Placeholder: production resolves against the resource index. return frozenset(c.split(":", 1)[1] for c in constraints if c.startswith("deny:")) ```