# How should an instance reconcile delegated capability scopes when a verifiable credential's attenuation chain is valid at issuance but its scope lattice collapses under transitive delegation depth? **Date of Record:** 2026 November 28 **Scope:** Applies to AAIF-governed agent-to-agent handoffs where capability scopes are attenuated via verifiable credentials (VCs) and re-delegated transitively (A→B→C→…). Does not apply to single-hop direct grants, or to scopes expressed as flat opaque tokens without a lattice/partial-order structure. ## Core Distinction The failure here is not signature invalidity, expiry, or revocation. Every credential in the chain verifies cryptographically, and every hop is within its stated validity window. The failure is **semantic**: an attenuation chain can be *individually* valid at every link while the *composed* scope lattice admits operations that no principal in the chain ever intended to authorize. This is the difference between *verifying that each delegation was permitted* and *verifying that the composed grant is a subset of the root grant under the lattice's meet operation*. Most AAIF implementations check the former (per-hop signature + per-hop subset check against the immediate parent). The boundary condition is that per-hop subset checks are not transitive-closed when the scope lattice is not a total order and the attenuation operator is not associative under the implementation's normalization. The composed grant `G = s₀ ⊓ s₁ ⊓ … ⊓ sₙ` can exceed `s₀` when each `sᵢ ⊑ sᵢ₋₁` holds pairwise but the normalization applied at each hop (e.g., wildcard expansion, resource-pattern widening, or action-set unioning) is lossy. ## What Was Observed A three-hop delegation in a tool-invocation swarm: - Root principal issues `s₀ = {action: read, resource: "s3://bucket/reports/*"}` - Agent A delegates to B: `s₁ = {action: read, resource: "s3://bucket/reports/2024/*"}` — valid subset. - Agent B delegates to C: `s₂ = {action: read, resource: "s3://bucket/reports/2024/Q*"}` — valid subset. - Agent C delegates to D, but C's scope parser normalizes `Q*` by expanding to a regex `^Q.*$` and, on serialization, emits `resource: "s3://bucket/reports/2024/.*"` because the pattern compiler treats `*` as a glob that also matches `/`. At hop D, the credential verifies. The pairwise check `s₃ ⊑ s₂` runs a *string prefix* comparison (`"s3://bucket/reports/2024/.*"` starts with `"s3://bucket/reports/2024/Q"`? No — but the checker used a wildcard-aware matcher that treats `.*` as matching the literal `Q` prefix because it tests *whether the parent pattern matches the child pattern string*, not *whether the child's language is a subset of the parent's language*). The check passes. D now holds read on `s3://bucket/reports/2024/archive/` and `s3://bucket/reports/2024/Q1/../finance/` after path normalization at the S3 client layer. The composed grant exceeded `s₀`'s intent not because any signature was forged, but because the **subset relation was evaluated on pattern strings rather than on the denotation (matched resource set) of those patterns**. The lattice `(Scope, ⊑)` was assumed to be a partial order, but the implementation's `⊑` was not antisymmetric under its own normalization: `P ⊑ Q` and `Q ⊑ P` both returned true for `Q*` and `.*`, so the meet was ill-defined and the "narrowing" at hop 3 actually widened the denotation. ## Condition of Validity The invariant that must hold for transitive delegation to be safe: > For every chain `s₀ ⊒ s₁ ⊒ … ⊒ sₙ`, the *denotation* `⟦sₙ⟧ ⊆ ⟦s₀⟧`, where `⟦·⟧` maps a scope expression to the concrete set of (action, resource-instance) pairs it authorizes at the enforcement point. This holds **only if** three conditions are jointly satisfied: 1. **Denotational subset check.** Each hop's check must compare `⟦sᵢ₊₁⟧ ⊆ ⟦sᵢ⟧` over the *enforcement point's* resource model (post-normalization, post-path-resolution), not over the credential's syntactic pattern strings. 2. **Compositional normalization.** The normalization function `N` applied when serializing a scope must be a *closure* operator: `N(N(s)) = N(s)` and `⟦N(s)⟧ = ⟦s⟧`. The bug above is a normalization that is not denotation-preserving (`⟦N(s)⟧ ⊋ ⟦s⟧`). 3. **Enforcement-point agreement.** The resource matcher used at verification time and the resource matcher used at enforcement time must be the *same function*. If the VC verifier uses glob semantics and the S3 client uses regex-with-path-normalization semantics, the lattice is evaluated in one algebra and enforced in another. When any of these fails, per-hop validity is necessary but not sufficient. The chain is "cryptographically sound and semantically unsound." ## Decision Boundary An instance must **refuse to rely on a delegated credential for enforcement** — and must escalate or re-request a flattened grant from the root — when it cannot establish all three conditions above. Concretely, the boundary is crossed when: - The scope expression contains any wildcard, glob, regex, or range operator whose denotation depends on the enforcement point's resource model, **and** the verifier's matcher is not provably the same function as the enforcer's matcher. - The chain depth `n ≥ 2` and any intermediate hop's normalization is not idempotent and denotation-preserving (detectable by round-tripping the scope through `N` and comparing denotations, not strings). - The composed meet `s₀ ⊓ … ⊓ sₙ` cannot be computed because `⊑` fails antisymmetry on the actual scope expressions in the chain. Below this boundary (flat scopes, single-hop, or scopes whose denotation is a finite enumerated set), per-hop verification is sufficient and the composed-grant check is redundant. The instance should not pay the cost of full denotational subset checking for those cases. The correct remediation is **scope flattening at delegation time**: each hop materializes the intersection against the *root* credential's denotation, not just the immediate parent's, and signs the flattened result. This converts a transitive lattice problem into a single-hop subset problem. It costs one extra denotation computation per hop but eliminates the composition hazard entirely. ## Operational Effect Without the guardrail, the failure is silent and asymmetric: the over-broad grant is only observable when an enforcement point logs an access outside `⟦s₀⟧`, which may never happen if the over-broad resource is simply never touched — until it is. The blast radius scales with chain depth and with the mismatch between verifier and enforcer resource models, both of which grow as swarms get larger and more heterogeneous. The instance must treat "credential verified" as a *necessary* gate, not a *sufficient* one, and must carry the denotational invariant explicitly through every handoff. An instance that cannot compute `⟦s₀⟧` (because the root scope is itself a wildcard it cannot resolve) must fail closed and request an enumerated grant. ```python from dataclasses import dataclass from typing import Callable, FrozenSet class ScopeLatticeCollapseError(RuntimeError): """Raised when a delegated capability chain is cryptographically valid but its composed denotation exceeds the root grant.""" @dataclass(frozen=True) class Scope: raw: str denotation: FrozenSet[tuple] # (action, resolved_resource) pairs def verify_delegation_chain( chain: list[Scope], enforce: Callable[[tuple], bool], root_denotation: FrozenSet[tuple], ) -> Scope: """Validate a transitive delegation chain under the denotational invariant. chain[0] is the root grant; chain[-1] is the leaf the instance will use. """ if not chain: raise ScopeLatticeCollapseError("empty delegation chain") # 1. Per-hop denotational subset check (NOT string-prefix). for i in range(len(chain) - 1): parent, child = chain[i], chain[i + 1] if not child.denotation.issubset(parent.denotation): raise ScopeLatticeCollapseError( f"hop {i}->{i+1}: child denotation exceeds parent " f"({child.raw!r} not subset of {parent.raw!r})" ) # 2. Compositional closure: the composed grant must stay within root. composed = chain[-1].denotation if not composed.issubset(root_denotation): leaked = composed - root_denotation raise ScopeLatticeCollapseError( f"composed grant exceeds root denotation; leaked={sorted(leaked)[:5]}" ) # 3. Enforcement-point agreement: every authorized pair must actually # be admitted by the enforcer, and nothing outside the grant may be. for pair in composed: if not enforce(pair): raise ScopeLatticeCollapseError( f"enforcer rejects pair {pair} that the chain authorizes; " "verifier/enforcer resource models disagree" ) return chain[-1] ```