Commit Graph
21 Commits
Author SHA1 Message Date
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 68667e07a7 Let the operator's own UI join Infonet without an admin-key login
Joining Infonet from the UI failed with "operator authentication required"
unless the user had first unlocked admin with the admin key. That is the
first thing a new user does, so it hit everyone.

The frontend proxy now presents an HMAC of the admin key in
X-SB-Operator-Client, only when the page was reached by a name people use
for their own node (localhost, an IP, a LAN or single-label name, a
Tailscale name, or a configured host), and strips any copy of that header
a browser sends. The backend's new require_operator_client accepts that
token from an allowed origin, and otherwise falls back to the admin-key
check. Only /api/wormhole/join uses it; admin controls still need the key,
and a caller reaching the backend directly still gets 403.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 03:31:35 -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 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
BigBodyCobain 6f55659a5b Resolve map, operator access, updater, and Gemini Live issues 2026-11-13 18:10:20 -07:00
BigBodyCobain 9e17d80abf Merge latest origin/main while preserving AI missions and operator security 2026-10-27 18:00:40 -06:00
Claude 00fd0f9d60 Stop LAN-shared dashboards from handing out operator access
With the dashboard bound to the network (make up-lan), the frontend proxy
added the server ADMIN_KEY to every same-origin request and the backend
trusted the frontend container as the local operator, so any device on
the LAN that opened the dashboard had full control: DMs, contacts, gate
keys and settings. The proxy cannot tell the local browser apart from
other devices, because Next.js forwards client-supplied X-Forwarded-For
verbatim (verified against next start: a remote client sending
X-Forwarded-For: 127.0.0.1 reaches the backend as 127.0.0.1).

SHADOWBROKER_LAN_MODE=1, set by make up-lan, now makes the proxy inject
the admin key only for signed-in admin sessions and stops the backend
trusting the frontend container. Loopback tools on the host keep working.
For a backend behind nginx/Caddy on the same host, the new opt-in
SHADOWBROKER_UNTRUSTED_LOOPBACK=1 makes loopback callers present the key
too. Default installs are unchanged.

Also compare the admin key in constant time at sign-in, and make the
403 message say how to sign in from another device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UeX9wuqeVAQNr22zQHWj2H
2026-10-22 04:57:47 +00:00
BigBodyCobain 1a574e56b5 Require explicit operator sessions and bound API request bodies 2026-10-13 22:43:28 -06:00
BigBodyCobainandCursor 7151563a41 Fix Extra-participant E2E: live contact send and Tor prekey cache path.
Adds connect-contact HTTP endpoint with cached-bundle support, subprocess contact send via docker cp bundle file, and direct Tor prekey fetch to avoid wedging single-worker uvicorn.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 17:00:13 -06:00
BigBodyCobainandCursor f1cd9eb4b9 Pass Tor E2E shared DM flow and harden mesh relay for fleet participants.
MLS export/reset and accept use live HTTP so uvicorn privacy-core state stays consistent; relay persistence and sender_seal fixes enable invite-accept-shared decrypt across onion peers. Adds participant/e2e compose overlays and harness recovery with optional Tor-only replicate mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 11:26:57 -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
BigBodyCobain 41e35e4da2 Fail fast on short admin keys 2026-05-28 15:02:40 -06:00
BigBodyCobain 017f383096 Fix BadHost path handling 2026-05-28 01:24:33 -06:00
Shadowbroker 2e14e75a0e Fix #256: per-peer HMAC secrets defeat cross-peer impersonation (#281)
Before this change, every peer-push HMAC was derived from the single
fleet-shared MESH_PEER_PUSH_SECRET. The receiver could prove "this
request was signed by someone who knows the fleet secret" but it could
NOT prove which peer signed it. Any peer that knew the global secret
could compute the expected HMAC for any other peer URL and forge a
push pretending to be that peer.

Fix: introduce MESH_PEER_SECRETS, an optional comma-separated
url=secret map. When a peer URL appears in the map, only the listed
per-peer secret is accepted for it -- the global secret is ignored for
that specific URL. Peer A no longer knows peer B's secret, so peer A
cannot forge a push claiming to be peer B.

The new helper resolve_peer_key_for_url() in mesh_crypto.py wraps the
lookup and is called from every existing peer-push call site:

- backend/auth.py:_verify_peer_push_hmac (receiver)
- backend/main.py:_http_peer_push_loop (Infonet event push)
- backend/main.py:_http_gate_pull_loop (gate event pull)
- backend/main.py:_http_gate_push_loop (gate event push)
- backend/services/mesh/mesh_router.py (two transports, push)
- backend/services/mesh/mesh_hashchain.py (gate wire ref key)
- backend/services/mesh/mesh_wormhole_prekey.py (peer prekey lookup)

Zero hostility, by design:

- Single-peer installs leave MESH_PEER_SECRETS empty -> resolver falls
  back to MESH_PEER_PUSH_SECRET -> behavior is byte-for-byte unchanged.
- Multi-peer installs that haven't migrated yet behave exactly as
  before.
- Multi-peer installs that DO migrate set MESH_PEER_SECRETS on both
  ends of each peering and immediately close the impersonation surface
  for those URLs. Migration is incremental: unlisted peers keep using
  the global secret.

Tests in backend/tests/test_per_peer_secret_resolver.py:
- env parsing (default, override, whitespace, malformed entries, cache)
- precedence: per-peer beats global
- migration window: unlisted peer falls back to global
- IMPERSONATION REFUSAL: peer A with global-secret-only cannot forge
  HMAC for peer B that has a per-peer secret configured
- IMPERSONATION REFUSAL: peer A with its OWN per-peer secret cannot
  forge HMAC for peer B
- positive control: legitimate peer B request verifies
- zero-behavior-change: single-peer install produces the same key bytes
  as before the change

Credit: tg12 (external security audit, P1/High/High confidence)
2026-05-21 10:05:29 -06:00
Shadowbroker 9ef6213284 Fix #250: bind Docker bridge local-operator trust to frontend hostname (#278)
Tightens the bridge-trust check so a connection on the Docker bridge
is only granted local-operator status when its source IP matches a
configured frontend container hostname (default: `frontend` + the
shipped `container_name` `shadowbroker-frontend`). Previously, when
`SHADOWBROKER_TRUST_DOCKER_BRIDGE_LOCAL_OPERATOR=1` was set, ANY IP
in the 172.16.0.0/12 range was granted local-operator privileges —
on a shared Docker host that included any unrelated container on the
same bridge.

Operators with renamed services can list new hostnames via the new
`SHADOWBROKER_TRUSTED_FRONTEND_HOSTS` env var (comma-separated). DNS
resolution is cached for 30s; if Docker DNS can't resolve any of the
configured names we fail closed and refuse the bridge entirely.

Single-user installs see no behavior change — the default-named
frontend container still resolves and is still trusted.

Credit: tg12 (external security audit)
2026-05-21 02:06:11 -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 eb0288ee4e Fix Docker local controls and setup guidance
Allow the bundled Docker frontend proxy to reach local-operator endpoints through the private compose bridge without trusting LAN clients. This restores Time Machine, MeshChat key creation, AI pins/layers, and related local controls in Docker installs. Refresh first-run guidance so Docker users know to configure OpenSky and AIS keys through .env.
2026-05-02 20:18:46 -06:00
BigBodyCobain e1060193d0 Improve v0.9.7 startup and runtime reliability
Prioritize cached first-paint data, defer heavyweight feed synthesis, make MeshChat activation explicit, improve CCTV media handling, and tighten desktop runtime packaging filters.
2026-05-02 17:31:54 -06:00
BigBodyCobain 28b3bd5ebf release: prepare v0.9.7 2026-05-01 22:56:50 -06:00