feat(browser): in-app browser tab with webview security hardening#3181
feat(browser): in-app browser tab with webview security hardening#3181MattPua wants to merge 8 commits into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
- Globe button in panel tab bars opens an embedded browser tab (Electron <webview>), gated behind posthog-code-browser-tab flag - Main-process hardening: preload/node stripped from guests, scheme allowlist (http/https/about), link-local metadata range blocked, powerful permissions denied, popups routed http(s)-only to OS browser - Address bar normalizes input (scheme passthrough, host detection, search fallback); disallowed schemes become searches - Last committed url persists on the tab for restore-on-reload Generated-By: PostHog Code Task-Id: 4bc7193a-bc2b-4365-8435-a6b20cd00c08
b4db740 to
7ca9a4e
Compare
|
Addressed the review feedback (PostHog Code, on behalf of the author):
|
|
React Doctor found 7 issues in 1 file · 7 warnings. 7 warnings
Reviewed by React Doctor for commit |
Single "+" opens a Terminal/Browser menu instead of a row of icon buttons; falls back to the direct add-terminal button when the browser flag is off (a one-item menu is worse than a plain button). Generated-By: PostHog Code Task-Id: 4bc7193a-bc2b-4365-8435-a6b20cd00c08
- Indeterminate top bar (shared quill-section-loading swoop) over the page area during loads - Reload button becomes a stop button mid-load Generated-By: PostHog Code Task-Id: 4bc7193a-bc2b-4365-8435-a6b20cd00c08
Generated-By: PostHog Code Task-Id: 4bc7193a-bc2b-4365-8435-a6b20cd00c08
82f4907 to
deae0e5
Compare
Generated-By: PostHog Code Task-Id: 29a0c450-6d5c-454e-a2c0-608d280d4737
Generated-By: PostHog Code Task-Id: 29a0c450-6d5c-454e-a2c0-608d280d4737
Block the IPv6-mapped metadata address and GCP's metadata DNS name, which the IPv4-only host check let through. Extract the pure navigation guard to a testable module with regression coverage. Generated-By: PostHog Code Task-Id: 29a0c450-6d5c-454e-a2c0-608d280d4737
…elper updateTabLabel/updateTabMetadata/updateBrowserTabUrl shared the same find-tab-walk-and-map dance. Extract updateTabById; add coverage for the two transforms that lacked it. Generated-By: PostHog Code Task-Id: 29a0c450-6d5c-454e-a2c0-608d280d4737
Problem
Working on web changes means bouncing between the app and an external browser. There's no way to view a page (docs, a local dev server, a PR) inside the app next to your task.
Changes
CleanShot.2026-07-06.at.13.12.17.mp4
Adds an embedded browser tab. The panel tab bar "+" is now a dropdown (Terminal / Browser); it stays a plain add-terminal button when the browser flag is off. Gated behind
posthog-code-browser-tab(always on in dev).BrowserPanel(features/browser/): address bar with back/forward/reload over an Electron<webview>; host-agnostic viaonUrlChange/onTitleChangecallbackswindow.ts(the authoritative boundary — guest pages can't script around it):will-attach-webviewstrips preload/node access, forces context isolationhttp/https/aboutonly, link-local metadata range (169.254.0.0/16) blockedfile:,chrome:,javascript:...) become searchesabout:blankAccepted residual risks (deliberate): loopback/LAN reachable (dev servers are a first-class target), shared authenticated profile across tabs, host blocking is literal-IPv4 (no resolved-IP/IPv6 filtering).
How did you test this?
normalizeAddressunit tests (incl. disallowed schemes), panel transform tests+dropdown opens Terminal/Browser and each adds a tab@posthog/ui+@posthog/coresuites pass, typecheck + biome cleanAutomatic notifications
Created with PostHog Code