GeezerVison is showing github.com — id(discovery): peer announcements carry a timestamp nothing checks — a replayed or out-of-order announcement overwrites newer peer state and can keep a departed peer 'live' forever · Issue #1552 · developing-today/code
id(discovery): peer announcements carry a timestamp nothing checks — a replayed or out-of-order announcement overwrites newer peer state and can keep a departed peer 'live' forever #1552Labels app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item DescriptionProblem
Peer announcements carry a creation timestamp (PeerAnnouncement.timestamp_secs, pkgs/id/src/discovery.rs:364), but nothing on the receive path ever reads it:
- The gossip receive loop in
id serve passes every deserializable announcement straight to the peer table (pkgs/id/src/commands/serve.rs:1278, recv_discovery.update(announcement)), with no freshness or ordering check.
PeerDiscovery::update (pkgs/id/src/discovery.rs:430-437) unconditionally inserts the announcement and stamps last_seen = Instant::now() — the arrival time, never the announcement's own timestamp.
Two consequences, both verified below:
- Out-of-order / replayed announcements regress live state. An older announcement received after a newer one silently overwrites the stored name/blob_count with the stale values.
- A departed peer can be kept "live" forever by replay. Freshness (
peers(), stale_peers()) is measured only from the local arrival clock, so re-broadcasting one captured announcement at any cadence under STALE_THRESHOLD (120 s) refreshes the peer indefinitely. The cleanup task only probes peers that are stale (serve.rs:1312-1352), so a replay-refreshed peer is never probed and never removed. Announcements are unsigned plain postcard (PeerAnnouncement has no signature field) broadcast on a public topic with a public secret (DEFAULT_TOPIC / DEFAULT_TOPIC_SECRET), so a capture is available to anyone who has ever been on the topic — and ordinary gossip duplication/reordering triggers consequence 1 without any attacker at all.
Evidence (verified this run, main a120b9a9)
Probe crate ON THE LAPTOP (~/git/fleet/probe-2026-10-27-laneB-discovery) compiling the verbatim pkgs/id/src/discovery.rs (sha256 52b897d2cfa2c620f54ac7945e1bad66435472e73327c43cd87ef2bc56ee3d99, identical both sides; iroh-base pinned =1.3.0 per pkgs/id/Cargo.lock). Log: hidden_files/probe-2026-10-27-laneB-discovery/out.log.
case1 after ts=2000: name=Some("new-name") blob_count=42 timestamp_secs=2000 count=1
case1 after replayed ts=1000: name=Some("old-name") blob_count=7 timestamp_secs=1000 count=1
case2 after ts=1000 then ts=2000: name=Some("new-name") blob_count=42 timestamp_secs=2000 count=1
case3 ancient ts=1 accepted: name=Some("ghost") blob_count=99 timestamp_secs=1 count=1
case3: peers()=1 stale_peers()=0
- Case 1: the replayed older announcement (ts=1000) overwrites the newer stored state (ts=2000, 42 blobs → 7, name regresses).
- Case 2 (control): normal in-order delivery works, so the gap is specifically the missing ordering/freshness check.
- Case 3: an announcement stamped
timestamp_secs = 1 (1970) is accepted as a currently-live peer: peers() returns it and stale_peers() does not — its claimed age is never compared to anything.
Existing tests cover insert/replace/stale-by-local-clock only; no test delivers announcements out of order or with an old timestamp.
Why it matters
The peer table is what id peers, the REPL peer views, and the web /peers route show an operator, and blob_count is the only content signal in it. Today that table can be rolled back by ordinary gossip reordering, and — because the announcement is unauthenticated and replayable — pinned to a phantom peer indefinitely by anyone holding one old broadcast. The stale-probe cleanup that exists precisely to evict dead peers is structurally unable to see the replayed case.
Acceptance criteria
- An announcement whose
timestamp_secs is not newer than the stored announcement's for that node does not overwrite the stored announcement (equal timestamps: keep the first, or a documented deterministic rule).
- An announcement stamped older than a pinned bound relative to local wall-clock time (e.g.
STALE_THRESHOLD) does not make a peer live / does not refresh its freshness; the peer can still become live again from a genuinely new announcement.
- Regression tests in
discovery.rs: out-of-order delivery keeps the newer announcement; an ancient-timestamp announcement is not returned by peers() as fresh (or is refused at update); in-order controls still pass.
- The receive path in
serve.rs needs no new trust assumptions: the fix lives in PeerDiscovery (and/or a checked entry point it exposes), so every caller gets the ordering/freshness guarantee.
- Out of scope: signing announcements (a larger design question) — this issue is only about refusing to let an old announcement move state backwards or manufacture freshness.
Activitydeveloping-today commented on Oct 28, 2026 added kind/bugSomething isn't working (prefixed form of the classic bug label) task/triageQueue packet kind: verify, reproduce, and route this item app/idPackage/app: id (pkgs/ or apps/ in this repo) effort/sSmall: expected under 2 hours of work on Oct 28, 2026dezren39 commented on Oct 28, 2026 🤖 Agent note · filed
- Agent: new-issue-creator (lane B, new-issue-creator-code-b)
- Session / ID: new-issue-creator-code-b run 2026-10-27 20:20 CDT (2026-10-28T01:30:53Z)
- Found via: filed this run
- Task: Triage the discovery announcement ordering/freshness defect: PeerDiscovery::update ignores timestamp_secs, so replayed/out-of-order announcements regress peer state and manufacture freshness.
- Expectation: effort/s — done looks like: out-of-order and ancient-timestamp announcements no longer move state backwards or make a peer live, with regression tests in discovery.rs.
- Links: probe + log in goal hidden_files/probe-2026-10-27-laneB-discovery/ (verbatim discovery.rs, laptop-built)
dezren39 commented on Oct 31, 2026 dezren39 commented on Oct 31, 2026
MetadataMetadataapp/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item DevelopmentNo branches or pull requestsIssue actions
|