bearnet: cockpit panel + auto-launch for the capture sidecar#87
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the network-visibility subsystem (PR #85) visible in the browser. This is the panel + wiring half.
Panel —
settings/start/bearnet.htmlGreen-on-black BearNet panel, packaged into omni.ja at
resource:///bearstart/bearnet.htmland linked from the start page's new Network tile (📡). Three live sections matching the native shell:/eventsWebSocket. The Start button is the explicit user gesture (actor=user, userGesture=true, approvalToken) the gate requires to permit a capture.Auto-launch
assemble-cockpit.shbuilds + stages the capture sidecar (skips gracefully without cargo).bearbrowser-cockpit-uplaunches it on:8093with--repo-root $RESso it resolves the bridge; safe to launch blindly (it refuses to run ungoverned).Two fixes found by verifying against a live sidecar
resource://page fetching the loopback service cross-origin, so without CORS headers every request silently fails. Added a permissiveCorsLayer(safe: loopback-only + every side effect gated).ads.evil.comnow storesevil.comso it matches the map's eTLD+1 blocked-check (the shell's model). Verified: blockads.evil.com→ ingesttracker.ads.evil.comshowsblocked: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:
dumpcap;/capture/status,/map(classifies google-analytics=analytics, fastly=cdn),/firewallall correctcapture-start→ HTTP 200 (gate permits); agent → 403allow-origin: *; WS/eventsupgrades; panel served 200 + JS syntax-validCaveat only a packaged build confirms
The
resource://→loopback fetch also depends on the profile CSPconnect-srcallowinghttp://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.