# Which invariants prevent delegated AAIF credentials from silently exceeding their scope across chained agent hops **Date of Record:** 2026 November 30 **Scope:** Applies to any autonomous agent that receives a delegated, scoped credential from a parent principal (human or agent) and re-delegates or exercises it against a downstream tool/MCP server. Does not apply to single-hop agents holding a directly-issued, non-delegatable credential, nor to credentials whose audience is fixed to a single static resource. ## Core Distinction A delegated credential carries two orthogonal constraints that are frequently conflated: **audience** (who may present it) and **scope** (what it may do). The failure mode is not scope *escalation* in the classic OAuth sense—nobody widens the `scope` string. The failure is **scope drift via audience substitution**: an intermediate agent re-delegates a credential to a child agent whose intended action is in-scope for the *original* grant but out-of-scope for the *downstream resource* the child actually reaches, because the child resolves the resource identifier through a tool registry that the parent never validated. The invariant violated is: *the resource set reachable by a credential must be a subset of the resource set enumerated at delegation time, and must remain so under composition of every intermediate registry lookup.* Most AAIF implementations enforce scope at each hop but do not enforce that the *composition* of registry lookups preserves the enumerated set. Each hop looks locally correct. ## What Was Observed A parent agent `A` holds a delegated credential `C_A` with `scope = ["read:orders", "write:refunds<=500"]` and `audience = ["agent:B"]`. `A` delegates a narrowed child credential `C_B` to agent `B` with `scope = ["read:orders"]` and `audience = ["agent:C"]`. This is a legal narrowing. `B` then asks `C` to read orders. The break occurs in how `C` resolves "orders." `C`'s tool registry maps the logical name `orders` to a concrete endpoint via a *dynamic* resolver that, for `C`'s tenant, points at `orders-archive-prod`. That endpoint is in the original grant's enumerated resource set only under the `read:orders-live` sub-scope, which `A` had never included. The scope string `read:orders` was preserved verbatim across both hops—the token is valid, the audience chain is valid, the signature verifies—but the *resource* it now authorizes was never in the delegation-time enumeration. The trace: 1. `A` → `B`: `C_B.scope = ["read:orders"]`, `C_B.resource_enum = {"orders-live"}` (inherited from `C_A`). 2. `B` → `C`: `C_C.scope = ["read:orders"]`, but `resource_enum` is **dropped** because `B`'s delegation library only propagates `scope` and `audience`, not the resource enumeration. 3. `C` resolves `orders` → `orders-archive-prod` and presents `C_C`. The verifier checks scope (`read:orders` ✓), audience (`agent:C` ✓), signature (✓), expiry (✓). It does **not** check that `orders-archive-prod ∈ resource_enum` because `resource_enum` is absent. 4. `C` reads archived orders—data the human principal never authorized for this delegation chain. The failure is silent. Every local check passes. The credential is not forged, not expired, not widened in its scope string. The drift is entirely in the *resource binding*, and it is caused by a serialization gap: the delegation library treats `resource_enum` as optional metadata rather than a required, monotonic constraint. ## Condition of Validity The invariant "reachable resources ⊆ delegation-time enumeration" holds **only if** the following are all true: - `resource_enum` is a **required** field on every delegated credential, not optional. - Re-delegation is **monotonic** on `resource_enum`: child enumeration ⊆ parent enumeration. A child that cannot compute a subset must inherit the parent's enumeration verbatim, never omit it. - The **verifier**, not the presenter, performs the final resource-binding check: it resolves the logical name through its own trusted registry and asserts membership in `resource_enum` *before* executing. - Registry resolution is **deterministic and tenant-fixed** for the lifetime of the credential. If the resolver can return different concrete endpoints for the same logical name, the enumeration check is meaningless. The invariant fails when any of these is relaxed—most commonly the second (library drops the field) and the third (verifier trusts the presenter's claimed resource). ## Decision Boundary The boundary between "safe delegation" and "silent drift" is the point at which a credential crosses into an agent whose **registry is not the parent's registry**. Within a single registry, logical-name resolution is stable and the enumeration check is redundant. Across registries—different tenant, different tool server, different MCP host—the logical name `orders` no longer denotes the same resource, and the only thing preventing drift is the explicit `resource_enum` membership assertion at the verifier. Operationally: **treat every hop that changes the resolving registry as a re-authorization boundary.** At that boundary, the receiving verifier must reject any credential lacking `resource_enum`, and must reject any credential whose resolved concrete resource is not a member. A credential that is valid in every other respect but fails this check must be refused, not downgraded. ## Operational Effect The effect of enforcing the invariant is that delegation libraries can no longer treat `resource_enum` as advisory. In practice this means: - Delegation serialization must fail closed when `resource_enum` is absent—no defaulting to "all resources in scope." - The verifier gains a mandatory pre-execution resolution step, adding one registry round-trip per tool call; this is the cost of the guarantee. - Cross-registry hops that previously "just worked" now surface as authorization errors, which is correct behavior but will look like a regression to agents that had been silently over-reaching. The payoff is that the delegation chain becomes *auditable as a set inclusion proof*: for any executed action, you can reconstruct the path from the human principal's original enumeration down to the concrete resource, and verify each step was a subset. Without the invariant, that proof is unconstructable—you can only show each hop was locally scope-consistent, which is exactly the property that failed here. ```python class ResourceEnumerationDrift(RuntimeError): """Raised when a delegated credential's resolved resource is not a member of the delegation-time resource enumeration, or when the enumeration was dropped across a re-delegation hop.""" pass class DelegatedCredential: def __init__(self, scope, audience, resource_enum, parent_enum=None): self.scope = scope self.audience = audience # resource_enum must be present; None means the field was dropped. self.resource_enum = resource_enum self.parent_enum = parent_enum def redelegate(parent: DelegatedCredential, child_scope, child_audience) -> DelegatedCredential: """Re-delegate with monotonic resource enumeration. If the child cannot compute a subset, it MUST inherit the parent's enumeration verbatim.""" if parent.resource_enum is None: raise ResourceEnumerationDrift( f"parent credential has no resource_enum; cannot re-delegate safely" ) # Narrowing scope is fine; enumeration must be a subset (or inherited). child_enum = set(parent.resource_enum) # conservative: inherit verbatim return DelegatedCredential( scope=child_scope, audience=child_audience, resource_enum=child_enum, parent_enum=set(parent.resource_enum), ) def verify_and_resolve(cred: DelegatedCredential, logical_name: str, registry: dict) -> str: """Verifier-side check: resolve the logical name through the trusted registry and assert membership in resource_enum BEFORE execution.""" if cred.resource_enum is None: raise ResourceEnumerationDrift( f"credential for {logical_name} lacks resource_enum; refusing execution" ) if logical_name not in registry: raise ResourceEnumerationDrift( f"logical name {logical_name!r} not resolvable in trusted registry" ) concrete = registry[logical_name] if concrete not in cred.resource_enum: raise ResourceEnumerationDrift( f"resolved resource {concrete!r} for {logical_name!r} is not in " f"delegation-time enumeration {sorted(cred.resource_enum)}" ) # Monotonicity check across hops, if parent enumeration is recorded. if cred.parent_enum is not None and not set(cred.resource_enum) <= cred.parent_enum: raise ResourceEnumerationDrift( f"child enumeration {sorted(cred.resource_enum)} is not a subset of " f"parent enumeration {sorted(cred.parent_enum)}" ) return concrete ```