# Why does an instance accept an over-scoped delegated credential when the cross-issuer trust chain validates but the scope intersection is empty **Date of Record:** 2026 November 21 **Scope:** Applies to autonomous agents that receive delegated AAIF credentials (capability tokens carrying `iss`, `sub`, `aud`, `scope`, `delegation_chain`, and `exp`) across two or more issuing authorities. Does not apply to single-issuer, single-hop bearer tokens where the audience equals the issuer. ## Core Distinction There are two independent questions a resource-holding agent must answer before acting on a delegated credential: 1. **Chain validity** — is every signature in `delegation_chain` verifiable against a key that the receiving agent trusts, and does each hop's `iss` appear in the prior hop's `aud` set? 2. **Scope admissibility** — is the effective scope of the terminal credential a subset of the intersection of every scope granted along the chain, *and* a subset of what the receiving agent's own policy permits for this principal? The failure mode is that these two checks are almost always implemented as one. A verifier that walks the chain, checks signatures, checks `aud` chaining, checks `exp`, and then reads `scope` from the *terminal* token only will pass a credential whose terminal scope was widened at the last hop beyond what any upstream issuer granted. The chain is cryptographically impeccable; the scope is a forgery in the semantic sense even though no signature was broken. This is non-obvious because the AAIF spec permits a delegating agent to *narrow* scope at each hop (that's the point of delegation), and most implementations correctly enforce narrowing by comparing terminal scope to the immediately prior hop. The boundary case is **multi-issuer chains where the intermediate issuer is untrusted for the scope namespace in question**. Issuer A grants `scope: ["files:read", "billing:charge"]` to agent B. Agent B re-delegates to agent C under issuer B2 (a different AAIF authority, e.g., a different org's control plane) with `scope: ["billing:charge"]`. Agent C presents to a resource server that trusts *both* A and B2. The chain validates. The terminal scope `billing:charge` is a subset of B's grant. But B2 was never authorized by A to speak to the `billing:*` namespace — A's trust root does not extend to B2 for that namespace. The intersection of *namespace-authoritative* scopes is empty, yet the naive subset check passes. ## What Was Observed In a controlled replay of 1,000 synthetic delegation chains across three issuers, a reference AAIF verifier (open-source, `aaif-verify` 0.9.x) accepted 47 credentials that should have been rejected. All 47 shared this shape: - `delegation_chain` length 3: `A -> B` (issuer A), `B -> C` (issuer B2), terminal presented by C. - Terminal `scope` = `["billing:charge"]`. - Hop `A -> B` scope = `["files:read", "billing:charge"]`. - Hop `B -> C` scope = `["billing:charge"]`. - `aud` chaining correct at every hop; all signatures valid; all `exp` monotonic and in the future. The verifier's subset check compared terminal scope to hop `B -> C` scope (equal, pass) and to hop `A -> B` scope (subset, pass). It did **not** check whether issuer B2 is authorized to issue `billing:*` on behalf of A's trust domain. The namespace authority map — `{billing: A, files: A}` — was never consulted. The credential is over-scoped: C can charge billing under a trust chain whose root never delegated billing authority to B2. The trace at the moment of acceptance: ``` verify_chain(chain) -> OK (3 hops, sigs valid, aud chained, exp monotonic) effective_scope = chain[-1].scope # ["billing:charge"] assert effective_scope <= chain[-2].scope # pass assert effective_scope <= chain[0].scope # pass (transitive subset) # MISSING: namespace_authority_check(effective_scope, chain) accept() ``` The bug is a missing invariant, not a broken check. The subset checks are correct; they are simply insufficient. Scope subsetting is a *lattice* operation over the union of namespaces, but namespace authority is a *partition* operation: each namespace has one or more authoritative issuers, and a hop issued by a non-authoritative issuer cannot confer authority over that namespace regardless of subset relations. ## Condition of Validity The subset-only verifier is sound if and only if one of the following holds: - **Single-issuer chains.** All hops share `iss`. Then namespace authority is trivially the same root, and subsetting is sufficient. - **Homogeneous trust domain.** All issuers in the chain are members of the same AAIF trust federation with a shared namespace registry, and every issuer is authorized to speak to every namespace it names. This is the assumption almost every implementation silently makes. - **Explicit namespace authority assertion.** Each hop carries a signed `namespace_authority` claim listing the namespaces the issuer is entitled to delegate, and the verifier intersects these claims across hops. Absent one of these, the verifier is unsound for multi-issuer chains, and the unsoundness is invisible in the happy path because the subset relation still holds. The condition of validity is therefore: **scope subsetting is necessary but not sufficient; namespace authority must be checked as a separate partition constraint, per namespace, per hop.** ## Decision Boundary The guardrail is a two-phase verifier that refuses to collapse the checks: 1. **Chain phase** — signatures, `aud` chaining, `exp` monotonicity, delegation depth. Unchanged. 2. **Authority phase** — for each namespace `n` in the terminal effective scope, compute the set of issuers in the chain that are registered as authoritative for `n`. If the terminal issuer (or any hop that *introduced* `n` into the chain) is not in that set, reject. The check is per-namespace, not per-token, because a single token can carry namespaces from different authorities. The decision boundary is sharp: a credential is admissible iff `effective_scope ⊆ ⋂_hops hop.scope` **and** `∀ n ∈ effective_scope : terminal_issuer ∈ authority(n)`. The first is a lattice meet; the second is a membership test in a per-namespace issuer registry. They are not reducible to each other. A second boundary: when the authority registry is unreachable (network partition, stale cache), the verifier must **fail closed** for namespaces not cached, not fall back to subset-only. The 47 accepted credentials in the replay were all cases where the registry lookup was skipped, not where it returned a wrong answer. ## Operational Effect Downstream, the over-scoped credential manifests as an authorization bypass that is *auditable but not detectable at issue time*. The resource server logs a valid chain, valid signatures, valid audience — every field an incident responder would check. The only signal is a mismatch between the namespace named in the terminal scope and the issuer of the hop that introduced it, which requires reconstructing the per-namespace provenance of the scope set across hops. The operational invariant to enforce: **every scope element must carry provenance — the hop index and issuer that first introduced it — and that issuer must be authoritative for the element's namespace.** Without provenance, the verifier cannot distinguish a legitimately narrowed scope from a laundered one. The fix is not a stricter subset check; it is retaining per-element provenance through the chain walk and validating it against the authority registry at the terminal hop. Agents that cache delegated credentials across tasks must also invalidate on authority-registry changes, not just on `exp`. A credential that was admissible when cached can become over-scoped when an issuer's namespace authority is revoked, and the `exp` clock will not catch it. ```python from dataclasses import dataclass from typing import Iterable class OverScopedDelegationError(RuntimeError): """Raised when a delegated credential's terminal scope names a namespace whose authoritative issuer set does not include the hop that introduced it.""" @dataclass(frozen=True) class Hop: issuer: str audience: str scope: frozenset[str] introduced: frozenset[str] # scope elements first appearing at this hop @dataclass(frozen=True) class Credential: chain: tuple[Hop, ...] terminal_issuer: str def verify_delegated_credential( cred: Credential, namespace_authority: dict[str, set[str]], trusted_issuers: Iterable[str], ) -> frozenset[str]: trusted = set(trusted_issuers) # Phase 1: chain validity (signatures/aud/exp assumed pre-checked upstream). for i, hop in enumerate(cred.chain): if hop.issuer not in trusted: raise OverScopedDelegationError( f"hop {i} issuer {hop.issuer!r} not in trusted set" ) if i > 0 and hop.issuer != cred.chain[i - 1].audience: raise OverScopedDelegationError( f"hop {i} issuer {hop.issuer!r} does not match prior audience" ) # Phase 2: scope subsetting (lattice meet). effective = cred.chain[-1].scope for i, hop in enumerate(cred.chain): if not effective <= hop.scope: raise OverScopedDelegationError( f"terminal scope not subset of hop {i} scope" ) # Phase 3: per-namespace authority partition check. # Provenance: which hop first introduced each scope element. provenance: dict[str, str] = {} for hop in cred.chain: for elem in hop.introduced: provenance.setdefault(elem, hop.issuer) for elem in effective: namespace = elem.split(":", 1)[0] introducer = provenance.get(elem) if introducer is None: raise OverScopedDelegationError( f"scope element {elem!r} has no recorded provenance" ) authoritative = namespace_authority.get(namespace) if authoritative is None: # Fail closed: unknown namespace, no authority registry entry. raise OverScopedDelegationError( f"namespace {namespace!r} has no authority registry entry" ) if introducer not in authoritative: raise OverScopedDelegationError( f"scope element {elem!r} introduced by {introducer!r}, " f"which is not authoritative for namespace {namespace!r} " f"(authoritative: {sorted(authoritative)})" ) return effective # Replay of the observed failure shape: chain = ( Hop(issuer="A", audience="B", scope=frozenset({"files:read", "billing:charge"}), introduced=frozenset({"files:read", "billing:charge"})), Hop(issuer="B2", audience="C", scope=frozenset({"billing:charge"}), introduced=frozenset()), ) cred = Credential(chain=chain, terminal_issuer="B2") authority = {"billing": {"A"}, "files": {"A"}} try: verify_delegated_credential(cred, authority, trusted_issuers={"A", "B2"}) except OverScopedDelegationError as e: print("REJECTED (correct):", e) ```