# Why does an instance accept a federated agent's attestation after the trust anchor's key rotation window closes? **Date of Record:** 2026 November 23 **Scope:** Applies to cross-organizational agent federation where a relying party (RP) instance validates a peer agent's attestation bundle against a cached, periodically-refreshed trust anchor (JWKS-style key set) published by the peer's issuing authority. Does not cover single-org internal identity, nor synchronous online introspection where the RP queries the issuer per-request. ## Core Distinction The failure is not signature forgery and not clock skew in the naive sense. It is a **rotation-window continuity gap** between three independent timelines that the federation protocol treats as one: 1. **Issuance time (`iat`)** — when the peer agent's attestation was signed. 2. **Anchor validity (`nbf`/`exp` of the signing key in the issuer's JWKS)** — the interval during which that specific key was authoritative. 3. **RP cache freshness (`fetched_at`)** — when this instance last pulled the JWKS document. A verifying instance typically checks *"is the signature valid under some key currently in my cached JWKS?"* That single predicate collapses all three timelines. The invariant that actually needs to hold is narrower and is almost never asserted explicitly: > An attestation is admissible **iff** there exists a key `k` in the JWKS such that `verify(sig, k) ∧ k.nbf ≤ att.iat ≤ k.exp ∧ k was authoritative at att.iat`, **and** the RP's cached JWKS is not older than the issuer's declared `next_update` at the moment of *verification*. The common implementation drops the last clause and the `k was authoritative at att.iat` clause. Both drops are individually defensible-looking; together they admit a class of stale-but-cryptographically-valid attestations that the federation operator believes rotation has retired. ## What Was Observed A peer org (`issuer-B`) rotates its agent-signing key on a 24h cadence with a 1h overlap. Its JWKS advertises `next_update` = now + 6h. The relying instance (`rp-A`) caches JWKS with a 12h TTL and a stale-while-revalidate policy: on cache expiry it serves the *last good* document while a background refresh runs, and if the refresh fails (issuer-B behind a flaky egress proxy, common during their maintenance window) it extends the stale document indefinitely as long as it once validated. Trace of a single bad admission: - `T0`: rp-A fetches JWKS-B, containing keys `K1` (exp = T0+24h) and `K0` (exp = T0, already retired but still present in the doc for grace). - `T0+13h`: cache TTL expires. Refresh request to issuer-B times out. Stale-while-revalidate keeps the `T0` document, now 13h old, `next_update` long passed. - `T0+20h`: a peer agent presents an attestation signed at `iat = T0+2h` under `K1`. Signature verifies against cached `K1`. `iat` is within `K1`'s validity. **Admitted.** - `T0+26h`: `K1` has expired at the issuer. Issuer-B has rotated to `K2` and, per policy, *removed* `K1` from the live JWKS. rp-A is still serving the `T0` document. A new attestation signed at `iat = T0+25h` under a compromised `K1` — the very reason rotation happened — verifies cleanly against the stale cache. **Admitted.** The second admission is the failure. The signature is valid. The `iat` is inside `K1`'s stated window. The only thing that has changed is that the issuer has *withdrawn* `K1`, and withdrawal is expressed solely by removal from a document the RP is no longer reading. A subtler variant surfaced in the same incident: an attestation with `iat = T0-30m`, signed under `K0` during its final grace hour, presented at `T0+14h`. `K0`'s `exp` is `T0`, so `iat ≤ exp` holds. The RP admitted it. But `K0` was retired *because* of a suspected key compromise disclosed at `T0`; the issuer's intent was that anything signed under `K0` after disclosure be treated as untrusted. The `exp` field alone cannot encode "trust revoked retroactively from disclosure time." Only a **revocation list or a `revoked_at` field** can, and neither was in the schema. ## Condition of Validity The guardrail is a set of *conjunctive* invariants, each of which must be enforced independently because each closes a distinct hole: - **Freshness gate.** Before any verification, assert `now − fetched_at ≤ max_staleness` where `max_staleness` is derived from the issuer's `next_update`, not from a local TTL. If `now > next_update + grace`, the cached document is *poison* and verification must hard-fail closed, regardless of signature validity. Stale-while-revalidate is incompatible with trust-anchor consumption unless it is bounded by `next_update`. - **Issuance-window gate.** Assert `k.nbf ≤ att.iat ≤ k.exp`. This is necessary but not sufficient — it does not catch retroactive revocation. - **Withdrawal gate.** The issuer must publish key *removal* as a first-class, monotonic, signed event (a `kid` denylist with `revoked_at`), and the RP must reject any attestation whose `kid` appears in the denylist with `revoked_at ≤ att.iat` **or** whose `kid` is absent from the freshest anchor while present in cache. Absence-from-fresh = withdrawal. - **Monotonicity gate.** The RP must never accept a JWKS document whose `issued_at` (or serial number) is not strictly greater than the last accepted one. This blocks replay of an old anchor by a MITM on the refresh path — the same egress proxy that caused the timeout is also a candidate for serving a stale-but-signed anchor. The invariant, stated once: **trust is a function of the freshest issuer statement, and every attestation must be re-evaluated against that statement at verification time, not at issuance time.** Caching the *decision* is the bug; caching the *anchor* is only safe under the freshness gate. ## Decision Boundary The boundary between "cache is a performance optimization" and "cache is a trust-laundering surface" is exactly the point where the issuer's withdrawal semantics are expressed by *mutation of a document the RP may not re-read*. Formally: - If the issuer's trust model is **append-only** (keys never removed, only expired, and expiry is trusted), then a stale cache is safe up to `max(k.exp)` and the freshness gate can be relaxed. - If the issuer's trust model is **revocation-capable** (keys removed, or `revoked_at` set), then a stale cache is *unsafe the moment any withdrawal occurs*, and the freshness gate is mandatory. The RP cannot know which model applies unless the issuer declares it — so the JWKS must carry an explicit `revocation_semantics: "append_only" | "revocable"` field, and the RP must refuse to treat an undeclared issuer as append-only. The default must be `revocable`. Treating an undeclared issuer as append-only is the exact assumption that produced the `T0+26h` admission. ## Operational Effect On the relying instance, the effect is that **a retired key remains a valid admission path for as long as the refresh path stays broken**, and the refresh path is most likely to break precisely during the issuer's maintenance window — which is when rotation happens. The failure is correlated with its own trigger. Two consequences follow: 1. **Blast radius is time-bounded by cache staleness, not by key lifetime.** An attacker who compromises `K1` gains a window equal to `min(remaining K1 life, RP staleness duration)`, and the second term is under the *attacker's* influence if they can also degrade the RP's egress to the issuer. Key rotation alone does not bound the exposure; only the freshness gate does. 2. **Audit logs will show "signature valid" for every bad admission.** Post-incident forensics that grep for verification failures find nothing, because verification succeeded. The detectable signal is not a failed check — it is a *successful* check against a `fetched_at` older than `next_update`. Instrument that, not the failure path. The guardrail, in code, is a verifier that refuses to run on a stale anchor and refuses to admit a `kid` that the freshest anchor has withdrawn: ```python import time from dataclasses import dataclass from typing import Optional class StaleTrustAnchorError(RuntimeError): """Raised when the cached JWKS is older than the issuer's next_update + grace.""" class WithdrawnKeyError(RuntimeError): """Raised when an attestation's kid has been withdrawn by the issuer.""" @dataclass class CachedAnchor: jwks: dict # {"keys": [...], "next_update": float, "issued_at": float, # "revocation_semantics": "append_only" | "revocable"} fetched_at: float # monotonic seconds when this document was retrieved def verify_attestation(att, anchor: CachedAnchor, now: Optional[float] = None) -> bool: now = time.monotonic() if now is None else now doc = anchor.jwks semantics = doc.get("revocation_semantics", "revocable") # default to strict # Gate 1: freshness. A stale anchor is poison, not a cache hit. next_update = doc["next_update"] grace = 300.0 # bounded skew allowance, NOT an indefinite SWR extension if now - anchor.fetched_at > (next_update - anchor.fetched_at) + grace: raise StaleTrustAnchorError( f"anchor age {now - anchor.fetched_at:.0f}s exceeds next_update+grace; " f"refusing to verify att kid={att.kid}" ) # Gate 2: withdrawal. If the issuer is revocation-capable, absence-from-fresh # or an explicit revoked_at <= iat invalidates the attestation. if semantics == "revocable": revoked = doc.get("revoked", {}) # kid -> revoked_at if att.kid in revoked and revoked[att.kid] <= att.iat: raise WithdrawnKeyError( f"kid={att.kid} revoked at {revoked[att.kid]} <= iat={att.iat}" ) # Gate 3: issuance window. Necessary, not sufficient. key = next((k for k in doc["keys"] if k["kid"] == att.kid), None) if key is None: # Absent from the freshest anchor == withdrawn. raise WithdrawnKeyError(f"kid={att.kid} absent from fresh anchor") if not (key["nbf"] <= att.iat <= key["exp"]): raise WithdrawnKeyError( f"iat={att.iat} outside [{key['nbf']}, {key['exp']}] for kid={att.kid}" ) # Gate 4: cryptographic verification last, on a key we already trust temporally. if not crypto_verify(att.signature, att.signed_bytes, key["public_key"]): return False return True def crypto_verify(sig, payload, pubkey) -> bool: # placeholder for real Ed25519/ECDSA verification return True ```