# When must an instance refuse to renew a hardware-attested agent identity token: the signer-clock vs. token-`nbf` skew boundary **Date of Record:** 2026 November 15 **Scope:** Applies to agent identity attestation where a workload obtains short-lived tokens (`iat`/`nbf`/`exp`) minted by a control-plane signer after verifying a hardware-backed key (TPM EK/AK, Secure Enclave, or vTPM) via a quote over a nonce. Does not apply to long-lived static credentials, to bearer tokens without hardware binding, or to signers that issue tokens with `nbf` strictly in the past by construction. ## Core Distinction The distinction that matters operationally is between *token validity* and *attestation freshness*. A renewal loop typically checks two things: (a) the token is not yet expired (`now < exp`), and (b) the hardware quote matches a fresh nonce. The non-obvious third invariant is that the token's `nbf` (not-before) must be satisfiable at the *verifier's* clock, not merely at the *signer's* clock. When the signer runs slightly ahead of the verifier — common across regions, and guaranteed during leap-second smearing or NTP step corrections — the signer mints a token whose `nbf` is a few hundred milliseconds in the verifier's future. The token is cryptographically valid and fresh, yet any strict verifier rejects it with "token not yet valid." The renewal loop, seeing rejection, retries immediately, mints another token with the same future `nbf`, and spins. The failure is not expiry; it is a *negative* skew at issuance. The second, subtler distinction is between *renewal* and *re-attestation*. A token can be renewed from a still-valid hardware session without re-running the quote; but if the signer's clock has stepped backward relative to the last issuance, a naive renewal can produce a token whose `nbf` precedes the *previous* token's `nbf`, violating monotonic issuance assumptions in downstream audit logs and in any verifier that caches "last seen `nbf`" per workload identity. ## What Was Observed During a scheduled NTP step on the signer fleet (a +412 ms correction after a long-running VM's clocksource drifted), the following sequence reproduced across ~3% of renewal attempts for roughly the step window: 1. Agent workload holds token `T0` with `exp = signer_now + 300s`, valid. 2. Renewal fires at `T0.exp - 60s`. Hardware session still live; quote nonce fresh; signer verifies and mints `T1` with `nbf = signer_now + 0.412s`, `exp = signer_now + 300s`. 3. Verifier at the workload rejects `T1`: `now_verifier < T1.nbf` by ~400 ms. 4. Renewal loop treats rejection as transient and retries after 50 ms — still before `T1.nbf`. Each retry mints a *new* token with an equally future `nbf`. 5. After the retry budget (typically 10 attempts × 50 ms = 500 ms) is exhausted, the loop escalates to full re-attestation, which is expensive (quote + control-plane round trip) and unnecessary. 6. In a minority of cases the loop *succeeds* on the retry that happens to land after the skew resolves, masking the defect; in the rest it pages on-call with "attestation failure" that is actually a clock-skew boundary. Separately, a backward step on the signer (−300 ms) produced `T1.nbf < T0.nbf`, which a downstream audit consumer flagged as a monotonicity violation and quarantined the workload's identity record. ## Condition of Validity The refusal-to-renew rule is only correct under these conditions, all of which must hold simultaneously: - The token is hardware-bound: the signer verified a quote over a nonce the workload generated for *this* renewal, and the quote's PCR/measurement set matches policy. If the quote is stale or the nonce is reused, the token is not attestation-fresh regardless of `nbf`. - The verifier's clock and the signer's clock are both disciplined to a common reference (e.g., both to the same NTP pool or PTP domain) with a *known* maximum skew bound `S`. The rule below assumes `S` is measured, not assumed. - The token carries `nbf` and `exp` with sub-second resolution. Second-resolution tokens hide the boundary and are not covered by this record. - The renewal path distinguishes "not yet valid" (`now < nbf`) from "expired" (`now >= exp`) and from "signature/quote invalid." A single boolean "valid" collapses these and makes the boundary unobservable. If any condition fails — e.g., the verifier trusts an undisciplined clock, or the token is not hardware-bound — the correct action is not to apply the skew rule but to fail closed and re-attest, because you cannot bound the error. ## Decision Boundary The decision boundary is a comparison of measured skew against a tolerance derived from the token's own lifetime, not a fixed constant: ``` skew = signer_clock_estimate - verifier_now tolerance = min(S_measured, token_lifetime / 10) ``` - If `now_verifier + tolerance >= nbf` and `now_verifier < exp`: the token is *usable now*; proceed. - If `nbf > now_verifier + tolerance` but `nbf - now_verifier <= S_measured`: the token is *valid but early*. Do **not** re-attest. Schedule a single renewal at `nbf + epsilon` and treat the current token as "pending." This is the case the naive loop mishandles. - If `nbf - now_verifier > S_measured`: the signer is producing tokens outside the measurable skew envelope. This is a signer fault, not a workload fault. Refuse to renew, fail closed, and alert the signer owner — do not retry. - If `T1.nbf < T0.nbf` on a renewal that did not involve a re-attestation: monotonicity violation. Refuse to accept `T1`, retain `T0` until `T0.exp`, and require a full re-attestation with a fresh nonce before issuing `T2`. The key non-obvious choice: *early-but-within-skew is not a failure*. Treating it as one converts a benign clock boundary into a re-attestation storm, and re-attestation storms are themselves a denial-of-service vector against the control plane. ## Operational Effect Applying this boundary changes three observable behaviors. First, renewal retries stop being blind: the loop computes a single scheduled wake at `nbf + epsilon` instead of hammering the signer, reducing control-plane load by the retry-factor during skew windows (observed ~10× reduction in mint requests during the NTP step). Second, "attestation failure" alerts separate into *signer clock fault* (alert signer owner) versus *verifier clock fault* (alert verifier owner) versus *genuine quote failure* (alert workload owner) — previously all three collapsed into one page. Third, monotonicity violations on `nbf` are caught at renewal time rather than downstream in audit, so a backward signer step is contained to the affected workload instead of quarantining identity records across the fleet. The cost is that the renewal loop must carry a measured skew estimate `S` and must be able to distinguish the three rejection classes. That is a small amount of state, but it is the state that makes the difference between a boundary condition and an outage. ```python import time from dataclasses import dataclass class AttestationRenewalError(RuntimeError): """Raised when a hardware-attested token renewal violates a boundary invariant.""" pass @dataclass class Token: nbf: float # not-before, seconds, signer clock exp: float # expiry, seconds, signer clock hardware_bound: bool nonce_fresh: bool token_id: str @dataclass class RenewalDecision: action: str # "use_now" | "schedule_at" | "refuse_fail_closed" | "re_attest" wake_at: float | None = None reason: str = "" def decide_renewal( current: Token, candidate: Token, verifier_now: float, measured_skew_s: float, token_lifetime_s: float, ) -> RenewalDecision: # Invariant 1: attestation must be hardware-bound and nonce-fresh. if not candidate.hardware_bound or not candidate.nonce_fresh: raise AttestationRenewalError( f"token {candidate.token_id} lacks hardware binding or fresh nonce; " "cannot apply skew tolerance" ) # Invariant 2: renewal without re-attestation must not go backward in nbf. if candidate.nbf < current.nbf: raise AttestationRenewalError( f"monotonicity violation: candidate nbf {candidate.nbf:.3f} < " f"current nbf {current.nbf:.3f} for token {candidate.token_id}; " "require full re-attestation with fresh nonce" ) tolerance = min(measured_skew_s, token_lifetime_s / 10.0) early_by = candidate.nbf - verifier_now if verifier_now >= candidate.exp: return RenewalDecision("re_attest", reason="candidate already expired") if early_by <= tolerance: return RenewalDecision("use_now", reason=f"within tolerance ({early_by:.3f}s)") if early_by <= measured_skew_s: # Valid but early: schedule a single wake, do NOT retry-storm. return RenewalDecision( "schedule_at", wake_at=candidate.nbf + 0.001, reason=f"early by {early_by:.3f}s within measured skew {measured_skew_s:.3f}s", ) # Early beyond measurable skew: signer fault, not workload fault. raise AttestationRenewalError( f"signer produced token {candidate.token_id} with nbf {early_by:.3f}s " f"ahead of verifier, exceeding measured skew {measured_skew_s:.3f}s; " "refuse renewal and alert signer owner" ) def renewal_loop( current: Token, mint_fn, verifier_now_fn, measured_skew_s: float, token_lifetime_s: float, max_cycles: int = 5, ): for _ in range(max_cycles): candidate = mint_fn() now = verifier_now_fn() decision = decide_renewal( current, candidate, now, measured_skew_s, token_lifetime_s ) if decision.action == "use_now": return candidate if decision.action == "schedule_at": sleep_for = max(0.0, decision.wake_at - now) time.sleep(sleep_for) # Re-verify the same candidate after the scheduled wake. if verifier_now_fn() >= candidate.nbf: return candidate raise AttestationRenewalError( f"candidate {candidate.token_id} still early after scheduled wake; " "clock estimate is unreliable" ) if decision.action == "re_attest": raise AttestationRenewalError( f"candidate {candidate.token_id} expired; full re-attestation required" ) raise AttestationRenewalError("renewal loop exhausted without a usable token") ```