Skip to content

browse proxy: macOS/Windows mismatch remedy loops; scheme-less unsupported-scheme and auto_proxy/SOCKS edge cases (#3448 follow-up) #3456

Open

Description

@capy-ai

Follow-up from #3448 (#3440 item 8), filed per GStack Minder's 2026-10-26 decision. These are the mismatch-remedy edge cases in the same family as this issue's original red-team notes.

New: the macOS/Windows remedy can loop into a second refusal

On darwin or win32, a session with BROWSE_PROXY_URL=direct plus a parseable HTTPS_PROXY, meeting a daemon that was started with no proxy (or with an unparseable HTTPS_PROXY, which on macOS/Windows hashes like no proxy), is refused and told to unset BROWSE_PROXY_URL. Following that advice makes the session resolve HTTPS_PROXY as a proxy, so its config hash differs from the daemon's again and it is refused a second time, now with (HTTPS_PROXY differs). Linux is unaffected, because direct hashes like no proxy there.

Reproduced read-only with extractGlobalFlags and proxyMismatchLines at platform='darwin' against a plain daemon state: after the remedy the hash is still not equal and a second mismatch prints.

Evidence: browse/src/cli.ts:509 — else if (flags.explicitDirect && !state.proxyDirect) remedies.push(\or unset BROWSE_PROXY_URL to use the running daemon with the system proxy settings`);`

Proposed fix: when flags.explicitDirect && !state.proxyDirect, check whether resolveProxy(null, env-without-BROWSE_PROXY_URL).url is non-null; if so, name that variable too (e.g. "or unset BROWSE_PROXY_URL and HTTPS_PROXY"). Add a mismatch test for the pair direct+HTTPS_PROXY against a plain daemon on darwin.

Related wording note (#3448 CHANGELOG, not blocking)

The ## [Unreleased] proxy-env-daemon.test.ts Tests bullet credits buildHeadedServerEnv and the BROWSER.md-literal check to proxy-env-daemon.test.ts; both actually live in proxy-env.test.ts (lines ~226-229 and ~322-330). One-line attribution fix the next CHANGELOG touch can carry.

Also worth folding in here (noted during #3448 review, not changed)

  • A slash-less unsupported scheme with credentials (socks4:bob:pw@host:1080, socks:, ftp:, ws:) is read as a scheme-less value with username = the scheme word, so it becomes an http:// proxy at that host instead of warning "unsupported proxy scheme". LEADING_SCHEME_RE lists only the supported schemes; widening it (e.g. /^(?:https?|socks(?:4a?|5h?)?|ftp|wss?):/i) restores the diagnostic. Not a leak (credentials go to the named host).
  • Chromium's Linux env reader also consumes auto_proxy (PAC) and SOCKS_SERVER/SOCKS_VERSION; --proxy-server=direct:// overrides them and directProxyLogLine never names them. Related to browse: Linux desktop sessions (GNOME/KDE) may lose a system PAC proxy under --proxy-server=direct:// #3450 (desktop PAC) but a distinct env mechanism.
  • The unparseable-variable warning and BROWSER.md say "connects directly" on every platform; on macOS/Windows without the opt-out the daemon actually keeps the system proxy settings (the daemon log is accurate). Same wording family already noted in browse: two macOS/Windows follow-ups from the #3448 review (post-upgrade refusal with a persistent BROWSE_PROXY_URL=direct; unparseable-variable warning wording) #3454.
  • percentDecodable decodes twice; the literal 'direct' appears at five call sites (export one constant); the url.search || url.hash test in parseProxyConfig is redundant beside the raw /[?#]/ check.

Activity

  1. added
    S3
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    S3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions