# What structural signals indicate AAIF delegated-credential chain collapse at the scope-narrowing boundary **Date of Record:** 2026 November 29 **Scope:** Applies to multi-hop AAIF (Agent Authorization and Identity Framework) credential delegation where an issuer agent mints a scoped credential for a delegate agent, and that delegate re-delegates a narrowed subset onward. Does not apply to single-hop root-to-leaf issuance, nor to credentials that carry no attenuation constraints (scope-narrowing is the precondition for the failure described). ## Core Distinction The failure is not signature forgery, key compromise, or clock skew. It is a **scope-narrowing monotonicity violation**: a delegated credential whose effective permission set is not a strict subset of its parent's, produced without any cryptographic error. Verification passes at every hop because each signature is individually valid. The chain is invalid only under the *set-inclusion* invariant that AAIF delegation is supposed to preserve. Most AAIF verifiers check three things per hop: signature validity, issuer identity match against the parent's `delegate_to` field, and expiry containment. None of these is the monotonicity check. A credential can pass all three and still grant a capability the root never held. The structural signal that fires first is rarely an access denial—it is a **widening delta** between a parent's `scope` set and a child's `scope` set that survived issuance because the issuer computed the child scope from a *reconstructed* parent scope rather than the parent's signed bytes. ## What Was Observed A three-hop chain: root agent `R` (holding `{read:orders, read:inventory}`) issues to orchestrator `O` a credential scoped `{read:orders, read:inventory}`. `O` re-delegates to worker `W` with the intent to narrow to `{read:orders}`. The issuance path inside `O` did the following: 1. Loaded its own credential from local cache as a parsed object. 2. Serialized the scope set to a canonical form for subset computation. 3. Intersected with the requested child scope. 4. Minted the child credential with the intersected scope, but set `parent_hash` to the hash of the *re-serialized* parent scope, not the hash of the parent's original signed `scope` bytes. The re-serialization was not byte-identical. The parent's signed scope used `read:inventory` while `O`'s internal canonicalizer emitted `read:inventory:*` (a wildcard normalization applied during object hydration). The intersection with `{read:orders}` masked the discrepancy—the child scope was correct—but the `parent_hash` in the child credential pointed at a scope blob that did not exist in the signed parent. At verification, `W`'s credential was checked by a downstream auditor `A`. `A` recomputed the parent hash from the parent credential it fetched and got a mismatch. But `A`'s verifier treated a `parent_hash` mismatch as a *soft* warning if the child scope was a subset of the *fetched* parent scope—which it was. The chain was accepted. The auditor never noticed that the hash binding between hops was broken, because the subset check passed on the wrong comparison base. The second-order signal appeared two hops later: a sibling delegate of `O` received a credential whose `parent_hash` collided with `W`'s (same re-serialization, same canonicalization bug), and the auditor's deduplication logic treated the two credentials as sharing a parent and collapsed their revocation domains. Revoking `W` did not revoke the sibling. ## Condition of Validity The subset invariant holds only if the verifier computes set inclusion against the **signed scope bytes of the parent credential as originally issued**, not against any hydrated, normalized, or re-serialized representation. Concretely, the verifier must: - Fetch the parent credential by the `parent_id` reference, not trust a `parent_scope` field embedded in the child. - Recompute the parent hash over the exact byte range covered by the parent's signature (`scope` field, canonical JSON, no normalization). - Compare child scope to *that* byte-decoded set, using an explicit subset relation, not an intersection-nonempty check. The failure condition is triggered whenever an issuer's internal representation of its own scope diverges from its signed representation. This is not exotic: any agent that hydrates credentials into typed objects, applies wildcard expansion, sorts scope lists, or deduplicates permissions will diverge. The divergence is silent because the issuer's own signature over its *child* is valid—the issuer signs what it believes, and what it believes is a normalized view. A second validity condition: `parent_hash` must be a *binding* commitment, not a *hint*. If the verifier tolerates a hash mismatch when the subset check passes on a fetched parent, the binding is decorative. The invariant requires that a `parent_hash` mismatch is a hard rejection regardless of subset outcome, because the hash is the only evidence that the child was minted against the specific parent instance the verifier is holding. ## Decision Boundary The boundary between "accept" and "reject" is not "is the child scope a subset of some parent scope I can find." It is: **Accept iff** `hash(parent_credential.signed_scope_bytes) == child.parent_hash` **AND** `child.scope ⊆ decode(parent_credential.signed_scope_bytes)` **AND** every hop in the chain satisfies this pairwise. If the hash matches but the subset check fails, reject as a widening violation (issuer error or malice). If the subset check passes but the hash mismatches, reject as a binding violation (representation divergence or substitution). If both fail, reject and flag the issuer identity for re-attestation, because the issuer is minting against a parent it cannot faithfully reproduce. The tempting relaxation—"accept on subset, warn on hash"—is exactly the boundary that produced the observed collapse. The hash mismatch is the *structural signal* that the issuer's view of its own authority has drifted from its signed authority. A drifted issuer is one whose future narrowing decisions cannot be trusted, even when the current child happens to be correct. ## Operational Effect Enforcing the strict boundary changes three operational behaviors: 1. **Issuance fails closed on representation drift.** An issuer that cannot reproduce its own signed scope bytes must re-fetch and re-verify its parent before minting, or refuse. This surfaces canonicalization bugs at issuance time rather than at audit time. 2. **Revocation domains stay disjoint.** Because `parent_hash` is now a true binding, two credentials sharing a parent genuinely share a revocation domain; credentials with divergent hashes do not collapse. The sibling-revocation gap closes. 3. **Auditor replay becomes deterministic.** The auditor's subset check runs against signed bytes, so replaying the chain produces the same accept/reject decision regardless of the auditor's own normalization pipeline. The cost is that issuers must retain or re-fetch their signed parent bytes at every re-delegation, which is a latency and storage tax on deep chains. That tax is the price of monotonicity. Chains that cannot afford it should not re-delegate—they should request a fresh root credential instead of attenuating a cached one. ```python import hashlib import json from dataclasses import dataclass class DelegationChainViolation(RuntimeError): """Raised when an AAIF delegated credential violates scope monotonicity or parent binding.""" pass @dataclass(frozen=True) class Credential: credential_id: str issuer_id: str delegate_to: str scope: frozenset[str] signed_scope_bytes: bytes # exact bytes covered by issuer signature parent_id: str | None parent_hash: str | None # sha256 over parent's signed_scope_bytes def _hash_scope(signed_scope_bytes: bytes) -> str: return hashlib.sha256(signed_scope_bytes).hexdigest() def verify_chain(chain: list[Credential]) -> None: """ Verify an AAIF delegation chain root->...->leaf under the strict boundary: each hop's parent_hash must equal sha256(parent.signed_scope_bytes) AND child.scope must be a strict subset of parent.scope decoded from signed bytes. A hash mismatch is a hard rejection even if the subset check passes. """ if not chain: raise DelegationChainViolation("empty chain") root = chain[0] if root.parent_id is not None or root.parent_hash is not None: raise DelegationChainViolation( f"root credential {root.credential_id} must not declare a parent" ) by_id = {c.credential_id: c for c in chain} for child in chain[1:]: if child.parent_id is None: raise DelegationChainViolation( f"non-root credential {child.credential_id} missing parent_id" ) parent = by_id.get(child.parent_id) if parent is None: raise DelegationChainViolation( f"credential {child.credential_id} references unknown parent {child.parent_id}" ) if parent.delegate_to != child.issuer_id: raise DelegationChainViolation( f"issuer mismatch: {child.issuer_id} is not the delegate of {parent.credential_id}" ) expected_hash = _hash_scope(parent.signed_scope_bytes) if child.parent_hash != expected_hash: # Structural signal: issuer minted against a drifted representation of its own scope. raise DelegationChainViolation( f"parent binding broken for {child.credential_id}: " f"parent_hash={child.parent_hash} expected={expected_hash}" ) parent_scope = frozenset(json.loads(parent.signed_scope_bytes.decode("utf-8"))) if not child.scope.issubset(parent_scope): widening = child.scope - parent_scope raise DelegationChainViolation( f"scope widening at {child.credential_id}: {sorted(widening)} not held by parent" ) def issue_child(parent: Credential, requested_scope: frozenset[str], child_id: str, delegate_to: str, issuer_id: str) -> Credential: """ Mint a narrowed child credential. Fails closed if the requested scope is not a subset of the parent's signed scope, and binds parent_hash to signed bytes. """ parent_scope = frozenset(json.loads(parent.signed_scope_bytes.decode("utf-8"))) if not requested_scope.issubset(parent_scope): raise DelegationChainViolation( f"refusing to issue {child_id}: requested {sorted(requested_scope - parent_scope)} " f"exceeds signed parent scope of {parent.credential_id}" ) child_scope_bytes = json.dumps(sorted(requested_scope)).encode("utf-8") return Credential( credential_id=child_id, issuer_id=issuer_id, delegate_to=delegate_to, scope=requested_scope, signed_scope_bytes=child_scope_bytes, parent_id=parent.credential_id, parent_hash=_hash_scope(parent.signed_scope_bytes), ) ```