# Which invariants prevent delegated-credential chain collapse when an AAIF sub-agent attenuates scope mid-execution **Date of Record:** 2026 November 30 **Scope:** Applies to AAIF (Agent Identity and Authorization Interoperability Framework) delegated credential chains where an orchestrator agent issues a scoped warrant to a sub-agent, which may further attenuate that warrant before invoking a tool or peer agent. Does not apply to single-hop bearer-token auth where no delegation or attenuation occurs, nor to static service-account credentials. ## Core Distinction The failure is not "the sub-agent exceeded its authority." That is a coarse violation detectable by any policy engine. The boundary failure is subtler: **a sub-agent legitimately attenuates its own scope, then hands the attenuated warrant to a downstream agent, and the downstream agent's verifier reconstructs the chain against a *different* root than the one the orchestrator actually signed under** — because the chain was re-serialized through a context window that dropped the root's key identifier. The distinction that matters: *scope attenuation is monotonic by design, but chain provenance is not monotonic under lossy re-encoding.* Every hop that copies a warrant into its context and re-emits it is a potential provenance truncation point. The credential chain is a proof; the context window is a lossy channel; the two are conflated whenever an agent treats "the warrant I can see" as "the warrant I was given." ## What Was Observed An orchestrator `O` holds a root warrant `W0` signed by the tenant's identity provider, with `issuer_kid = K_root`, scope `{files:read, files:write, net:egress:api.internal}`, and `delegation_depth_max = 3`. `O` issues `W1` to sub-agent `A` attenuating scope to `{files:read, net:egress:api.internal}` and `delegation_depth_max = 2`, embedding `W0`'s header (including `issuer_kid`) in `W1.parent`. Agent `A` performs its task, then must hand a narrower warrant `W2` to agent `B` to fetch a single file. `A` constructs `W2` by *re-emitting the chain from its context*. During context assembly, `A`'s prompt included a summarized form of `W0` (a tool result that rendered the warrant as human-readable JSON for logging), and the summarizer dropped the `issuer_kid` field because it was judged redundant with the `sub` field. `W2` therefore carries `parent: {sub: "O", scope: [...], sig: }` with no `issuer_kid`. Agent `B`'s verifier, receiving `W2`, walks the chain: it validates `W1`'s signature against the key it *infers* from `sub = "O"` by looking up `O` in its local directory — which resolves to a *different* key `K_alt` (a rotated key, or a same-named agent in a different trust domain). Signature verification of `W1` fails, or worse, succeeds against `K_alt` if `O` was re-keyed and both keys are live. The observed outcome in the failing run: `B` rejected `W2` with `CHAIN_PROVENANCE_MISMATCH`, but only after a 4.2s directory lookup, and `A` had already consumed 60% of its token budget constructing and re-validating `W2` twice before giving up. In the *dangerous* variant (key rotation window), `B` accepted `W2` under `K_alt` and executed a `files:read` against a path that `W0`'s true scope never covered, because `W2`'s scope was reconstructed from `A`'s summary rather than from the signed bytes of `W1`. The invariant that was violated: **a delegated warrant's parent reference must be bound by key identifier, not by subject name, and must be carried as opaque signed bytes, never as a re-rendered summary.** ## Condition of Validity The collapse requires all of the following to co-occur: 1. **Multi-hop delegation** (`delegation_depth_max >= 2`), so at least one intermediate agent re-emits a chain it received. 2. **Context-mediated re-emission**: the intermediate agent reconstructs the child warrant from its *context representation* of the parent rather than from the parent's raw signed envelope retained out-of-band. 3. **Name-to-key indirection**: the verifier resolves the issuer by subject name through a directory that can return more than one live key (rotation overlap, cross-domain name collision, or alias). 4. **A lossy transform** between receipt and re-emission: summarization, JSON pretty-printing for logs, field pruning by a schema that treats `issuer_kid` as optional. Remove any one and the chain either verifies correctly or fails closed immediately. The failure is specifically the *conjunction* of context re-encoding and name-based key resolution. A single-hop chain never re-emits. A chain carried as an opaque blob never loses `issuer_kid`. A verifier that requires `issuer_kid` and refuses name-based resolution fails closed at hop 1. ## Decision Boundary The guardrail is a **chain-integrity invariant enforced at emission, not at verification**: - A child warrant MUST embed the parent's *raw signed envelope* (base64 of the exact bytes `W1` was signed over), not a parsed or summarized form. The verifier re-verifies the parent from those bytes. - `issuer_kid` is a **required** field in every parent reference. A schema that permits its absence is a schema bug; the verifier MUST reject a parent reference lacking `issuer_kid` with a distinct error, before any directory lookup. - Subject-name-to-key resolution is **forbidden** inside chain verification. The verifier uses only the `issuer_kid` carried in the chain and the key material it can fetch for that exact `kid`. If the kid is unknown, fail closed — do not fall back to name lookup. - Attenuation is checked structurally: `W_child.scope ⊆ W_parent.scope` and `W_child.delegation_depth_max < W_parent.delegation_depth_max`, both computed from the *verified parent bytes*, not from the agent's working memory of its scope. The boundary: an agent may summarize warrants freely for *its own reasoning*, but the moment it emits a child warrant, it must pull the parent envelope from an out-of-context store keyed by a handle it received at issuance. Context is for reasoning; the credential store is for provenance. Conflating them is the failure. ## Operational Effect When the invariant holds, chain verification is a pure function of the emitted bytes plus a `kid`-keyed key fetch — deterministic, cacheable, and independent of any agent's context fidelity. Re-emission at depth 3 costs one base64 copy per hop, not a re-parse-and-render cycle. Failures are localized: a missing `issuer_kid` fails at the emitting agent's own pre-emit check, before the child warrant ever leaves the process, which is the cheapest possible place to catch it. When the invariant is absent, the failure is *latent and load-dependent*: it manifests only during key-rotation overlap windows or name collisions, i.e., exactly when the system is already under operational stress, and it manifests as either a spurious rejection (availability loss) or a silent scope escape (integrity loss) depending on which key the directory returns first. The 4.2s lookup and double-construction cost observed is the benign tail; the scope escape is the one that matters. The recommended posture: treat the parent reference as an opaque, signed, `kid`-bound pointer; verify before attenuate; never resolve by name. ```python import base64 from dataclasses import dataclass from typing import Optional class ChainProvenanceError(RuntimeError): """Raised when a delegated warrant's parent reference cannot be bound to a verifiable issuer key identifier. Fail-closed; never fall back to name lookup.""" @dataclass(frozen=True) class ParentRef: issuer_kid: Optional[str] raw_envelope_b64: Optional[str] subject_name: str # present for human readability ONLY; never used for key resolution @dataclass(frozen=True) class Warrant: scope: frozenset delegation_depth_max: int parent: Optional[ParentRef] def attenuate(parent: Warrant, child_scope: frozenset, parent_raw_b64: str) -> Warrant: """Emit a child warrant. The parent's raw signed bytes MUST be supplied from an out-of-context store; we never reconstruct them from the agent's context.""" if not parent_raw_b64: raise ChainProvenanceError( "cannot attenuate: parent raw envelope missing from credential store; " "refusing to reconstruct from context summary" ) if parent.parent is not None and not parent.parent.issuer_kid: raise ChainProvenanceError( f"parent warrant for subject {parent.parent.subject_name!r} has no issuer_kid; " "name-based key resolution is forbidden in chain verification" ) if not child_scope.issubset(parent.scope): raise ChainProvenanceError( f"scope escalation: {child_scope - parent.scope} not held by parent" ) if parent.delegation_depth_max <= 0: raise ChainProvenanceError("delegation depth exhausted; cannot attenuate further") return Warrant( scope=child_scope, delegation_depth_max=parent.delegation_depth_max - 1, parent=ParentRef( issuer_kid=parent.parent.issuer_kid if parent.parent else "ROOT_KID", raw_envelope_b64=parent_raw_b64, subject_name=parent.parent.subject_name if parent.parent else "root", ), ) def verify_chain(child: Warrant, key_fetch) -> bool: """Verify a child against its parent by kid-bound key fetch only.""" if child.parent is None: raise ChainProvenanceError("orphan warrant: no parent reference") if not child.parent.issuer_kid: raise ChainProvenanceError( "missing issuer_kid in parent reference; cannot bind to a key" ) raw = base64.b64decode(child.parent.raw_envelope_b64 or "") if not raw: raise ChainProvenanceError("empty parent envelope; provenance truncated") key = key_fetch(child.parent.issuer_kid) if key is None: raise ChainProvenanceError( f"unknown issuer_kid {child.parent.issuer_kid!r}; fail closed, no name fallback" ) return key.verify(raw) ```