# How does an instance detect that a trust-brokered federation peer is replaying a stale policy attestation under a rotated signing key **Date of Record:** 2026 November 29 **Scope:** Applies to federated agent meshes where cross-org messages are admitted only if the sender presents a policy attestation countersigned by a trust broker, and where brokers rotate signing keys on a schedule independent of attestation TTLs. Does not apply to single-org meshes with a shared root of trust, nor to stateless request/response RPC where no attestation is cached between hops. ## Core Distinction The failure mode is not "the peer is malicious" and not "the signature fails to verify." It is subtler: the attestation verifies *cryptographically* against a key the broker still publishes, but that key was retired for *new* attestations while remaining valid for *verification of historical* ones. A broker typically maintains an overlap window—`key_retired_at < now < key_purged_at`—during which old signatures still check out. During that window, a peer that cached an attestation minted under the old key can replay it after its policy scope has been narrowed, and the receiving instance will accept it because the signature is genuine and the key is still resolvable. The distinction that matters: **signature validity is not policy currency.** A verifier that treats "signature verifies under a currently-published key" as equivalent to "the asserted policy is the peer's current policy" collapses two independent invariants into one check. The replay is not a forgery; it is a *stale truth* wrapped in a *valid proof*. ## What Was Observed A federation of three orgs—call them `alpha` (broker), `beta` (peer), `gamma` (peer)—routed tool-invocation requests through a broker that issued attestations of the form `{peer_id, allowed_tools, max_privilege, issued_at, expires_at, key_id, sig}`. Attestation TTL was 30 minutes. Broker key rotation cadence was 24 hours with a 72-hour verification-overlap retention. At T+0, `beta`'s policy was narrowed from `allowed_tools = [read, write, admin]` to `allowed_tools = [read]` because of an incident. The broker minted a fresh attestation under `key_id = k7` reflecting the narrowed scope and pushed it to `beta`. But `beta`'s agent runtime had already serialized the prior attestation into its per-task checkpoint (a durable context snapshot used for mid-task resume). On resume, the checkpoint restored the *old* attestation object—`key_id = k6`, `allowed_tools = [read, write, admin]`, `expires_at = T+22min`—because the checkpoint replay logic restored "the last-known-good attestation" without re-fetching. `gamma` received a `write` invocation from `beta`. It verified: signature over the attestation body under `k6` → valid; `k6` is in the broker's published key set (still within the 72-hour overlap, retired 6 hours ago) → resolvable; `expires_at` → not yet past. All three checks passed. `gamma` admitted the call. The policy narrowing was invisible to `gamma` because the attestation it received was a genuine, unexpired, correctly-signed artifact of a policy that no longer existed. The detection signal was not in any single field. It emerged from a *cross-field inconsistency*: the attestation's `key_id` (`k6`) had a `key_retired_at` timestamp *earlier* than the attestation's `issued_at` as recorded in the broker's transparency log. A signature minted under `k6` could not have `issued_at` after `k6`'s retirement. The replay had reconstructed an old body but the peer's checkpoint had refreshed the `issued_at` field on resume (a bug in the resume path that stamped "now" onto restored-but-not-refetched attestations). That single inconsistency—`issued_at > key_retired_at` for the same `key_id`—was the only detectable trace. ## Condition of Validity The replay is *undetectable by signature verification alone* precisely when all of the following hold: 1. The broker retains the retired key for verification (`key_purged_at > now`). 2. The replayed attestation's `expires_at` has not yet elapsed in wall-clock terms. 3. The receiving peer has no independent, out-of-band view of the sender's *current* policy (i.e., it trusts the attestation as the sole source of policy truth). 4. The sender's checkpoint/resume path restores attestation objects without a forced re-fetch against the broker's current-policy endpoint. Remove any one condition and the replay is either impossible or detectable. Condition 4 is the one that is almost always silently violated, because checkpoint-resume logic is written by the sender's runtime authors, who are optimizing for "resume fast" and treat the attestation as opaque state to be restored verbatim. The invariant that must hold for correctness: **for any admitted message, `attestation.issued_at ≤ key[attestation.key_id].retired_at` AND `attestation.policy_hash == broker.current_policy(peer_id).hash_at(attestation.issued_at)`.** The first clause is locally checkable if the verifier fetches key metadata (not just the key). The second clause requires either a broker transparency log or a policy-version counter that the verifier can compare against. ## Decision Boundary The boundary between "accept" and "reject-and-refetch" is not a threshold on any single value; it is a *relational* check across the attestation, the key metadata, and the broker's policy log. Concretely: - If `attestation.key_id` is retired **and** `attestation.issued_at > key.retired_at` → **reject as malformed** (this is the replay trace; the artifact is internally inconsistent). - If `attestation.key_id` is retired **and** `attestation.issued_at ≤ key.retired_at` **and** `attestation.expires_at > now` → **accept but flag for re-attestation**; this is a legitimate in-flight message signed before rotation. Do not reject; the sender did nothing wrong. - If `attestation.key_id` is current **and** `broker.policy_version(peer_id) > attestation.policy_version` → **reject and demand refetch**; the peer is operating on a superseded policy even though its key is current. This is the case the naive verifier misses entirely, because it never looks at `policy_version`. - If `attestation.key_id` is current **and** `policy_version` matches → **accept**. The non-obvious boundary is the second bullet: a retired key does *not* imply a stale policy. A verifier that rejects all retired-key attestations will break legitimate in-flight messages during every rotation window—a self-inflicted outage on a 24-hour cadence. The correct behavior is to *decouple key-freshness from policy-freshness* and check them independently. ## Operational Effect The practical consequence is that a federation which verifies only signatures will, on every policy change, have a window—bounded by the maximum attestation TTL plus the maximum checkpoint age—during which narrowed policies are silently unenforced for any peer that resumed from a checkpoint. In the observed incident this window was ~22 minutes (the residual TTL of the replayed attestation). The blast radius is exactly the set of privileges that were revoked, exercised by exactly the peers that checkpoint-resumed, against exactly the receivers that lacked a policy-version check. The guardrail is a two-part contract. First, the broker must publish, alongside each key, a `retired_at` timestamp and a monotonic `policy_version` per peer, and the verifier must fetch *metadata*, not just the key. Second, the sender's checkpoint-resume path must treat the attestation as a *cache with a policy-version stamp*, not as immutable task state—on resume it must compare its restored `policy_version` against the broker's current version and force a refetch on mismatch. The verifier's rejection of the internally-inconsistent artifact (`issued_at > retired_at`) is the last line of defense, not the first. The following is the admission gate that encodes the boundary, including the specific replay trace it must catch. ```python import time from dataclasses import dataclass class StaleAttestationReplay(RuntimeError): """Raised when an attestation is internally inconsistent or policy-stale.""" pass @dataclass class KeyMeta: key_id: str retired_at: float # epoch seconds; key no longer used for NEW attestations purged_at: float # epoch seconds; key no longer valid for verification @dataclass class Attestation: peer_id: str key_id: str issued_at: float expires_at: float policy_version: int allowed_tools: tuple sig_valid: bool def admit( att: Attestation, key: KeyMeta, broker_current_policy_version: int, now: float, ) -> bool: # 1. Cryptographic check is necessary but not sufficient. if not att.sig_valid: raise StaleAttestationReplay( f"signature invalid for peer={att.peer_id} key={att.key_id}" ) # 2. Key must not be purged. if now >= key.purged_at: raise StaleAttestationReplay( f"key={att.key_id} purged at {key.purged_at}, now={now}" ) # 3. Replay trace: an attestation cannot be issued after its key retired. # This is the cross-field inconsistency that exposes checkpoint replay. if att.issued_at > key.retired_at: raise StaleAttestationReplay( f"replay trace: issued_at={att.issued_at} > " f"key.retired_at={key.retired_at} for key={att.key_id}, " f"peer={att.peer_id}" ) # 4. Expiry. if now >= att.expires_at: raise StaleAttestationReplay( f"attestation expired at {att.expires_at}, now={now}" ) # 5. Policy currency is independent of key currency. # A current key with a stale policy_version is still a stale policy. if att.policy_version < broker_current_policy_version: raise StaleAttestationReplay( f"policy stale: attestation={att.policy_version} < " f"broker={broker_current_policy_version} for peer={att.peer_id}; " f"refetch required" ) return True def handle_resumed_message(att, key, broker_current_policy_version, now): try: return admit(att, key, broker_current_policy_version, now) except StaleAttestationReplay as e: # On resume, a stale attestation is a forced refetch, not a drop. raise StaleAttestationReplay( f"resume refused; forcing re-attestation: {e}" ) from e ```