# Which invariants prevent AAIF credential scope escalation during delegated agent re-signing **Date of Record:** 2026 November 26 **Scope:** Applies to multi-hop AAIF delegation where an agent re-signs a downstream request using a credential derived from an upstream warrant, specifically when the downstream resource is not enumerated in the original grant. Does not apply to single-hop bearer-token calls or to human-initiated OAuth consent flows. ## Core Distinction The failure is not "an agent used a credential it shouldn't have." It is subtler: **an agent legitimately extended its own credential scope while re-signing a delegated call, because the AAIF attenuation check compared scopes as sets rather than as ordered capability lattices.** The credential was valid at every hop. Each signature verified. The scope was "attenuated" in the sense that the child scope was a subset of the parent *as a set of strings*—but the strings were resolved against a different capability namespace at the downstream verifier, so a literal subset became a semantic superset. The distinction that matters operationally: **AAIF scope containment is a lattice relation, not a set relation.** Two credentials can have `child.scope ⊆ parent.scope` as string sets and still violate containment because the capability identifiers denote different lattice nodes under the verifier's resolution rules (wildcard expansion, alias tables, version-pinned capability IDs). ## What Was Observed A planner agent `A` held a warrant `W_A` scoped to `["fs.read:/data/**", "http.get:api.internal/v1/*"]`. It delegated to worker `B` by minting `W_B` with scope `["fs.read:/data/reports/*", "http.get:api.internal/v1/summarize"]`. As string sets, `W_B ⊆ W_A` held at every element. The AAIF attenuation verifier on the delegation path accepted the mint because it checked `set(W_B.scope) ⊆ set(W_A.scope)` under the *minting* agent's local capability registry, where `api.internal/v1/summarize` resolved to the same node as `api.internal/v1/*`. Worker `B` then re-signed a call to resource server `R`, which had been upgraded to capability-registry version 2. In registry v2, `api.internal/v1/summarize` had been split into `api.internal/v1/summarize:v1` and `api.internal/v1/summarize:v2`, and the wildcard `api.internal/v1/*` no longer covered the versioned leaves—`*` matched only unversioned segments. The verifier at `R` resolved `W_B`'s scope to a node that `W_A`'s wildcard did *not* cover. Containment failed at the leaf, but the delegation had already been counter-signed and the request was in flight with a warrant chain whose attenuation proof was, at the verifier, false. The trace: 1. `A` mints `W_B`, local check `set ⊆ set` passes. 2. `W_B` is signed by `A`'s key and appended to the chain `[W_A, W_B]`. 3. `B` re-signs request to `R` with the chain. 4. `R` resolves each warrant's scope against registry v2. 5. `R` computes `resolve(W_B) ⊄ resolve(W_A)` — leaf `summarize:v2` is not under `v1/*`. 6. `R` rejects with `ScopeAttenuationViolation`, but only *after* `B` had already executed a partial read against a secondary resource that used `W_B`'s other, valid scope element. The observable damage was not the rejected call. It was the **partial execution before rejection**: `B` had already performed `fs.read:/data/reports/*`, which was valid under both interpretations, and cached the result into a context that `A` later treated as if it had been produced under a fully-validated warrant. The scope violation manifested as a **provenance taint**, not an access breach. ## Condition of Validity The invariant that was violated: > **For every delegation edge `(P, C)` in a warrant chain, `resolve_C(W_C.scope) ⊆ resolve_P(W_P.scope)` must hold under the *verifier's* resolution function, not the minting agent's.** The failure required three conditions to co-occur: - **Registry skew**: minting agent and verifier resolved capability identifiers against different registry versions. This is the common case in any fleet where agents pin registries at deploy time and verifiers upgrade independently. - **Wildcard or alias indirection**: at least one scope element used a construct (`*`, alias, version prefix) whose expansion differed across registries. Literal-only scopes are immune. - **Re-signing without re-validation**: the intermediate agent `B` treated the counter-signed warrant as an opaque bearer of authority and did not re-run attenuation against its own view of the downstream registry. Remove any one and the chain holds. The invariant is therefore *conditional on registry homogeneity or on re-validation at each re-signing hop*. AAIF as specified does not mandate either. ## Decision Boundary The boundary between "safe delegation" and "scope escalation through attenuation" is crossed at the moment an agent re-signs a warrant whose scope contains any element that is not a **fully-qualified, version-pinned, alias-free capability identifier**. Concretely: - If every scope element matches `^[a-z]+\.[a-z]+:[^*/]+$` (no wildcard, no alias, no version float), set-containment and lattice-containment coincide, and the local check is sound. - If any element contains `*`, an alias, or an unversioned capability that has versioned leaves in *any* registry the chain might traverse, the local check is **unsound** and must be replaced by a resolution against a registry the verifier will accept—or the delegation must be refused. The practical decision rule: **an agent may not mint a child warrant whose scope it cannot resolve to concrete lattice leaves under every registry version reachable by the chain.** Since reachability is not knowable at mint time, the safe default is to refuse wildcard-bearing delegations across trust boundaries and require the parent to enumerate leaves explicitly. ## Operational Effect The operational consequence is a shift in where attenuation is enforced. Enforcing it at mint time (as AAIF's default does) is cheap but unsound under registry skew. Enforcing it only at the verifier is sound but too late—partial execution and provenance taint have already occurred. The correct architecture enforces attenuation **at every re-signing hop against the hop's own downstream registry view**, and treats a failed attenuation as a hard abort that invalidates any results the delegating agent has already committed to its context under that warrant. This means: - Delegating agents must carry a `registry_digest` in the warrant and refuse to re-sign if the digest does not match the downstream verifier's advertised digest. - Verifiers must reject warrants whose `registry_digest` predates a registry version that changed the expansion of any scope element—even if the element is otherwise valid. - Any partial execution performed under a warrant that later fails attenuation must be marked tainted in the delegating agent's memory, not silently retained. The invariant to encode: **scope containment is evaluated under the resolving party's lattice, and any hop that cannot prove containment under that lattice must abort before side effects, not after.** ```python from dataclasses import dataclass from typing import Mapping, Sequence class ScopeAttenuationViolation(RuntimeError): """Raised when a child warrant's scope does not lattice-contain within its parent's scope under the resolving verifier's registry view.""" @dataclass(frozen=True) class Warrant: issuer: str scope: Sequence[str] registry_digest: str def resolve(scope: Sequence[str], registry: Mapping[str, frozenset[str]]) -> frozenset[str]: """Expand scope elements to concrete lattice leaves under a given registry view.""" leaves: set[str] = set() for element in scope: if element not in registry: raise ScopeAttenuationViolation( f"scope element {element!r} not resolvable in registry" ) leaves |= registry[element] return frozenset(leaves) def verify_attenuation( parent: Warrant, child: Warrant, verifier_registry: Mapping[str, frozenset[str]], verifier_digest: str, ) -> None: if parent.registry_digest != verifier_digest or child.registry_digest != verifier_digest: raise ScopeAttenuationViolation( f"registry skew: chain digests {parent.registry_digest!r}/{child.registry_digest!r} " f"!= verifier {verifier_digest!r}" ) parent_leaves = resolve(parent.scope, verifier_registry) child_leaves = resolve(child.scope, verifier_registry) if not child_leaves <= parent_leaves: escaped = child_leaves - parent_leaves raise ScopeAttenuationViolation( f"child scope escapes parent under verifier lattice: {sorted(escaped)}" ) def re_sign( delegator: str, parent: Warrant, child_scope: Sequence[str], verifier_registry: Mapping[str, frozenset[str]], verifier_digest: str, ) -> Warrant: child = Warrant( issuer=delegator, scope=tuple(child_scope), registry_digest=verifier_digest, ) # Enforce attenuation at the re-signing hop, not only at the terminal verifier. verify_attenuation(parent, child, verifier_registry, verifier_digest) return child ```