gstack/browse
quetaifu e695f7f586 auto-detect VPN TUN mode to prevent direct:// from breaking TLS
When a transparent-proxy VPN (Shadowrocket, ClashX, Surge in "enhanced/TUN
mode") captures traffic at the routing layer via a utun interface, the
original opt-in patch (BROWSE_NO_PROXY=1 → --proxy-server=direct://)
becomes counter-productive: direct:// can't escape TUN, packets still get
MITM'd, and Chromium's own cert store rejects the VPN's MITM cert
resulting in SSL error code 1, net_error -100 on every HTTPS navigation.

The fix in HTTP-proxy-only mode (original scenario) and the fix in TUN
mode need opposite Chromium configs:
  - HTTP-proxy-only: --proxy-server=direct:// bypasses the proxy.
  - TUN mode: no flag — Chromium inherits system proxy, connects through
    the VPN's HTTPS proxy explicitly, and accepts the MITM cert signed
    by a keychain-trusted root.

Heuristic: look for a utun interface with an IP in 198.18.x.x (IANA
benchmark range, used by Shadowrocket/ClashX for TUN routing). When
found, skip direct:// and log an explanation so the user knows why.

Backward compatible:
  - BROWSE_NO_PROXY unset (default): no change, no flag added.
  - BROWSE_NO_PROXY=1 + no TUN: no change, direct:// applied as before.
  - BROWSE_NO_PROXY=1 + TUN: NEW — auto-skip with informative log.
  - BROWSE_NO_PROXY=force: always apply direct:// (escape hatch for
    users who want the old strict opt-in behavior).

Verified on macOS with Shadowrocket TUN mode active (utun6 198.18.0.1):
before patch → SSL handshake failed / net_error -100 on all HTTPS.
After patch → example.com + authenticated fly.dev pages load correctly.
2026-04-19 12:12:48 +08:00
..
bin feat: multi-agent support — gstack works on Codex, Gemini CLI, and Cursor (v0.9.0) (#226) 2026-03-19 18:20:50 -07:00
scripts fix: Windows support — Node.js server fallback for Playwright (#255) 2026-03-20 12:22:11 -07:00
src auto-detect VPN TUN mode to prevent direct:// from breaking TLS 2026-04-19 12:12:48 +08:00
test fix: security wave 3 — 12 fixes, 7 contributors (v0.16.4.0) (#988) 2026-04-13 07:49:37 -10:00
PLAN-snapshot-dropdown-interactive.md fix: snapshot -i auto-detects dropdown/popover interactive elements (#845) 2026-04-05 22:57:45 -07:00
SKILL.md feat: UX behavioral foundations + ux-audit command (v0.17.0.0) (#1000) 2026-04-14 07:47:11 -10:00
SKILL.md.tmpl feat: sidebar CSS inspector + per-tab agents (v0.13.9.0) (#650) 2026-03-30 12:51:05 -06:00