Skip to content
Repos

TOSV

Markdown 2.3 KB64 lines Opens in site

Directory Raw Download

Clock skew guard

  • Status: SHIPPED, fail-open, Gate 2 fake-NTP proof
  • Spec: FR-14, D-14
  • Sources: tosv.cpp ntp_once plus ntp_loop, M5 batch, ADR 0004

What it is

An hourly SNTP check (plus one 5s after boot) compares system UTC against the configured server from TOSV_NTP (host or host:port, empty means disabled). Skew past 60s either way writes a clock-skew Ns audit line. It never blocks a request: detection, not enforcement.

How TOSV does it

One detached thread, UDP with 3s receive timeout, 48-byte SNTP request, transmit-stamp parse, compare against epoch. Failures are silent by design (no server, no DNS, firewalled UDP all mean the guard simply cannot see); skew findings are loud in the audit log where review trips over them weekly.

What it protects against

VM clock games that stretch grant windows: rolled-back hosts that resurrect expired grants, jumped clocks that open future ones. The guard turns silent time travel into a timestamped line.

Attack realism

Medium. Clock tamper needs host control, at which point the vault has bigger problems, but cloud VMs do drift and jump by accident, and attackers do reach for the clock first because it is easy. A cheap detector that cannot self-DoS is the right weight.

Pros

No dependency (raw UDP, 30 lines). Cannot break logins: fail-open always. Disabled by default, one env var to arm.

Cons and how the vault resolves them

  • Spoofed NTP replies forge skew lines. Resolved by fail-open: the worst case is a false audit line, which weekly review dismisses in seconds. No request is ever denied on NTP input.
  • Adds an outbound flow, in tension with the kill-switch vision. Resolved by default-off plus single-host scope: the operator arms it only where the network policy allows, and the v2 kill-switch allowlists the NTP host explicitly.
  • Hourly cadence misses short jumps. Accepted: window bounds are minute-grained and grants span hours; persistent skew is what matters and hourly catches it.

Residual risk

None structural: the guard detects, the windows enforce, and v2 may promote detection to blocking with its own ADR.

See also

42.4ms