Skip to content

bearnet: cockpit panel + auto-launch for the capture sidecar#87

Merged
mdheller merged 1 commit into
mainfrom
bearnet-panel
Jul 23, 2026
Merged

bearnet: cockpit panel + auto-launch for the capture sidecar#87
mdheller merged 1 commit into
mainfrom
bearnet-panel

Conversation

@mdheller

Copy link
Copy Markdown
Contributor

Makes the network-visibility subsystem (PR #85) visible in the browser. This is the panel + wiring half.

Panel — settings/start/bearnet.html

Green-on-black BearNet panel, packaged into omni.ja at resource:///bearstart/bearnet.html and linked from the start page's new Network tile (📡). Three live sections matching the native shell:

  • Packet Capture — Start / Stop / Save + live monospace stream over the /events WebSocket. The Start button is the explicit user gesture (actor=user, userGesture=true, approvalToken) the gate requires to permit a capture.
  • Connection Map — live table of endpoints, category-colored (tracker/analytics/CDN/unknown), blocked status.
  • Firewall — per-domain Block / Allow / reset, rules list.

Auto-launch

  • assemble-cockpit.sh builds + stages the capture sidecar (skips gracefully without cargo).
  • bearbrowser-cockpit-up launches it on :8093 with --repo-root $RES so it resolves the bridge; safe to launch blindly (it refuses to run ungoverned).

Two fixes found by verifying against a live sidecar

  • CORS — the panel is a resource:// page fetching the loopback service cross-origin, so without CORS headers every request silently fails. Added a permissive CorsLayer (safe: loopback-only + every side effect gated).
  • Firewall keys on eTLD+1 — a rule on ads.evil.com now stores evil.com so it matches the map's eTLD+1 blocked-check (the shell's model). Verified: block ads.evil.com → ingest tracker.ads.evil.com shows blocked:true.

Verified live (not claimed)

Ran the real binary, opened the panel in a browser against it, and exercised every endpoint with the panel's exact payloads:

  • sidecar detects dumpcap; /capture/status, /map (classifies google-analytics=analytics, fastly=cdn), /firewall all correct
  • user-gesture+token capture-startHTTP 200 (gate permits); agent → 403
  • CORS preflight → 200 with allow-origin: *; WS /events upgrades; panel served 200 + JS syntax-valid

Caveat only a packaged build confirms

The resource://→loopback fetch also depends on the profile CSP connect-src allowing http://127.0.0.1:8093/ws://. If the hardened CSP blocks it, I'll add the loopback origin to the bearstart page's CSP. Flagging honestly — verified everywhere I can without a full build.

Makes the network-visibility subsystem VISIBLE in the browser. Adds
settings/start/bearnet.html — the green-on-black BearNet panel (packaged into
omni.ja at resource:///bearstart/bearnet.html, linked from the start page's new
Network tile) with three live sections matching the native shell:
- Packet Capture: Start/Stop/Save + live monospace stream over the /events WS.
  Start button = the explicit user gesture (actor=user, userGesture=true,
  approvalToken) that the gate requires to permit a capture.
- Connection Map: live table of endpoints, category-colored (tracker/analytics/
  cdn/unknown), blocked status.
- Firewall: per-domain Block/Allow, reset; rules list.

Auto-launch wiring:
- assemble-cockpit.sh builds + stages the capture sidecar (skips gracefully if
  cargo absent).
- bearbrowser-cockpit-up launches it on :8093 with --repo-root $RES so it finds
  the bridge; safe to launch blindly (it refuses to run ungoverned).

Two fixes found while verifying against a live sidecar:
- CORS: the panel is a resource:// page fetching the loopback service
  cross-origin, so the browser needs CORS headers or every request silently
  fails. Added a permissive CorsLayer (safe: loopback-only + gated).
- Firewall keys on eTLD+1: a rule on 'ads.evil.com' now stores 'evil.com' so it
  matches the map's eTLD+1 blocked-check (the shell's model). Verified: block
  ads.evil.com -> ingest tracker.ads.evil.com shows blocked:true.

Verified live: sidecar detects dumpcap; all panel endpoints return correct data
with the panel's exact payloads; user-gesture+token capture-start -> HTTP 200
(gate permits); agent -> 403; CORS preflight 200; WS upgrades; panel served 200
+ JS syntax-valid.
@mdheller
mdheller merged commit 947427c into main Jul 23, 2026
17 checks passed
@mdheller
mdheller deleted the bearnet-panel branch July 23, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant