From ecaa248af0cdccf17c895e37ccdc187b2d5de7f7 Mon Sep 17 00:00:00 2001 From: beardthelion <56458543+beardthelion@users.noreply.github.com> Date: Fri, 20 Nov 2026 19:11:06 -0600 Subject: [PATCH 1/2] docs(node): correct the last_ping_ok trust comment for post-#248 behavior The comment warned the anonymous ping endpoint could still write the flag until #248 landed. #248 is merged: the endpoint is read-only and the gossip loop owns last_ping_ok through mark_peer_ping. The announce-path caveat remains true and is kept. --- crates/twigpine-node/src/db/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/twigpine-node/src/db/mod.rs b/crates/twigpine-node/src/db/mod.rs index 2228bff2..a9fdecf4 100644 --- a/crates/twigpine-node/src/db/mod.rs +++ b/crates/twigpine-node/src/db/mod.rs @@ -7901,10 +7901,12 @@ impl Db { // value, this comparison, and the existing trim_end_matches call sites. // // last_ping_ok is NOT a trust signal. An unauthenticated caller can - // clear it by announcing a different URL, and until #248 lands can also - // set it through the unauthenticated GET /api/v1/peers/{did}/ping, which - // writes mark_peer_ping from the stored URL's own probe response. Do not - // build a new consumer on this flag as if it were attacker-resistant. + // clear it by announcing a different URL. Since #248 the anonymous + // GET /api/v1/peers/{did}/ping endpoint is read-only (the periodic + // gossip loop owns this flag through mark_peer_ping and requires + // consecutive failures before clearing it), but the announce path + // still lets anyone clobber the flag. Do not build a new consumer on + // this flag as if it were attacker-resistant. // // Only the federated repo fan-out in api/repos.rs gates on this flag. // Four consumers act on a repointed http_url regardless of it (sync.rs's From 6e933ab97381417bce5a7ef39724961295d3ac9a Mon Sep 17 00:00:00 2001 From: beardthelion <56458543+beardthelion@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:06:30 -0600 Subject: [PATCH 2/2] docs(node): state exact announce and gossip rules for last_ping_ok Clarify that an unsigned announce with a changed http_url is refused with PeerWriteDenied::UnprovenRepoint and leaves last_ping_ok untouched, while a signed Proven announce with a changed URL clears it immediately and the periodic gossip loop clears it via mark_peer_ping only after consecutive failed probes. --- crates/twigpine-node/src/db/mod.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/twigpine-node/src/db/mod.rs b/crates/twigpine-node/src/db/mod.rs index a9fdecf4..1c5066bd 100644 --- a/crates/twigpine-node/src/db/mod.rs +++ b/crates/twigpine-node/src/db/mod.rs @@ -7900,13 +7900,16 @@ impl Db { // lands first. Normalizing instead would mean canonicalizing the stored // value, this comparison, and the existing trim_end_matches call sites. // - // last_ping_ok is NOT a trust signal. An unauthenticated caller can - // clear it by announcing a different URL. Since #248 the anonymous - // GET /api/v1/peers/{did}/ping endpoint is read-only (the periodic - // gossip loop owns this flag through mark_peer_ping and requires - // consecutive failures before clearing it), but the announce path - // still lets anyone clobber the flag. Do not build a new consumer on - // this flag as if it were attacker-resistant. + // last_ping_ok is NOT a trust signal. Since #248, the anonymous + // GET /api/v1/peers/{did}/ping endpoint is read-only and never writes + // it. An unsigned announce cannot change an existing row's http_url + // either: it is refused with PeerWriteDenied::UnprovenRepoint and + // leaves the row and last_ping_ok unchanged. Two paths clear it: a + // signed announce from that peer's own DID with a changed http_url + // clears it immediately (via the Proven CASE below), and the periodic + // gossip loop clears it through mark_peer_ping only after consecutive + // failed probes. Do not build a new consumer on this flag as if it + // were attacker-resistant. // // Only the federated repo fan-out in api/repos.rs gates on this flag. // Four consumers act on a repointed http_url regardless of it (sync.rs's