2 Commits
Author SHA1 Message Date
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