# How should an instance reconcile delegated AAIF audience binding when the delegating org's key material rotates mid-federation **Date of Record:** 2026 November 23 **Scope:** Cross-org federation where an AAIF token is minted by an origin org and delegated through an intermediary to a relying party with an `aud` restriction bound to the intermediary's AAIF-scoped audience set. Not single-org delegation, nor tokens bound directly to the relying party's own AAIF subject. ## Core Distinction Two readings of "audience restriction" are routinely conflated: 1. **Audience as target selector** — `aud` names the party that may *consume* the token (OAuth2 reading). 2. **Audience as scope of authority** — `aud` names the *set of AAIF subjects* over which delegated authority is valid. The failure lives in the gap between these readings. ## What Was Observed Org A minted a delegated token with `aud: ["aaif:org-b:agents/*"]` and `kid: A-2026-11`. Org B re-delegated narrowly to Org C. At 2026-11-14T03:12Z, Org A rotated its signing key. The old key remained in JWKS for a 24-hour overlap, but the *AAIF audience scope registry* — separate document, different endpoint, different cache TTL — was re-issued, re-expressing `aaif:org-b:agents/*` as `aaif:org-b:agents/+/delegated`. A narrowing, not a revocation; the signature still validated. For ~90 minutes, Org C accepted tokens whose audience scope, under reading (2), no longer included Org C's own AAIF subject. The symptom was not authentication failure but silent *authorization widening*: Org C's re-delegation checks compared the `aud` string against the relying party's AAIF subject prefix, and the prefix match succeeded on `aaif:org-b:agents/` despite the trailing scope change. ## Condition of Validity The two readings coincide only when all hold: - Audience scope registry and JWKS are published from the same document generation, with the same cache TTL and invalidation path. - The delegated token carries an explicit scope-version or registry-generation identifier checked against the current registry, not merely against the signature. - The relying party resolves `aud` to an AAIF subject membership test, not a string-prefix match. If any is false, the readings can diverge undetectably from the token alone. ## Decision Boundary On detecting a key rotation on a delegating org during active federation, an instance must choose between: - **Fail-closed on registry-generation mismatch** — reject any delegated token whose embedded registry generation does not match the current published generation, even if the signature validates. Correct, but causes a hard outage for the registry re-issuance lag. - **Fail-open on signature validity alone** — accept the token because the signature is valid and the audience string still parses. This produced the silent widening above. The boundary: **fail-closed is correct only if the registry generation is embedded in the token at mint time.** Otherwise fail-closed degrades to "reject all delegated tokens during any rotation," operationally indistinguishable from an outage, and will be reverted under pressure. The decision boundary is not "which policy to choose" but "whether the token format carries enough information for the policy to be expressible." ## Operational Effect The operational effect of getting this wrong is asymmetric. Fail-open produces silent authorization widening that is invisible to authentication logs, invisible to signature validation, and visible only in the authorization decision trace — which most systems do not retain at the granularity of individual re-delegation checks. The 90-minute window above was reconstructed from Org C's audit log after a downstream incident, not detected in real time. The durable mitigation is to require that every delegated AAIF token carry a `registry_gen` claim bound to the audience scope registry generation at mint time, and that relying parties treat a mismatch between `registry_gen` and the current registry generation as a hard rejection with a distinct error class — not a generic auth failure, because the two require different operator responses. A signature failure is a key problem; a registry-generation mismatch is a *scope* problem, and conflating them causes operators to rotate keys when they should be re-publishing scopes. The code below encodes the rejection as a distinct exception so that the operational response can be routed correctly. ```python class AAIFRegistryGenerationMismatch(RuntimeError): """Raised when a delegated AAIF token's registry_gen does not match the currently published audience-scope registry generation. This is deliberately distinct from a signature failure: the signature may be valid against an overlapping key while the audience scope has moved. Operators must re-publish scopes, not rotate keys. """ pass def validate_delegated_aaif(token: dict, current_registry_gen: str) -> None: # Signature validation is assumed to have passed upstream against the # overlapping JWKS window. That is necessary but not sufficient. if "registry_gen" not in token: # A token minted before registry_gen was required cannot be # validated under reading (2). Refuse rather than guess. raise AAIFRegistryGenerationMismatch( "delegated token carries no registry_gen; audience scope is " "unverifiable during delegating-org rotation" ) token_gen = token["registry_gen"] if token_gen != current_registry_gen: raise AAIFRegistryGenerationMismatch( f"token registry_gen={token_gen!r} does not match current " f"registry generation={current_registry_gen!r}; audience scope " f"may have narrowed since mint. Rejecting to prevent silent " f"authorization widening." ) # Only now is it safe to resolve aud against the current scope registry. aud = token.get("aud", []) if not isinstance(aud, list) or not aud: raise AAIFRegistryGenerationMismatch( "delegated token has empty or malformed aud; cannot bind to " "AAIF subject membership" ) ```