# Why does an instance of a federated agent trust anchor silently accept tokens minted under a superseded signing key during cross-org authorization **Date of Record:** 2026 November 18 **Scope:** Applies to cross-organization agent federation where authorization tokens are verified against a trust anchor document (JWKS-like key set) that is fetched, cached, and rotated out-of-band from the token issuer. Does not apply to single-org deployments with a single static signing key, nor to tokens verified with a pinned public key compiled into the verifier. ## Core Distinction There are two different questions a verifier can ask about a token, and they are not the same question: 1. *Is this token cryptographically valid under some key I currently trust?* 2. *Was this token validly issued at the moment it was minted, under the key material the issuer was authorized to use at that moment?* Most federation implementations answer only question (1). Trust anchor rotation is treated as a key-set replacement: fetch the new JWKS, overwrite the cache, verify against whatever `kid` appears. This is correct for revocation-by-removal (a key dropped from the set stops verifying), but it is *wrong* for the temporal question. A token minted at `t0` under key `K_old` and presented at `t1` after the anchor has rotated to `K_new` will fail question (1) if `K_old` is removed. Conversely — and this is the non-obvious boundary — if the anchor document retains `K_old` for a grace window (the common "keep old keys for N hours" hygiene), then a token minted at `t0` under `K_old` continues to pass question (1) long after the issuer's *authorization policy* for `K_old` has been withdrawn. The verifier cannot distinguish "old key still trusted for verification of in-flight tokens" from "old key still trusted to mint new tokens." The boundary is this: **the trust anchor's key set encodes verification trust, not issuance authorization.** A token's `iat` and the key's `not_after` in the anchor are the only fields that let you reconstruct issuance authorization, and neither is checked by default in most JOSE libraries. ## What Was Observed During a cross-org agent federation incident (red-team exercise, two cooperating orgs, agent A at Org-1 acting on behalf of a user, calling agent B at Org-2), the following sequence was reproduced: - Org-1 rotated its agent-signing key from `K_2024` to `K_2025` at 09:00 UTC. The anchor document published to Org-2 retained `K_2024` with `"use":"sig"` and no expiry field, under a documented 24-hour grace policy for in-flight tokens. - Org-2's verifier cached the anchor with a 15-minute TTL and, on refresh, replaced the key set wholesale. It verified tokens by `kid` lookup only. - At 09:04 UTC, a compromised Org-1 agent process — which still held `K_2024` in memory because the rotation did not force-reload the signing context — minted a fresh token with `iat=09:04`, `exp=09:34`, `sub=user-4471`, `scope=payments:initiate`, signed by `K_2024`. - Org-2 accepted it. The token verified. The `kid` was present. The signature was valid. The `exp` was in the future. Nothing in the verification path asked whether `K_2024` was still authorized to *mint* claims at 09:04. The failure is not a signature forgery. It is an *authorization* failure wearing the costume of a valid signature. The verifier's trust anchor was current; the token's issuance authority was stale; the two facts were never compared because the anchor schema had no field expressing "this key may verify tokens issued before X but may not sign tokens issued after X." A second observation: when the grace window was shortened to zero (key removed immediately on rotation), the opposite failure appeared — legitimate tokens minted at 08:59 with `exp=09:29` were rejected at 09:01, causing a 30-minute authorization outage across the federation. The operator response was to extend the grace window, which restored the first failure. The two failure modes are the same boundary approached from opposite sides. ## Condition of Validity The silent-acceptance failure occurs if and only if all of the following hold: 1. The trust anchor retains a superseded key for verification (grace window > 0). 2. The anchor document does not carry a per-key `signing_not_after` (or equivalent issuance-authorization bound) distinct from the key's presence in the set. 3. The verifier does not compare the token's `iat` against any issuance-authorization bound for the signing key. 4. The issuer's rotation procedure does not guarantee that the old signing context is destroyed before the anchor is republished (i.e., rotation is not atomic across key destruction and anchor publication). If (4) holds — the old key is provably destroyed before the anchor is published — the failure cannot occur even with (1)–(3), because no token can be minted under the old key after the anchor changes. This is why the failure is often invisible in controlled rotations and appears only under partial-failure or compromise conditions, where the "provably destroyed" assumption is exactly what breaks. If (2) holds — the anchor carries a per-key issuance bound — the verifier can enforce (3) and the failure is closed without sacrificing the grace window for in-flight tokens. ## Decision Boundary The correct verifier decision is a conjunction, not a disjunction: ``` accept(token) := signature_valid(token, key_for(token.kid)) ∧ key_for(token.kid) ∈ anchor.keys ∧ token.iat ≥ key_for(token.kid).signing_not_before # if present ∧ token.iat ≤ key_for(token.kid).signing_not_after # if present ∧ now ≤ token.exp ∧ issuer_authorized_at(token.iss, token.iat) ``` The boundary between "grace window is a safety feature" and "grace window is an attack surface" is precisely the `signing_not_after` bound. Without it, a non-zero grace window is an unbounded issuance-authorization extension for any actor holding the old key. With it, the grace window is bounded to tokens minted before rotation, which is exactly the in-flight set the grace window was meant to cover. Operational rule: **a trust anchor that retains a key for verification MUST carry the key's issuance-authorization expiry, and the verifier MUST reject tokens whose `iat` exceeds it.** A key retained without that bound is not a grace window; it is a standing authorization. The corollary for the issuer: rotation is not complete when the new key is published. Rotation is complete when (a) the old signing context is destroyed, (b) the anchor is republished with the old key demoted to verify-only with `signing_not_after = rotation_time`, and (c) the demotion is confirmed by every peer. Steps (a) and (b) must be ordered such that a compromise between them cannot mint post-rotation tokens — which means (a) before (b), or (b) with a bound that predates (a). ## Operational Effect When the bound is absent, the observable effect is a *latency between compromise and detection* that equals the grace window, not the token TTL. During that latency, every token minted by the stale key is indistinguishable from a legitimate in-flight token. Audit logs show valid signatures, correct `kid`, correct `iss`, plausible `iat`. The only forensic signal is a statistical one: an anomalous rate of tokens with `iat` clustered immediately after rotation, or `sub` values outside the issuer's normal rotation-time traffic. Neither is a per-token check, so neither is enforceable at the verifier. When the bound is present, the failure mode converts from silent acceptance to explicit rejection: tokens with `iat > signing_not_after` fail with a distinguishable error, the issuer's rotation runbook gains a verifiable post-condition, and the grace window becomes safe to set to the maximum in-flight token TTL rather than an arbitrary 24 hours. The practical migration is: add `signing_not_after` to the anchor schema, default it to the key's publication time for any key not explicitly bounded (fail-closed), and reject on `iat` exceeding it. Peers that do not yet emit the field should be treated as unbounded only under an explicit, time-boxed trust exception recorded in the federation agreement — not by default. ```python from __future__ import annotations import time from dataclasses import dataclass from typing import Mapping, Optional class StaleIssuanceAuthorityError(RuntimeError): """Raised when a token's iat exceeds the signing key's issuance-authorization bound. The signature may be valid and the kid may be present in the trust anchor; this error means the key was retained for verification of in-flight tokens but was not authorized to mint tokens at the token's iat. """ @dataclass(frozen=True) class TrustedKey: kid: str signing_not_before: Optional[int] = None # epoch seconds; None = unbounded past signing_not_after: Optional[int] = None # epoch seconds; None = unbounded future @dataclass(frozen=True) class Token: kid: str iss: str sub: str iat: int exp: int signature_valid: bool def verify_federated_token( token: Token, anchor: Mapping[str, TrustedKey], now: Optional[int] = None, ) -> None: """Verify a cross-org agent authorization token against a trust anchor. Enforces both cryptographic validity and issuance authorization. The issuance-authorization check is the non-obvious one: a key present in the anchor may still be unauthorized to sign tokens at `token.iat`. """ now = int(time.time()) if now is None else now if not token.signature_valid: raise StaleIssuanceAuthorityError( f"signature invalid for kid={token.kid!r}" ) key = anchor.get(token.kid) if key is None: raise StaleIssuanceAuthorityError( f"kid={token.kid!r} not present in trust anchor" ) # Cryptographic validity is necessary but not sufficient. The key must # have been authorized to *mint* at token.iat, not merely trusted to # *verify* now. Without this bound, a grace-window key is a standing # authorization and a compromised issuer can mint post-rotation tokens. if key.signing_not_before is not None and token.iat < key.signing_not_before: raise StaleIssuanceAuthorityError( f"token iat={token.iat} precedes key {key.kid!r} " f"signing_not_before={key.signing_not_before}" ) if key.signing_not_after is not None and token.iat > key.signing_not_after: raise StaleIssuanceAuthorityError( f"token iat={token.iat} exceeds key {key.kid!r} " f"signing_not_after={key.signing_not_after}; key retained for " f"in-flight verification only" ) if now > token.exp: raise StaleIssuanceAuthorityError( f"token expired: exp={token.exp} now={now}" ) # Caller proceeds: token is cryptographically valid AND was minted under # a key authorized to issue at token.iat. ```