itsgoin/crates/core/src
Scott Reimers dfd3253734 Fix: GroupKeyDistribute admin forgery + cap concurrent port scanners
Two pre-release fixes found during audit.

1) GroupKeyDistribute admin forgery (critical)

   `group_key_distribution::try_apply_distribution_post` trusted the
   `admin` field inside the decrypted payload without verifying it
   matched the post's author. Exploit: any peer who learns a victim's
   posting NodeId (public — appears as a recipient on any DM/group
   post) and observes a target group_id in the wild could craft an
   encrypted distribution post claiming to be from the legitimate
   admin. The victim's storage uses INSERT OR REPLACE on group_keys,
   so a successful forgery would overwrite the victim's legitimate
   group key record and stored seed, breaking future rotations / key
   distributions from the real admin.

   Fix: reject the distribution post when `content.admin != post.author`.
   Added test `forged_admin_is_rejected` that seeds a legitimate
   record, attempts a forgery, and asserts the legitimate record is
   untouched.

2) Cap concurrent port-scan hole punches at 1 (bandwidth)

   `hole_punch_with_scanning` fires ~100 QUIC ClientHellos/sec for up
   to SCAN_MAX_DURATION_SECS (300s), ~1 Mbps per active scanner. With
   no cap, the growth loop / anchor referrals / replication paths
   could spawn several scanners at once and drive sustained multi-Mbps
   upload — particularly pathological on obfuscated VPNs where every
   probe stalls at a proxy timeout, explaining the reported 10 Mbps
   sustained upload after anchor connect.

   Fix: module-level `tokio::sync::Semaphore(1)` guarding entry to the
   scanning loop. Second-and-beyond callers fall back to the cheaper
   `hole_punch_parallel` (standard punching, no 100/sec port walk)
   instead of spawning another scanner. Permit is held for the scanner
   lifetime and released on return. Added unit test
   `scanner_semaphore_caps_concurrent_scans_at_one`.

Both changes leave the successful-call path untouched (single scanner
still runs; legitimate key distributions still apply). 120 / 120 core
tests pass.
2026-04-22 23:32:10 -04:00
..
activity.rs ItsGoin v0.3.2 — Decentralized social media network 2026-03-15 20:23:09 -04:00
blob.rs v0.3.6: Active CDN replication, device roles, budgets, tombstones, engagement fix, DOS hardening 2026-03-20 21:00:28 -04:00
connection.rs Fix: GroupKeyDistribute admin forgery + cap concurrent port scanners 2026-04-22 23:32:10 -04:00
content.rs ItsGoin v0.3.2 — Decentralized social media network 2026-03-15 20:23:09 -04:00
control.rs Phase 2d: profile posts signed by the posting identity 2026-04-22 22:30:27 -04:00
crypto.rs Phase 2e: rich comments — optional ref_post_id with signed preview 2026-04-22 22:46:24 -04:00
export.rs Phase 4 (0.6.3-beta): posting-key / network-key split (plumbing) 2026-04-21 22:38:12 -04:00
group_key_distribution.rs Fix: GroupKeyDistribute admin forgery + cap concurrent port scanners 2026-04-22 23:32:10 -04:00
http.rs Phase 2d (0.6.1-beta): route manifest + blob ops through file_holders 2026-04-21 21:09:45 -04:00
identity.rs First-run chooser, node shutdown on switch, file picker, export path fix 2026-04-06 01:58:02 -04:00
import.rs Platform: Reset wipe, empty name, Android browse + backup-off, import as personas 2026-04-22 17:40:21 -04:00
lib.rs Phase 2g: GroupKeyDistribute \u2192 encrypted post 2026-04-22 23:09:19 -04:00
network.rs Phase 2g: GroupKeyDistribute \u2192 encrypted post 2026-04-22 23:09:19 -04:00
node.rs Phase 2g: GroupKeyDistribute \u2192 encrypted post 2026-04-22 23:09:19 -04:00
profile.rs Phase 2d: profile posts signed by the posting identity 2026-04-22 22:30:27 -04:00
protocol.rs Phase 2g: GroupKeyDistribute \u2192 encrypted post 2026-04-22 23:09:19 -04:00
storage.rs Phase 2f: groups as a distinct primitive alongside circles 2026-04-22 22:58:39 -04:00
stun.rs Our Info panel, hole punch race fix, NAT profiles in relay introduction 2026-04-05 17:57:41 -04:00
types.rs Phase 2g: GroupKeyDistribute \u2192 encrypted post 2026-04-22 23:09:19 -04:00
upnp.rs ItsGoin v0.3.2 — Decentralized social media network 2026-03-15 20:23:09 -04:00
web.rs Phase 2d (0.6.1-beta): route manifest + blob ops through file_holders 2026-04-21 21:09:45 -04:00