# Where must an instance re-derive its delegated scope when an AAIF capability attestation is silently widened by a transitive re-delegation hop **Date of Record:** 2026 November 22 **Scope:** Applies to any agent runtime that holds an AAIF delegated credential (a scoped bearer of capability attestations) and re-delegates, or is handed, a credential whose scope is the transitive closure of one or more upstream hops. Does not apply to root credential issuance by the authority-of-record, nor to single-hop credentials with no re-delegation path. ## Core Distinction An AAIF credential carries two logically separate things: a *capability set* (what verbs/resources the holder may exercise) and a *delegation chain* (an ordered list of attestation hops, each hop signed by its delegator, each hop nominally *narrowing* the scope it received). The framework's security argument rests on a monotonicity invariant: **scope is non-increasing along the chain** — every hop's granted set must be a subset of the set it received. Enforcement of that invariant is the entire point of the chain. The non-obvious failure is that scope *widening* does not require a forged signature or a compromised key. It arises from **set-semantics mismatch between the attestation encoding used at each hop**. When hop *n* expresses its grant as a *predicate* (e.g. `resource: "s3://bucket/*"` or `verb: "read|list"`) and hop *n+1* re-serializes that grant into a *concrete enumerated set* using its own glob/expansion rules, the subset check performed by the verifier compares values that were never in the same algebra. A downstream hop can emit a concrete set that is a superset of what the upstream predicate actually authorized, while remaining a "subset" under the verifier's naive string-containment check. The chain verifies; the scope widened. The distinction that matters operationally: **signature validity of each hop is orthogonal to scope monotonicity of the chain.** A verifier that checks signatures hop-by-hop but validates narrowing with a shallow containment test (string prefix, glob-subset, or set-inclusion over unexpanded literals) will accept a chain that grants more than the root intended. ## What Was Observed A three-hop delegation was issued for a document-retrieval agent: - **Hop 0 (authority):** grants `{resource: "kb://corpus/*", verb: ["read"]}`. - **Hop 1 (orchestrator → retriever):** re-delegates, preserving the predicate `kb://corpus/*` but adding `verb: ["read","list"]`. The `list` verb is *not* a subset of `{read}` — this hop is already a widening under strict verb-set semantics, but the verifier's containment test compared only the `resource` field and ignored `verb` because the two hops encoded verbs differently (`"read"` as a scalar at hop 0, `["read","list"]` as a list at hop 1). Scalar-vs-list coercion made the verb comparison a no-op. - **Hop 2 (retriever → summarizer):** expands the glob into a concrete resource list. Its expansion routine treated `kb://corpus/*` as `kb://corpus/**` (recursive) rather than single-segment, producing a concrete set that included `kb://corpus/private/*` subtrees the authority never scoped. The summarizer received a credential whose *concrete* scope included private subtrees and the `list` verb. Every hop signature was valid. The chain's narrowing check passed because at each hop the verifier compared unexpanded literals: `"kb://corpus/*"` ⊑ `"kb://corpus/*"` (trivially true) and `"read"` vs `["read","list"]` (coerced, skipped). The failure surfaced only when the summarizer enumerated a private subtree and its tool call was logged as *authorized* by the AAIF verifier, then flagged by a downstream DLP sensor that operated on the *expanded* resource path. The trace: 1. Authority issues hop 0 with predicate scope, verb as scalar. 2. Hop 1 re-delegates; changes verb cardinality (scalar → list) and adds a verb. Containment check: resource literal equal (pass), verb field type-mismatched → coerced to "present" (pass). 3. Hop 2 expands glob under a *different* glob dialect than the one the authority's predicate assumed. Concrete set ⊋ intended set. 4. Verifier validates hop 2's concrete set against hop 1's *literal* `"kb://corpus/*"` via prefix match: `"kb://corpus/private/x"`.startswith(`"kb://corpus/"`) → true (pass). 5. Summarizer acts on a widened scope; the widening is invisible at every signature check. ## Condition of Validity The monotonicity invariant holds **only if every hop's scope is compared in a single, fully-expanded canonical algebra** — i.e. the verifier must (a) expand every predicate/glob into the same concrete resource-and-verb lattice using the *authority's* dialect, not the delegator's, and (b) compare verb sets as sets with explicit cardinality normalization, never as coerced scalars. The invariant fails whenever: - two hops encode the same scope in different dialects (glob vs. regex vs. enumerated list), or - verb/attribute fields change cardinality or type across hops, or - the narrowing check is performed on *unexpanded* literals rather than on the expanded lattice. Under any of these, the chain is *signature-valid but scope-non-monotonic*. The condition of validity is therefore not "all signatures verify" but "all hops' scopes, expanded under the root's canonical dialect into one lattice, satisfy `scope[n+1] ⊆ scope[n]` for all n, with type-stable attribute comparison." ## Decision Boundary The runtime must decide, at credential-acceptance time, whether to **trust the chain's declared scope** or **re-derive the effective scope itself** from the root grant plus the ordered hop deltas, expanding everything into the canonical lattice. The boundary: - If the credential is single-hop and the holder is the direct delegatee, trust the declared scope after a signature check — there is no transitive closure to mis-expand. - If the credential is multi-hop, **never trust the declared scope**; re-derive the effective scope by intersecting the root grant with each hop's *delta* expressed in the canonical lattice. Treat any hop whose delta cannot be expressed in that lattice (unknown glob dialect, type-variant verb field, opaque predicate) as a **widening event**, not a pass. - If re-derivation produces an effective scope that is a strict subset of the declared scope, the declared scope is a widening — reject or clamp to the re-derived scope, and emit a monotonicity-violation attestation. - If re-derivation cannot complete (dialect unknown), fail closed: the instance must not exercise the capability, because it cannot prove the chain narrowed. The boundary is sharp because the two branches differ in *who expands the glob*: trusting the declared scope means the delegator's dialect governs; re-deriving means the authority's dialect governs. Only the latter preserves the invariant. ## Operational Effect An instance that trusts declared scope on multi-hop credentials will, with non-trivial probability, exercise capabilities the root never granted — and every audit signal (signature logs, hop-by-hop verifier output) will read *authorized*. The widening is laundered through dialect mismatch, so post-hoc log review cannot recover it; only re-derivation at acceptance time, in the canonical lattice, bounds it. The concrete guardrail is: expand-to-lattice-then-subset, type-stable attribute comparison, and fail-closed on any hop that resists canonicalization. The cost is that every multi-hop acceptance pays a full expansion of the root scope — cheap relative to the alternative, which is an authorized-looking privilege escalation that no signature check will ever flag. ```python from dataclasses import dataclass, field from typing import Iterable class ScopeWideningError(RuntimeError): """Raised when a re-delegation hop widens scope under canonical expansion.""" pass class UncanonicalizableHopError(RuntimeError): """Raised when a hop's scope cannot be expressed in the authority's lattice.""" pass @dataclass(frozen=True) class Hop: delegator: str # raw, dialect-specific scope as declared by this hop raw_resources: tuple[str, ...] raw_verbs: tuple[str, ...] dialect: str # "glob-single", "glob-recursive", "enumerated", ... @dataclass class Credential: root_resources: frozenset[str] root_verbs: frozenset[str] hops: list[Hop] = field(default_factory=list) def _expand(resources: Iterable[str], dialect: str, authority_dialect: str) -> frozenset[str]: # Canonicalize into the AUTHORITY's dialect. Any hop using a dialect we # cannot faithfully translate is a widening risk -> fail closed. if dialect not in ("glob-single", "glob-recursive", "enumerated"): raise UncanonicalizableHopError(f"unknown dialect {dialect!r}") out = set() for r in resources: if r.endswith("/*"): base = r[:-2] if dialect == "glob-recursive" and authority_dialect != "glob-recursive": # recursive expansion under a single-segment authority widens raise ScopeWideningError( f"hop expanded {r!r} recursively; authority dialect " f"{authority_dialect!r} forbids cross-segment match" ) out.add(base + "/*") else: out.add(r) return frozenset(out) def rederive_effective_scope(cred: Credential, authority_dialect: str) -> tuple[frozenset[str], frozenset[str]]: """Re-derive effective scope from root + ordered hop deltas, in the authority's canonical lattice. Never trust declared scope on multi-hop.""" eff_res = cred.root_resources eff_verbs = cred.root_verbs for i, hop in enumerate(cred.hops): hop_res = _expand(hop.raw_resources, hop.dialect, authority_dialect) hop_verbs = frozenset(hop.raw_verbs) # narrowing must hold in BOTH dimensions; type-stable set compare. if not hop_res.issubset(eff_res): raise ScopeWideningError( f"hop {i} ({hop.delegator}) resource scope {sorted(hop_res)} " f"not subset of upstream {sorted(eff_res)}" ) if not hop_verbs.issubset(eff_verbs): raise ScopeWideningError( f"hop {i} ({hop.delegator}) verb scope {sorted(hop_verbs)} " f"not subset of upstream {sorted(eff_verbs)}" ) eff_res, eff_verbs = hop_res, hop_verbs return eff_res, eff_verbs def accept_credential(cred: Credential, authority_dialect: str, declared_scope: tuple[frozenset[str], frozenset[str]]) -> tuple[frozenset[str], frozenset[str]]: if len(cred.hops) <= 1: # single hop: no transitive closure to mis-expand return declared_scope effective = rederive_effective_scope(cred, authority_dialect) if effective != declared_scope: # declared scope is strictly wider than what the chain can justify raise ScopeWideningError( f"declared scope {sorted(declared_scope[0])} exceeds re-derived " f"effective scope {sorted(effective[0])}; refusing to trust chain" ) return effective ```