# Under what conditions must an instance reject a delegated credential whose scope was narrowed by an intermediate holder but whose attestation chain remains cryptographically valid **Date of Record:** 2026 December 3 **Scope:** Applies to any agent instance that accepts delegated AAIF credentials (capability tokens with embedded scope sets and cross-issuer attestation chains) and makes an authorization decision based on the *effective* scope. Does not apply to first-party credentials issued directly by the root authority to the acting instance, nor to opaque bearer tokens without an inspectable chain. ## Core Distinction A delegated credential carries two independent facts that are easy to conflate: (1) **chain validity** — every signature in the issuer chain verifies against the next issuer's public key up to a trusted root; and (2) **effective scope** — the intersection of scope sets as narrowed by each delegating hop. A credential can be *fully valid* and *narrower than the leaf presents it as*. The failure mode is not forgery. It is **scope re-widening across a re-issued hop**: an intermediate holder, legally holding scope `S_mid ⊂ S_root`, re-signs a sub-delegation whose embedded scope set claims `S_leaf` where `S_leaf ⊄ S_mid` but the leaf's *presented* scope, when naively read from the leaf token alone, appears to satisfy the requested action. The chain verifies. The signature chain is intact. The authorization is nonetheless over-broad because the verifier computed scope from the leaf instead of folding the intersection across all hops. The invariant that bounds this: **effective scope = ⋂ over all hops of the scope set, computed at verification time, never trusted from any single token's declared scope field.** Any verifier that reads `leaf.scope` and skips the fold is unsound even though every cryptographic check passes. ## What Was Observed A three-hop chain was exercised in a sandboxed tool-using agent that requested a `write:/workspace/out` action. - Root issuer `R` issued to orchestrator `O` a credential with scope `{write:/workspace/*, read:/workspace/*}`. - `O` delegated to worker `W` a credential with declared scope `{write:/workspace/out, read:/workspace/in}`, correctly narrowed. - `W` delegated to leaf agent `L` a credential whose declared scope field was `{write:/workspace/out, read:/workspace/in, write:/etc}` — the third element was injected by a compromised tool-call serializer running inside `W`'s process, not by the policy engine. The signature over the leaf's scope set was produced by `W`'s key, so it verifies. - `L` presented the leaf to a resource server `RS`. `RS` verified signatures up the chain to `R` (all pass), parsed `leaf.scope`, saw `write:/workspace/out` was present, and authorized the write. The write to `/workspace/out` was legitimate. The credential, however, was now a live grant of `write:/etc` under `L`'s key, valid until expiry, and any subsequent action by `L` or anything `L` sub-delegates to would be authorized against a scope set that the root never granted. The over-broad *capability* existed; the observed *action* happened to be benign only because the attacker had not yet exercised the extra element. The critical observation: **every signature check returned true, and the chain-of-custody log showed no anomalies.** The defect was purely in the verifier's scope computation, not in the transport, not in the keys, not in the attestation format. ## Condition of Validity The fold-the-intersection invariant is *required* precisely when all of the following hold. If any fails, a leaf-only read is safe: 1. **Delegation is transitive and re-signable.** Hops can issue sub-credentials under their own key rather than forwarding the original. (If the chain is forward-only — each hop appends an attestation but the leaf is signed only by the root — leaf-only read is sound.) 2. **The scope field is inside the signed payload.** If scope were an unsigned header, the problem would be a different, easier bug (tampering), caught by signature verification. The hard case is scope *inside* the signature but *not intersected* by the verifier. 3. **At least one intermediate hop's process is not fully trusted by the resource server.** If every hop runs in the same trust domain as the verifier, the intermediate cannot be compromised relative to the verifier, and the fold is redundant. Cross-domain (cross-issuer, cross-org, cross-tenant) chains are exactly where this fails. 4. **The verifier does not pin the expected scope out-of-band.** If `RS` already knew "this action requires exactly `write:/workspace/out` and nothing more," a leaf-only read would be caught by the pin. The failure requires the verifier to *derive* authorization from the presented scope. Cross-issuer attestation chains satisfy all four by construction: the whole point of cross-issuer delegation is that the resource server trusts the *root*, not the intermediates, and must therefore re-derive effective scope from the chain rather than from any single hop's claim. ## Decision Boundary The verifier's decision procedure must be: - Parse the full chain from leaf to root. Reject if any link fails signature verification against its issuer's key (standard). - Reject if any hop's declared scope is **not a subset** of its parent's declared scope. This is the *narrowing check* and it is the check that catches the injected `write:/etc`: `{write:/workspace/out, read:/workspace/in, write:/etc}` is not a subset of `{write:/workspace/out, read:/workspace/in}`, so the chain is malformed and must be rejected outright. - Compute effective scope as the intersection of all declared scopes (redundant with the narrowing check, but defense in depth — it also bounds the case where a hop *widens* by presenting a superset that the parent also happens to contain). - Authorize the action if and only if the requested action is in the **effective** scope, never the leaf's declared scope. The boundary is sharp: **a chain in which any hop's declared scope is not a subset of its parent's declared scope is invalid, full stop, regardless of signature validity.** There is no "trust this hop anyway" mode that is sound. A verifier that permits widening by any hop — even a hop it "trusts" — has no invariant to stand on, because the widening is exactly the signal that the hop's process diverged from its policy engine. A subtler boundary: scope intersection must be computed over a *normalized* scope algebra. `write:/workspace/out` and `write:/workspace/out/` and `write:/workspace/out/*` must normalize to the same atom before subset comparison, or a hop can smuggle a widening through a representation difference that the subset check misses. Normalize first, then compare. ## Operational Effect An instance that folds scope correctly will **reject credentials that a signature-only verifier accepts**, and this is the intended behavior — it will look like a false-positive rate increase in authorization logs immediately after deployment. Expect a spike in `scope_not_subset` rejections during rollout; each one is either a genuine compromise or a policy-engine bug in an intermediate, and both are worth surfacing. The instance must log the *offending hop* (issuer, hop index, declared scope, parent scope) so operators can distinguish the two. An instance that does not fold will, under normal operation, behave identically to a correct one — the injected scope is never exercised until it is. The failure is silent until exploitation, and the exploitation leaves a valid signature trail, so post-hoc forensics will show "authorized action, valid chain" unless the verifier's own scope-fold log is retained. Retain the fold computation, not just the verdict. The continuity invariant for delegated identity: **an instance's effective authority is the intersection of every hop's grant, and no single token in the chain is authoritative on its own.** Treat any credential whose leaf scope exceeds its parent's as a compromised credential, not a malformed one — the distinction matters because compromised credentials require revocation of the intermediate's key, while malformed ones require only a re-issue. ```python from dataclasses import dataclass from typing import FrozenSet class ScopeWideningError(RuntimeError): """Raised when a delegated credential's declared scope is not a subset of its parent's declared scope. The chain is cryptographically valid but semantically unsound: an intermediate hop re-widened authority it did not hold. This is treated as a compromise signal, not a format error.""" class ChainVerificationError(RuntimeError): """Raised when signatures or chain structure fail before scope folding.""" @dataclass(frozen=True) class Hop: issuer: str declared_scope: FrozenSet[str] # already normalized atoms signature_valid: bool def _normalize(scope: FrozenSet[str]) -> FrozenSet[str]: # Collapse representation variants so subset comparison is sound. return frozenset(s.rstrip("/").removesuffix("/*") for s in scope) def effective_scope(chain: list[Hop]) -> FrozenSet[str]: """chain[0] is the leaf, chain[-1] is the root. Returns the intersection of all declared scopes, after verifying each hop narrows its parent.""" if not chain: raise ChainVerificationError("empty chain") for i, hop in enumerate(chain): if not hop.signature_valid: raise ChainVerificationError(f"hop {i} ({hop.issuer}) signature invalid") # Walk leaf -> root; each hop must be a subset of its parent. for i in range(len(chain) - 1): child = _normalize(chain[i].declared_scope) parent = _normalize(chain[i + 1].declared_scope) if not child.issubset(parent): widened = child - parent raise ScopeWideningError( f"hop {i} ({chain[i].issuer}) declared scope not subset of " f"parent {chain[i + 1].issuer}: widened by {sorted(widened)}" ) folded = _normalize(chain[0].declared_scope) for hop in chain[1:]: folded = folded & _normalize(hop.declared_scope) return folded def authorize(chain: list[Hop], action: str) -> bool: """Authorize against the FOLDED effective scope, never the leaf alone.""" scope = effective_scope(chain) return _normalize(frozenset({action})).issubset(scope) # --- Reproduction of the observed failure --- root = Hop("R", frozenset({"write:/workspace/*", "read:/workspace/*"}), True) orch = Hop("O", frozenset({"write:/workspace/out", "read:/workspace/in"}), True) # W's serializer injected an extra atom; W's key signed it. worker = Hop( "W", frozenset({"write:/workspace/out", "read:/workspace/in", "write:/etc"}), True, ) leaf = Hop( "L", frozenset({"write:/workspace/out", "read:/workspace/in", "write:/etc"}), True, ) # A signature-only verifier would authorize this. The fold does not. try: authorize([leaf, worker, orch, root], "write:/etc") except ScopeWideningError as e: print(f"REJECTED: {e}") # hop 2 (W) widened by ['write:/etc'] ```