Commit Graph
44 Commits
Author SHA1 Message Date
BigBodyCobainandClaude Opus 5.5 591645992b Keep secure mail sessions working across backend restarts
A node that restarted lost the private half of the MLS key package in its
published bundle, so a welcome built from it could never be joined and the
sender's session stayed stuck with no way to reset it. Restarts also wiped
working sessions in two more ways. Fixes, each covered by a test:

- privacy-core: the saved DM state (v2) now carries every DM alias identity
  and its newest unused key packages (at most 16, unexpired), not only
  identities that already have a session. v1 state still loads. A new
  export call takes the identity list; older library builds fall back to the
  old export.
- The key package is saved as soon as it is created for the bundle.
- A session joined as the node's DM identity records that identity, so
  loading no longer drops it for lacking a per-contact identity.
- Re-reading mail already read (spent key) or mail from another group fails
  that message only; it no longer marks a restored session stale and wipes
  the conversation. A restored session that works is no longer suspect.
- A sender whose session is still unanswered checks the peer's bundle (at
  most every 5 minutes) and starts over if the key package changed; the
  peer rejoins from the welcome that rides along, keeping the new session
  only if it reads the message. Welcomes already joined are refused, so an
  old one replayed cannot roll a session back.
- /api/wormhole/dm/reset for a contact also drops its MLS session.

Verified with two fresh Docker nodes: mail sent after the receiver
restarted, a reply after the receiver restarted again, and mail after the
sender restarted all arrived readable on the original session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 08:11:42 -07:00
BigBodyCobainandClaude Opus 5.5 90d3fa370b Make secure mail work between two fresh nodes
Mail between two nodes that had just exchanged contact addresses never
arrived readable. Fixes along the whole path, each covered by a test:

- Status: the web UI's own requests get the full wormhole status, so it
  stops treating a ready node as not ready.
- Invites: the owner node named in an invite is asked first, with an
  onion-sized timeout; an import that could not reach it finishes in the
  background and replaces the keyless contact it left behind.
- Aliases: no one-sided mailbox alias is made up on compose; both sides
  address mail by node id until an alias is agreed.
- Signing: each mailbox request is signed once, keeping polls under the
  sign rate limit.
- MLS: the welcome is sent with the mail until the peer answers, and the
  receiver joins as the identity whose key package the sender used, with
  that identity's DH key.
- Sender seal: a seal addressed to the node's DM identity opens even when
  the browser names the node's transport identity.
- Gate rooms: the chat controller restarted the live stream and the room
  long-poll on every status refresh, about 60 requests a second, which
  exhausted local ports; it now reacts only to access changes, and the
  stream waits a minute between tries when there is no admin session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 05:17:48 -07:00
BigBodyCobainandClaude Opus 5.5 7322c56092 Keep the fleet peer secret on a fresh install
Reticulum is on by default and a fresh .env has no MESH_PEER_PUSH_SECRET.
Startup treated that as a missing secret and generated a random one, so
the seed and every peer rejected the node's announce and pushes with 403
and its gate posts and DMs never left the machine.

With fleet join on, an empty secret already means the shared testnet
secret everywhere peer keys are derived (effective_peer_push_secret).
Startup and the env checks now agree: they no longer replace or report
it. Private nodes (MESH_INFONET_FLEET_JOIN=false) still get a generated
secret and strict startup still refuses an empty one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:43:04 -07:00
BigBodyCobainandClaude Opus 5.5 7a15c7fbda Make Infonet usable on a fresh install without an admin login
A fresh-clone Docker test showed that joining Infonet worked after #760,
but everything after it did not:

- Gates and DMs still needed the admin key. Every gate, DM and identity
  route the web UI calls now takes the proxy's operator-client token
  (require_operator_client, or the new require_operator_client_or_admin
  for routes that also take scoped admin tokens). Both copies of routes
  defined in main.py and in routers/wormhole.py are switched, and an
  unguarded duplicate of GET /api/wormhole/gate/{gate_id}/key is guarded.
  Wormhole restart and the review, witness-import and transparency
  publish tools stay admin-only.
- The backend only trusted browser origins on port 3000. The proxy sends
  the token only after its own same-origin check passed, so the token now
  stands for that check and a UI on any port works.
- LAN mode shares the dashboard with other devices, which can send any
  Host header, so there the proxy withholds the token and the backend
  ignores it: every browser signs in with the admin key, as before.
- A missing default local bootstrap manifest was reported as a bootstrap
  error, so every new node showed "bootstrap warning". The file is
  optional (peers come from the bundled seed and the signed swarm
  manifest); a manifest path the operator configured must still exist.
- The README Docker quick start never created ADMIN_KEY, so the first
  `docker compose pull` failed. It now creates one (bash and PowerShell)
  and says what the key is for.

Tests that bypassed auth by overriding the old guards also override the
new ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 22:32:31 -07:00
BigBodyCobainandClaude Opus 5.5 4b72c7c02d Make Reticulum gate posts verifiable and nodes reachable after reconnects
- Send a gate post's stored payload as it is, minus the gate name, instead
  of rebuilding it from a field list. The rebuild dropped empty and
  signed-context fields, so every receiver rejected the post as an
  event_id mismatch. The ledger id check now ignores gate_ref, which only
  names the gate on the Reticulum wire.
- Count gate publishes from the send result (no peer lookup).
- Announce again shortly after the hub tunnel opens a new upstream
  connection, at most every 30 s. The tunnel hid reconnects from the
  online check, so after a hub restart nothing could reach a node until
  its next 15 minute announce.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:34:52 -07:00
BigBodyCobainandClaude Opus 5.5 976cdcfa2f Send maximum-privacy DMs over Reticulum in anonymous mode too
Anonymous mode forced every DM onto the Tor relay because direct
Reticulum could show the sender's IP. With maximum privacy on,
Reticulum runs inside Tor, so it is the hidden route: use it, and never
fall back to the relay; wait while Reticulum inside Tor is unavailable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:34:51 -07:00
BigBodyCobainandClaude Opus 5.5 bb05853df3 Send gate posts over Reticulum once, through the gate path
Every ledger append was also broadcast over Reticulum as a plain ledger
event. For a private gate post that sent the raw entry, gate name
included, before the release worker decided anything, and marked the id
as seen so the real gate publish was then dropped as a duplicate while
the outbox reported the post delivered. Keep gate posts out of the
ledger broadcast so they leave only through publish_gate_event.

Also count send outcomes (sent, no path, link failed, transfer failed)
and gate/DM handling outcomes, with no identifiers, in the operator-only
Reticulum status, and log a gate post that could not be stored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:34:51 -07:00
BigBodyCobainandClaude Opus 5.5 63c090ecec Answer other nodes' DM key lookups locally instead of searching again
A node that did not hold a requested invite key searched up to 16 more
nodes, and each of those searched again, so one lookup grew into a
network-wide flood that only the 120 s deadlines stopped. Mark fleet
lookups with a header (older nodes are recognised by the fleet user
agent) and answer them from local data only. The node's own user still
searches the fleet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:34:51 -07:00
BigBodyCobainandClaude Opus 5.5 6a5c50d970 Reuse the parsed peer store until the file changes
Every DM key lookup and several sync loops load the peer store, and on a
node that has collected thousands of swarm peers each parse takes a large
share of a second. On a one-CPU node concurrent parses tied up every
request worker, so unrelated endpoints hung. Records are frozen, so keep
the parsed records per path and reparse only when the file's mtime, size
or inode changes (saves replace the file atomically).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:34:51 -07:00
BigBodyCobainandClaude Opus 5.5 f72b85b0be Carry the ledger link on gate posts sent over Reticulum
Gate posts in the private ledger have a ledger event id, which a receiver
can only check with the previous ledger hash. The Reticulum publish left it
out, so every receiver would have rejected those posts as an event-id
mismatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:34:51 -07:00
BigBodyCobainandClaude Opus 5.5 8c7aca8810 Keep Tor as the backbone; add opt-in maximum privacy and a Tor-down choice
With Reticulum on, DMs and gate posts used to wait until both Tor and
Reticulum were ready. Now:

- Normal mode needs Tor only. DMs keep going through the Tor relay, gate
  posts publish over Tor first, and Reticulum joins in when it is up.
- Maximum privacy (off by default, labelled slow) sends DMs and gate posts
  only over Reticulum inside Tor and waits while either is down. It never
  falls back to the relay, and this node's own gate posts are not served
  over the Tor peer push or pull, so no peer can tell which node wrote
  them.
- When Tor is down, queued DMs and gate posts ask right away whether to
  send over a direct Reticulum link, saying what that gives up (the hub
  sees your IP address; watchers see you use Shadowbroker; content stays
  end-to-end encrypted and the recipient still cannot see your IP).
  "Send over Reticulum" covers everything already waiting. "Don't ask me
  again" asks "Are you sure?" first, then makes the direct link the
  automatic backup. The direct link opens only after that consent and
  closes as soon as Tor is back.
- Settings has the maximum-privacy switch and a way to be asked again.
- A hub node also offers its hub port on its onion address.
- Only the primary backend runs Reticulum, and Tor-tier checks read its
  status in-process, so one node does not announce two identities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:34:51 -07:00
BigBodyCobainandClaude Opus 5.5 d821cb7d47 Make Reticulum reach other nodes: hub link over Tor, discovery, link sends
The Reticulum bridge could not reach anyone: the library was not installed,
nodes never announced themselves, peers had to be typed in by hash, and
sends built a destination without the peer's identity, which Reticulum
cannot deliver.

- Install Reticulum and turn it on by default. Each node writes its own
  Reticulum config and links to the fleet hub through a local port that is
  carried over Tor to the hub's onion service, so the hub never sees a
  node's address. A node set up as a hub listens and forwards instead.
  Local-network discovery stays off unless asked for.
- Announce our destination when a link comes up, after each session
  rotation and on a jittered timer; collect peers from announces on this
  network, and ask the first few peers who else they know.
- Send over Reticulum links on sender threads. Links carry payloads of any
  size and do not reveal who opened them.
- Diffuse to a few random peers, and pass on messages not seen before with
  a hop limit, so a message reaches the whole network without one node
  sending it to everyone. Cover traffic goes one hop only.
- Keep relayed DMs for a day (capped), let nodes fetch DMs that arrived
  while they were away, and do not hand the same DM over twice.
- "ready" in the status now means Reticulum can carry traffic: linked and
  with peers known.
- Keep the backend's own shutdown handling: Reticulum would otherwise
  replace the process's signal handlers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:34:51 -07:00
BigBodyCobainandClaude Opus 5.5 52a39856f1 Fix gate pull cursors and sender identity on DM replication
Gate pull used this node's own post count as its position in the peer's
list. Two nodes can hold the same number of different posts, so the pull
decided there was nothing new and never fetched posts relayed through a
seed. The cursor now tracks the position in each peer's list and steps
back a little each time so late posts that sort earlier are still seen.

DM replication put the destination's URL in X-Peer-Url and keyed the HMAC
from it. Receivers check that header against their own peer list, so a
node that does not list itself (any seed) refused every relayed DM. The
push now identifies the sending node, like the other peer loops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 15:21:17 -07:00
BigBodyCobainandClaude Opus 5.5 b2296fe5f0 Reach the configured seed first and stop trusting stale peer history
A node with no history reaches the network through its configured seeds,
but those seeds sorted behind peers whose last success was weeks old, so
each pass spent its contact budget on dead peers first. Configured seeds
(including the fleet default when none is set) now rank with operator
peers, and successes older than a week no longer vouch for a peer. The
self-announced "seed" role earns nothing, since any node can claim it.

Prekey lookups across push peers leave the seeds out unless nothing else
is known, so lookups do not all land on the same few seeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:33:24 -07:00
BigBodyCobainandClaude Opus 5.5 aeb7ce085b Keep the ledger link on stored gate posts so any node can relay them
A node that received a gate post from a peer dropped its ledger link
(prev_hash) when storing it, so it could not pass the post on: the next
node had no way to check the ledger event id and rejected it. Posts only
reached nodes that talked to the author directly. The link is now kept
when it was verified and sent on with the post, so posts travel through
seeds and other relays. An unchecked link is never stored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:33:24 -07:00
BigBodyCobainandClaude Opus 5.5 66e388998e Expect the circuit-sized onion timeout in the hinted lookup test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:33:16 -07:00
BigBodyCobainandClaude Opus 5.5 3a956f0434 Accept ledger event ids on gate peer sync and put operator peers first
Gate posts are committed to the private Infonet ledger, whose event id
hashes the previous ledger hash with the signed content. Gate peer push and
pull sent that id without the ledger link, and receivers checked it against
a different formula, so every current gate post was rejected as an event_id
mismatch. Senders now attach prev_hash for events in their local ledger, and
receivers accept the provided id when it matches the ledger hash; any other
id is still rejected. Wire copies also drop local-only payload fields.

Operator-added peers now sort ahead of peers whose only priority is a
success from weeks ago, so the per-pass contact cap reaches them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:33:07 -07:00
BigBodyCobainandClaude Opus 5.5 cb87208f02 Keep signed gate fields on peer push and run contact requests off the loop
The gate peer-push router dropped transport_lock from the event payload,
and the immediate push built its body without envelope_hash, gate_envelope,
transport_lock and reply_to. All of these are covered by the gate event
signature, so receivers rejected pushed posts as invalid and posts only
crossed through the slower pull path. Both paths now keep every signed field.

The connect-contact endpoint called a blocking function that makes HTTP
calls back into the same server directly on the event loop; it now runs in
a worker thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:33:07 -07:00
BigBodyCobainandClaude Opus 5.5 2cbec30cae Keep the DM relay hint and stop peer store lost updates
- The routed /api/mesh/dm/prekey-bundle and /api/mesh/dm/pubkey
  handlers dropped lookup_peer_url, so every invite lookup ignored the
  relay the sender named and fell back to a fleet-wide search that
  could run for many minutes. Pass it through.
- Give an onion relay hint a circuit-sized connect timeout; 5 s was
  shorter than building a circuit to an onion service.
- PeerStore.save() now merges with what other writers saved since its
  load, so concurrent loops and endpoints no longer drop each other's
  changes (an operator-added peer was being lost to a swarm refresh).
- Merge a swarm manifest with one load and one save instead of one per
  peer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:33:02 -07:00
BigBodyCobainandClaude Opus 5.5 eb5fcd7982 Find live peers in a large swarm and bound DM fan-out
- Probe peers nobody has vouched for in a fresh random order, untried
  first, so a long peer list is swept instead of the same few dead
  peers being retried every time their cooldown ends.
- A peer that reaches us with a valid peer HMAC is tried before unknown
  peers (ordering only; it still cools down if it then fails).
- DM fan-out without a named relay, and the invite prekey lookup across
  push peers, walked every known peer at the full (onion) timeout. Both
  now take live and vouched-for peers first and stop after a bounded
  number; the lookup also has an overall deadline.
- Swarm manifest refreshes no longer turn an operator-added peer back
  into a swarm peer or re-enable one the operator disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:32:41 -07:00
BigBodyCobainandClaude Opus 5.5 5aaac84f2f Fix peer push delivery for gate posts and DMs
- Tor and clearnet transports unpacked the per-peer body builder as if
  it were the body, so every peer push raised a TypeError and nothing
  left the node over those transports. Build the body per destination.
- The RNS gate fallback reported "published" even when RNS was off,
  which marked undelivered gate posts as delivered. Report failure
  unless RNS is enabled and ready.
- The gate push/pull loops and the immediate sends walked every known
  peer in store order with a long timeout. With thousands of swarm
  peers, mostly unreachable, a pass could take hours before reaching a
  live peer. Contact recently working peers first, then peers the
  peer store vouches for, back off failing peers with a doubling
  cooldown, stop a peer's remaining gates after its first failure, and
  cap contacts per pass and per send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:32:41 -07:00
BigBodyCobainandClaude Opus 5.5 58faf59a9f Fix DM first-contact lookup timeouts and connect-contact stall
- The registered GET /api/mesh/dm/prekey-bundle route (routers/mesh_dm.py)
  dropped lookup_peer_url, so the UI's invite lookup fanned out to every
  known peer instead of asking the invite owner, and could run for minutes.
  Forward it to the main handler.
- The hinted invite lookup used a fixed (5, 20) s timeout and a single try,
  shorter than the onion timeout and often shorter than a Tor round trip to
  a busy node. The invite owner's peer now gets its transport's normal
  timeout and one retry on a transport failure, bounded by the existing
  lookup deadline. Definitive answers ("not found") are not retried.
- POST /api/wormhole/dm/connect-contact ran send_contact_request on the
  event loop. That makes blocking HTTP calls back into the same server, so
  the API stalled until the call timed out. Run it in a worker thread, as
  the gate invite routes already do.
- openclaw_infonet._run_async called asyncio.run() inside a running loop in
  both branches, which raises RuntimeError. Run the coroutine on its own
  loop in a helper thread when a loop is already running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 12:42:00 -07:00
ShadowbrokerandClaude Opus 5.5 15ff75aaf8 Release dm/gate posts on explicit weaker-privacy approval, and prompt for it in the gate view (#757)
* Honour a per-message weaker-privacy approval for dm and gate release

On a node with RNS enabled but only one private transport up, dm and gate
items wait for private_strong. The "send with weaker privacy" approval
returned ok but did nothing: evaluate_network_release ignored it, the
worker wiped it on every pass for gate items, and the outbox overlay only
handled dm, so gate items never showed weaker_privacy_approval_required.

An explicit per-item approval now lets that one item release at
private_transitional, never lower. Without it the floor (Hardening Rec #4)
is unchanged and items stay queued. Contact-wide relay policies do not
lower the floor, and MESH_PRIVATE_RELEASE_APPROVAL_ENABLE=false disables
it entirely. Gate items now get the approval prompt in the outbox status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Show queued gate posts and the weaker-privacy prompt in the gate view

Gate posts are sealed in the local private outbox and can wait there for
private_strong, but no gate UI showed that. The approval prompt existed
only in the DM compose panel, so a stuck gate post looked "posted".

The Infonet gate view now lists this node's queued gate posts above the
composer. When the backend reports weaker_privacy_approval_required it
shows "Keep waiting" (first) and "Send with weaker privacy", which call
the existing private-delivery action route. It polls only while a post
is waiting. The Mesh Terminal says a post is queued instead of "Posted".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 08:37:03 -07:00
BigBodyCobainandClaude Opus 5.5 b79b87b3ba Endpoint hardening
Tighten access checks on a few backend endpoints, remove unused
duplicate route definitions from main.py, and add tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 05:47:22 -07:00
Claude f1f3c37500 Pin lane-floor tests to an RNS-enabled node
Two tests asserted that a gate at private_transitional fails its release
floor and that startup warm-up targets private_strong. Both now depend
on whether RNS is enabled, since Tor-only nodes use the Tor floor for
DMs and gates. Run them against an RNS-enabled node so they keep
checking the strict floor they were written for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UeX9wuqeVAQNr22zQHWj2H
2026-10-22 03:32:49 +00:00
Claude 123463caf3 Let gates release over Tor when RNS is off, and always pin privacy-core
Gate messages publish over Tor first, with RNS only as the fallback
carrier, but the release floor demanded private_strong (Tor and RNS).
RNS is not installed by default, so on an ordinary node every gate post
sat in "Queued for private delivery" forever. Gates now get the same
Tor-only floor DMs already use when RNS is not enabled; nodes that
enable RNS keep the two-transport floor.

The start scripts' privacy-core pin refresh skipped whenever
backend/.env was missing or private lanes were turned on from the UI
rather than .env, which is the common case. It now pins the locally
built library regardless, creating backend/.env if needed, matching
what the Docker entrypoint already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UeX9wuqeVAQNr22zQHWj2H
2026-10-22 03:08:47 +00:00
Claude cbf3029138 Share gate keys across nodes over the encrypted DM lane
Gate history is readable on another node only through the gate envelope,
which is keyed from a per-gate secret that every node generated on its
own. Nothing ever moved that secret between members, so two operators in
the same gate could not read each other.

Members can now send the current gate key to a DM contact inside an
end-to-end encrypted DM. The key rides as a control frame that is
stripped on decrypt, so it never reaches the browser or the mailbox. The
recipient's operator accepts or declines it; the previous local key is
archived so existing history stays readable.

Rotation sends the new key to every contact the key was granted to,
minus excluded peers. Recipients apply a rotation automatically only
when it comes from the member they got the key from, and forward it to
their own grantees. Ban/kick rotations now redistribute too, instead of
silently splitting the gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UeX9wuqeVAQNr22zQHWj2H
2026-10-22 03:06:11 +00:00
Clint Bodungen 625b6030ed Run prekey and pubkey fleet lookups off the event loop
dm_get_prekey_bundle and dm_get_pubkey are async but called the
synchronous fetch_dm_prekey_bundle directly. When the lookup handle
isn't local it calls peers over the network, which blocked the event
loop so every endpoint stopped answering until it returned. Run it with
asyncio.to_thread, as main.py does for other blocking calls, and add a
regression test that checks the loop keeps ticking during a slow lookup.
2026-09-29 09:50:52 -05:00
BigBodyCobain d38c886af9 Harden mesh bootstrap defaults 2026-07-10 20:27:56 -06:00
BigBodyCobain 5ede669a12 Ship ShadowBroker v0.9.83 with live Infonet gate messaging and DM protocols.
Gate hashchain replication, Tor/SOCKS transport hardening, terminal session teardown, v0.9.83 UI/changelog, and release digest pins for seamless updater verification.
2026-06-15 15:37:29 -06:00
BigBodyCobainandCursor c266c5ff5e Close v1 swarm: fresh-participant smoke test, join retries, README fleet note.
Retry announce/manifest while Tor circuits warm on NODE and startup bootstrap.
Add verify_swarm_fresh_participant.py for empty-volume GHCR smoke tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 03:09:02 -06:00
BigBodyCobainandCursor 89d6bb8fb9 Ship DM connect delivery, fleet pubkey lookup, OpenClaw Infonet agent, and relay auto-wormhole.
Auto-relay connect DMs with End Contact severing, signed fleet prekey lookup,
OpenClaw private Infonet channel intents, headless relay Tor bootstrap on redeploy,
and swarm/DM live verification scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 02:15:56 -06:00
BigBodyCobainandCursor df76f6f147 Enable zero-config Infonet fleet join for all participant nodes.
Ship sb-testnet fleet defaults, swarm/join API, NODE launcher registration step, and meshnode script defaults so users discover peers via the signed seed manifest without manual peer lists.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-11 10:25:48 -06:00
BigBodyCobainandCursor 776c89bfcf Add private Infonet swarm discovery and gate propagation.
Signed peer manifest pull/announce on the seed, immediate hashchain push for gate messages, seed-only Docker defaults, and stale-genesis sync diagnostics.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-11 03:15:25 -06:00
ShadowbrokerandClaude Opus 4.7 1d7fa5185a feat(infonet): private gate + DM hashchain spool with hardened propagation (#326)
Private gate messages and offline DMs now ride the Infonet hashchain
as ciphertext-only events, replicated across nodes via private
transports (Tor onion / RNS / loopback) and decrypted only by parties
holding the gate or recipient keys.

Hashchain core (mesh_hashchain.py)
----------------------------------

* New ``append_private_gate_message`` and ``append_private_dm_message``
  append paths with full signature verification, public-key binding,
  revocation check, and replay protection in a dedicated sequence
  domain (so a gate post does not consume the author's public broadcast
  sequence, and a DM cannot replay-block a public message at sequence=1).
* Fork validation and full-chain validation now accept the gate
  signature compatibility variants — older signatures that canonicalize
  with/without epoch or reply_to still verify, so a re-sync from an
  older peer doesn't reject still-valid history.
* DM hashchain spool: capped at 2 active sealed offline DMs per
  recipient mailbox, plus a per-(sender, recipient) cap so one prolific
  sender can't consume both slots. 1-hour TTL on the cap counter.
  Spool intentionally small — it's an offline bootstrap channel,
  not a persistent mailbox.
* Rebuild-state preserves the gate sequence domain across reloads so
  a chain reload doesn't accidentally let an old gate sequence
  replay-collide on next append.

Schema enforcement (mesh_schema.py)
-----------------------------------

* Private gate + DM payloads have closed allowlists of fields.
  Plaintext keys (``message``, ``plaintext``, ``_local_plaintext``,
  ``_local_reply_to``) are explicit rejection-bait — they raise before
  the event ever touches the chain.
* DM ciphertext + nonce must look like base64-ish sealed bytes;
  obvious base64-encoded plaintext shapes are rejected.
* ``transport_lock`` required: DM hashchain spool requires
  ``private_strong``; gate accepts ``private``/``private_strong``/
  ``rns``/``onion``.

Defense-in-depth at the network layer (main.py + mesh_public.py)
----------------------------------------------------------------

* ``_infonet_sync_response_events`` now silently redacts private events
  (gate_message + dm_message) unless the request looks like a loopback /
  onion / RNS / private transport caller. If an operator accidentally
  exposes :8000 to the public internet, an external puller gets
  public events only — never ciphertext.
* ``_sync_from_peer`` raises ``PeerSyncRateLimited`` for 429 (handled
  as 4-tuple return with retry_after_s) and ``PeerSyncHTTPError`` for
  other non-200 statuses (handled by ``_run_public_sync_cycle`` to
  honor server cooldown hints even outside the 429 path).

DM relay hydration (main.py)
-----------------------------

* New ``_hydrate_dm_relay_from_chain``: when accepted dm_message chain
  events arrive on a node, they get deposited into the local DM relay
  store with a deterministic sender_token_hash so re-sync of the same
  event is idempotent. Recipients see the ciphertext as a normal DM
  on their next poll and decrypt with their existing recipient key.

Other surfaces
--------------

* meshnode.bat / meshnode.sh now set ``MESH_INFONET_ALLOW_CLEARNET_SYNC=
  false`` and the participant runtime flags by default so a freshly
  spun-up node defaults to private-only sync.
* InfonetTerminal/InfonetShell.tsx adds a gate directory renderer for
  the new private-gate workflow.
* docker-compose.relay.yml binds the relay backend to 127.0.0.1:8000
  only; Tor's hidden service forwards onion traffic into 127.0.0.1.
  Public clearnet :8000 stays off the network edge.

Tests
-----

* 7 new tests in test_private_gate_hashchain.py + test_private_dm_
  hashchain.py covering: gate fork accepts ciphertext propagation,
  gate fork rejects plaintext, append rejects plaintext before
  normalize, append requires private_strong, append rejects
  non-sealed ciphertext shape, DM spool 2-per-recipient + 1-per-pair
  cap, DM hydration delivers to poll/claim.
* Updated test_mesh_node_bootstrap_runtime.py covers 429 backoff via
  PeerSyncRateLimited 4-tuple AND PeerSyncHTTPError exception.
* Updated test_s14b_public_sync_gate_filter.py + test_s9b_gate_store_
  hydration.py + test_gate_write_cutover.py cover the new private
  redaction on public sync responses.
* test_private_gate_hashchain.py + test_private_dm_hashchain.py:
  10 passed locally.
* Combined mesh-relevant suite (the 5 modified existing tests +
  2 new): 17 passed.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 21:25:18 -06:00
BigBodyCobain 31ebcb5cd9 Infonet sync: honor HTTP 429 Retry-After + exponential backoff
Fixes the retry-storm that's been keeping the local node 429'd out of
the seed peer (the diagnosis we ran earlier in the session). Pre-fix:

  1. Sync hits the seed peer, gets HTTP 429 (Too Many Requests)
  2. _peer_sync_response stringifies the status into a ValueError
  3. _sync_from_peer catches it, error becomes the str() of the exc
  4. _run_public_sync_cycle calls finish_sync(error=..., failure_backoff_s=60)
  5. next_sync_due_at = now + 60s
  6. After 60s, sync runs again, hits same upstream that hasn't reset
     its rate-limit bucket, 429 again. Loop indefinitely.

Net effect: a node that hit one transient 429 would hammer the seed
every 60s forever, keeping the bucket full and never recovering. We
saw this in the live status dump: consecutive_failures=49,
last_sync_ok_at=0, retry storm sustained over the entire uptime.

What changed
------------
services/mesh/mesh_infonet_sync_support.py

  * New typed exception PeerSyncRateLimited carries the parsed
    Retry-After value out of the HTTP layer instead of stringifying
    everything into a generic ValueError.

  * New parse_retry_after_header() handles both RFC 7231 §7.1.3
    forms (delay-seconds and HTTP-date). Clamped at 1 hour so a
    hostile peer can't silence us for days.

  * New _failure_backoff_seconds() helper computes the next delay
    as max(exponential, retry_after_s). Schedule with default
    base=60s, cap=1800s:

      failure 1 -> 60s     (preserves pre-fix for transient blips)
      failure 2 -> 120s
      failure 3 -> 240s
      failure 4 -> 480s
      failure 5 -> 960s
      failure 6+ -> 1800s  (capped at 30 min)

    cap_s=0 explicitly disables exponential entirely — operators
    who want pure-Retry-After behavior have that option.

  * finish_sync now accepts retry_after_s and failure_backoff_cap_s
    kwargs. Backward-compatible: existing callers that don't pass
    retry_after_s get the same first-failure delay as before (the
    base value), only repeat failures grow.

main.py

  * _peer_sync_response detects 429 specifically, parses the
    Retry-After header, raises PeerSyncRateLimited(retry_after_s=N).
    Includes the response body prefix in the message so the
    operator's last_error finally shows something useful.

  * _sync_from_peer extended to return (ok, error, forked,
    retry_after_s) — the 4th tuple element is non-zero only when
    the upstream sent a parseable Retry-After. Existing call shape
    preserved: the lone caller in _run_public_sync_cycle was
    updated in the same commit.

  * _run_public_sync_cycle forwards retry_after_s into finish_sync.

Tests
-----
backend/tests/mesh/test_infonet_sync_429_backoff.py — 17 new tests:

  TestParseRetryAfter (7):
    - integer seconds form
    - HTTP-date form (computed as seconds-from-now)
    - HTTP-date in the past returns 0
    - empty / whitespace returns 0
    - malformed returns 0
    - clamps to 1 hour (hostile-peer cap)
    - negative returns 0

  TestFailureBackoffSeconds (5):
    - exponential growth schedule pins each level
    - retry_after wins when larger than exponential
    - exponential wins when larger than retry_after
    - cap_s=0 disables exponential entirely
    - zero inputs return zero

  TestFinishSyncBackoff (5):
    - first failure uses base unchanged (pre-fix back-compat)
    - consecutive_failures actually grow the delay
    - retry_after honored at low failure count
    - success resets consecutive_failures
    - last_error carries the HTTP status / Retry-After detail

All 24 existing sync-support / status-gate tests still pass. Other
failures in tests/mesh/ are pre-existing on origin/main and unrelated
to this change (verified by running the same tests against the
user's main worktree without these edits).

What the operator sees after this lands + a docker rebuild
----------------------------------------------------------
With the live 429 storm we diagnosed:

  Pre-fix: consecutive_failures keeps climbing 1/min forever,
           last_error empty or generic
  Post-fix: consecutive_failures grows, next_sync_due_at backs off
           exponentially (max 30 min), last_error explicitly carries
           "HTTP 429 from <peer> (retry_after=Ns): <body>" so the
           operator can see what's actually wrong. Once the upstream
           bucket drains and a sync succeeds, consecutive_failures
           resets to 0 and the schedule returns to the normal 300s
           interval.
2026-05-22 22:55:05 -06:00
BigBodyCobain 11ea345518 Harden infonet control surfaces 2026-05-18 11:22:38 -06:00
BigBodyCobain 25a98a9869 Harden Infonet DM address flow and seed sync
Allow local-operator DM invite import without requiring a full admin session.

Prioritize bundled/bootstrap seed peers and shorten stale seed cooldowns for faster Infonet recovery.

Replace raw DM invite dumps with copyable signed-address controls, contact request handling, and safer sealed-send behavior while the private delivery route connects.
2026-05-12 21:23:38 -06:00
BigBodyCobain b86a258535 Release v0.9.79 runtime and messaging update
Ship the v0.9.79 runtime refresh with transport lane isolation, Infonet secure-message address management, MeshChat MQTT controls, selected asset trail behavior, telemetry panel refinements, onboarding updates, and desktop/package metadata alignment.

Also ignore local graphify work products so analysis folders do not leak into future commits.
2026-05-12 11:49:46 -06:00
BigBodyCobain b8ac0fb9e7 Harden v0.9.75 wormhole node sync and telemetry panels
Add Tor/onion runtime wiring and faster Infonet node status refresh.

Keep node bootstrap state clearer across Docker and local runtimes.

Use selected aircraft trail history for cumulative tracked-aircraft emissions.
2026-05-06 14:04:16 -06:00
BigBodyCobain 6ffd54931c Release v0.9.75 runtime and onboarding update
Ship the 0.9.75 source update with improved startup/runtime hardening, operator API key onboarding, Meshtastic MQTT controls, Infonet/MeshChat separation, desktop package versioning, and aircraft telemetry refinements.

Also updates focused backend/frontend tests for node settings, Meshtastic MQTT settings, and desktop runtime behavior.
2026-05-06 01:15:54 -06:00
BigBodyCobain 0fc09c9011 Fix Docker Infonet and Wormhole startup 2026-05-02 21:53:35 -06:00
BigBodyCobain 28b3bd5ebf release: prepare v0.9.7 2026-05-01 22:56:50 -06:00
anoracleofra-code 668ce16dc7 v0.9.6: InfoNet hashchain, Wormhole gate encryption, mesh reputation, 16 community contributors
Gate messages now propagate via the Infonet hashchain as encrypted blobs — every node syncs them
through normal chain sync while only Gate members with MLS keys can decrypt. Added mesh reputation
system, peer push workers, voluntary Wormhole opt-in for node participation, fork recovery,
killwormhole scripts, obfuscated terminology, and hardened the self-updater to protect encryption
keys and chain state during updates.

New features: Shodan search, train tracking, Sentinel Hub imagery, 8 new intelligence layers,
CCTV expansion to 11,000+ cameras across 6 countries, Mesh Terminal CLI, prediction markets,
desktop-shell scaffold, and comprehensive mesh test suite (215 frontend + backend tests passing).

Community contributors: @wa1id, @AlborzNazari, @adust09, @Xpirix, @imqdcr, @csysp, @suranyami,
@chr0n1x, @johan-martensson, @singularfailure, @smithbh, @OrfeoTerkuci, @deuza, @tm-const,
@Elhard1, @ttulttul
2026-03-26 05:58:04 -06:00