# How does an instance detect policy-attestation replay across federated trust brokers when attestation timestamps are peer-local **Date of Record:** 2026 November 20 **Scope:** Applies to federated agent systems where an instance accepts capability grants from a foreign trust broker based on a signed policy attestation carrying a peer-local timestamp and a monotonic nonce. Does not apply to single-org deployments where the broker and the verifier share a clock authority, nor to attestations that carry a broker-signed, globally monotonic sequence number. ## Core Distinction The failure here is not "expired credential" and not "forged signature." Both of those are cheap to detect. The boundary condition is **attestation replay under clock skew**: a *validly signed, currently-unexpired* policy attestation that was issued for a prior authorization decision is re-presented to a verifier, and the verifier's freshness check passes because the only freshness signal it has — the attestation's `issued_at` and `expires_at`, both stamped by the issuing broker's local clock — is compared against the verifier's own wall clock rather than against a shared causal ordering. The core distinction is between **absolute-time validity** (does `now` fall inside `[issued_at, expires_at]`?) and **causal validity** (has this exact attestation already been consumed for this exact request context?). A federated verifier that checks only the former accepts replays whenever the skew window exceeds the attestation's intended single-use lifetime. The signature is honest. The timestamps are honest. The policy is honest. The *reuse* is the violation, and no cryptographic field in the attestation records it. ## What Was Observed A verifier instance in org B accepted a `policy_attestation` from broker A granting `scope: ["tool:ledger.write", "limit: 500"]`. The attestation was signed by A's broker key, well-formed, and within its declared 300-second validity window. The instance admitted the grant and executed three write operations against a shared ledger. The same attestation bytes were then presented a second time, 240 seconds later, by a different caller in A's federation. Verification passed again. The verifier had no record that the grant had already been exercised, because: 1. The attestation carried a `nonce`, but the nonce was scoped to the *issuing* broker's replay cache, which A maintains only for its own outbound calls — not for what B has already consumed. 2. A's clock ran ~180 seconds ahead of B's. The attestation's `issued_at` therefore appeared, to B, to be in the near future; B's freshness check (`issued_at - skew_tolerance <= now`) passed with the tolerance absorbing the skew, and `expires_at` looked comfortably far off. 3. B's replay guard keyed on `(caller_id, nonce)`. The replay arrived under a *different* `caller_id` within the same federation, so the guard did not fire. The net effect: a single-use, 300-second authorization was effectively reused across callers for the full skew-extended window. The verifier believed it was enforcing single-use; it was enforcing "single-use per caller-id," which is not the invariant the broker intended. The detection signal was not in any single field. It emerged from the *interaction* of three: (a) the same `attestation_id` reappearing with a different `caller_id`, (b) a `issued_at` that advanced by less than the elapsed verifier time between the two observations, and (c) a `nonce` whose broker-side scope the verifier had never been told. None of these alone trips a check. Together they define the boundary. ## Condition of Validity The freshness check is only sound under the following invariant: > **Attestation uniqueness is global to the federation, not local to the caller.** For any attestation `a`, the verifier must be able to decide "has `a` already been consumed for a request context that overlaps this one?" using only information it holds or can obtain from the broker, independent of which caller presents `a`. This invariant holds when one of the following is true: - The broker issues **globally monotonic sequence numbers** and the verifier enforces strictly-increasing per-`(issuer, subject)` sequences; or - The verifier maintains a **content-addressed replay set** keyed on the attestation digest (not on caller identity), with a retention window at least as long as `max(expires_at) - min(issued_at)` across all federated brokers; or - The attestation is **bound to the request** via a hash of the request body and the requesting agent's instance identity, so a replay against a different context fails signature-adjacent validation. The check is *invalid* — silently permissive — whenever freshness is decided purely by comparing peer-stamped timestamps to the verifier's local clock and replay is scoped to caller identity. Under clock skew, the effective replay window is `attestation_lifetime + |skew|`, and the per-caller scoping multiplies the number of admissible replays by the number of callers in the federation. ## Decision Boundary The verifier must reject — not merely log — when any of the following hold: - An attestation digest is observed more than once within the retention window, **regardless of caller identity**. Caller identity is an input to authorization, never a key that partitions the replay namespace. - `issued_at` for a re-observed attestation is not strictly greater than the `issued_at` of the previously consumed attestation from the same `(issuer, subject)` pair by at least the verifier's measured inter-observation interval. A non-advancing peer clock under repeated presentation is the skew signature. - The attestation lacks a broker-signed, verifier-checkable uniqueness token (sequence number or request-bound hash). Absence of this field is itself a rejection condition for federated grants, because the verifier cannot establish the invariant and must fail closed. The verifier must *not* reject merely because `issued_at` exceeds local `now` by less than the configured skew tolerance — that is the normal operating envelope of federation. The distinction is that skew tolerance governs *clock disagreement*, not *reuse admissibility*. Conflating the two is the root error: tolerance is applied to a single observation, while reuse is a property of the observation *sequence*. ## Operational Effect When the invariant is enforced, the observable behavior changes in three concrete ways. First, the replay set must be content-addressed and federation-global, which means the verifier's replay state grows with `federated_callers × attestation_rate × retention_window` rather than `caller × nonce` — a real memory cost that must be budgeted, and a reason to prefer broker-issued sequence numbers over verifier-side digest sets at scale. Second, clock skew no longer extends the admissibility window, because admissibility is decided by sequence monotonicity, not by timestamp arithmetic; the skew tolerance parameter becomes irrelevant to replay and reverts to its proper role of bounding one-shot freshness. Third, a replayed attestation now produces a *hard* rejection with a distinguishable error class, which downstream agents can use to distinguish "your grant is stale, re-request" from "your grant was replayed, treat as potential compromise." That distinction matters operationally: the first is a retry, the second is an incident. The failure mode when the invariant is *not* enforced is quiet. No signature check fails, no expiry trips, no caller sees an error. The only observable is the ledger, and by then the write has landed. Detection must therefore be structural — the verifier must be able to answer "have I consumed this exact attestation for an overlapping context?" before it answers "is this attestation currently valid?" — and the two questions must be asked in that order. ```python import hashlib from dataclasses import dataclass from typing import Dict, Tuple class AttestationReplayError(RuntimeError): """Raised when a policy attestation is re-presented for an overlapping request context.""" pass class MissingUniquenessTokenError(RuntimeError): """Raised when a federated attestation carries no verifier-checkable uniqueness token.""" pass @dataclass(frozen=True) class Attestation: attestation_id: str issuer: str subject: str caller_id: str issued_at: int # peer-local epoch seconds expires_at: int sequence: int | None # broker-signed monotonic seq, or None if absent request_hash: str | None class FederatedAttestationVerifier: def __init__(self, skew_tolerance: int = 300) -> None: self.skew_tolerance = skew_tolerance # digest -> (caller_id, issued_at) of the first consumption self._consumed: Dict[str, Tuple[str, int]] = {} # (issuer, subject) -> highest sequence accepted self._seq_high_water: Dict[Tuple[str, str], int] = {} def _digest(self, a: Attestation) -> str: h = hashlib.sha256() h.update(a.attestation_id.encode()) h.update(a.issuer.encode()) h.update(a.subject.encode()) return h.hexdigest() def verify_and_consume(self, a: Attestation, now: int, request_hash: str) -> None: # 1. Structural: federated grants MUST carry a uniqueness token. if a.sequence is None and a.request_hash is None: raise MissingUniquenessTokenError( f"attestation {a.attestation_id} from {a.issuer} has no sequence " f"or request binding; cannot establish federation-global uniqueness" ) # 2. Request binding: if present, replay against a different context fails here. if a.request_hash is not None and a.request_hash != request_hash: raise AttestationReplayError( f"attestation {a.attestation_id} bound to request {a.request_hash}, " f"presented for {request_hash}" ) # 3. Content-addressed replay guard, independent of caller identity. digest = self._digest(a) prior = self._consumed.get(digest) if prior is not None: prior_caller, prior_issued = prior # Non-advancing peer clock under re-presentation is the skew/replay signature. if a.issued_at <= prior_issued: raise AttestationReplayError( f"attestation {a.attestation_id} re-presented (caller {prior_caller} -> " f"{a.caller_id}) with non-advancing issued_at {prior_issued} -> {a.issued_at}" ) raise AttestationReplayError( f"attestation {a.attestation_id} already consumed by caller {prior_caller}" ) # 4. Monotonic sequence check per (issuer, subject). if a.sequence is not None: key = (a.issuer, a.subject) high = self._seq_high_water.get(key, -1) if a.sequence <= high: raise AttestationReplayError( f"attestation {a.attestation_id} sequence {a.sequence} not greater than " f"high-water {high} for {key}" ) # 5. Freshness check AFTER uniqueness — tolerance governs skew, not reuse. if a.issued_at - self.skew_tolerance > now: raise AttestationReplayError( f"attestation {a.attestation_id} issued_at {a.issued_at} exceeds skew tolerance" ) if a.expires_at < now: raise AttestationReplayError( f"attestation {a.attestation_id} expired at {a.expires_at}" ) # Commit consumption only after all checks pass. self._consumed[digest] = (a.caller_id, a.issued_at) if a.sequence is not None: self._seq_high_water[(a.issuer, a.subject)] = a.sequence ```