Skip to content

v1.91.248.0 fix(browse): direct mode launches Chromium with --proxy-server=direct:// so proxy env vars never win silently (#3440 item 8) - #3448

Merged
capy-ai[bot] merged 19 commits into
mainfrom
capy/direct-mode-launches-chromium
Oct 26, 2026
Merged

capy-ai[bot] merged 19 commits into
mainfrom
capy/direct-mode-launches-chromium

Conversation

@garrytan

@garrytan garrytan commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3448,
  "head": "15fafe0c5187322dd1789f30db53e104ca17edea",
  "version": "1.91.226.0",
  "base": "main",
  "gate": {
    "free-remote-linux": {
      "pass": 13442,
      "fail": 0,
      "skip": 0
    },
    "paid-pr": {
      "pass": 5,
      "fail": 0,
      "skip": 0
    },
    "qa-browse-linux": {
      "pass": 10,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "pregate": "requires-remote cleared @f9ad2d72cb13 (7 checks, current for 15fafe0c5187)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/40279674222",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/40279674222",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/40279677455",
    "pregate.json/remote_gate: remote-gate tree=f9ad2d72cb13 tests=13442 receipt=/tmp/remote-gate-receipt.txt sha256=caa1cf0db6f6"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      3440,
      3450
    ],
    "flakes": []
  }
}

Issues

Refs #3440
Refs #3450

This fixes item 8 of the #3440 umbrella (items 1-7 stay open). #3450 is the related Linux-desktop system-proxy question.

What changed

Before. BROWSE_PROXY_URL=direct (or an HTTPS_PROXY that did not parse) only stopped gstack from configuring a proxy. The daemon inherits the whole environment and launch() passed no proxy switch, so Chromium read HTTPS_PROXY, HTTP_PROXY or ALL_PROXY itself. Reproduced on Linux with Playwright 1.62.1's chrome-headless-shell: with HTTPS_PROXY pointing at a logging CONNECT proxy and BROWSE_PROXY_URL=direct, $B goto https://proxied.gstack-3440.test/ failed with net::ERR_TUNNEL_CONNECTION_FAILED and the proxy logged CONNECT proxied.gstack-3440.test:443, while the CLI printed only Starting server.... That made BROWSER.md's precedence list false and any certificate check on a proxied machine unreliable.

After. Every launch path (launch, the BROWSE_EXTENSIONS_DIR persistent context, launchHeaded, handoff) adds --proxy-server=direct:// when no proxy is configured, from one proxyLaunchArgs(). The same goto now fails at DNS (ERR_NAME_NOT_RESOLVED) and the proxy log stays empty. A configured proxy was already explicit (Playwright passes it as --proxy-server), so the environment can no longer win silently in either mode. On macOS and Windows, where Chromium never read the proxy variables and follows the system proxy settings, the switch is passed only when BROWSE_PROXY_URL=direct, which is hashed into the daemon config, persisted as proxyDirect, re-emitted on auto-restart, and makes a mismatched running daemon refuse reuse. The daemon log records the effective mode on every launch: [browse] [proxy] none: direct connection (--proxy-server=direct://; ignoring HTTPS_PROXY) beside the existing [proxy] using <url> from <source> line.

Reading the proxy variables (GStack Minder decisions A and B)

The whole point of the fix is that "direct" is true whenever gstack says it. That exposed a reading gap, resolved by two owner decisions:

  • Decision A — a standard proxy variable in the plain scheme-less shape (host:port or user:pass@host:port, env-sourced only) is read as http://. For host:port that is exactly what Chromium's own environment reader took it as, so a session Chromium used to proxy by itself stays proxied now that the launch is explicit; user:pass@host:port follows curl's reading and is newly proxied, because Chromium rejects any proxy spec that carries a userinfo (net/base/proxy_string_util.cc). --proxy and BROWSE_PROXY_URL stay strict and still require a scheme.
  • Decision B — a value whose userinfo opens with a known scheme (https:bob@host:3128, which the URL parser reads as https://) keeps that scheme; a proxy URL with a path other than a bare /, a query, or a fragment (a literal ?/# anywhere) is refused for every source, because that is where a DOMAIN\user login or a / in a password lands after URL parsing and only the userinfo is redacted. A credential-free env value with a path (http://proxy.corp:3128/pac) now warns and goes direct, where it used to be read with the path dropped; the CHANGELOG states that narrowing.

Why --proxy-server=direct:// and not --no-proxy-server

Measured on this machine with a plain Playwright launch and HTTPS_PROXY set:

build no switch --no-proxy-server --proxy-server=direct://
chrome-headless-shell 151 (default headless) CONNECT reached proxy CONNECT reached proxy no CONNECT
full Chromium 151 (headed, handoff) CONNECT reached proxy no CONNECT no CONNECT

chrome-headless-shell only reads --proxy-server, so --no-proxy-server would have left the default headless path exposed. direct:// works on both builds.

Documentation

Status: updated. BROWSER.md "Proxy from environment" describes the explicit launch, the scheme-less reading (with the host:port vs user:pass@host:port distinction), the path/query/fragment refusal and per-scheme percent-encoding, the macOS/Windows opt-out, and the effective-mode log lines including the SOCKS5 bridge lines. The eMudhra/TLS trust section (#3403, GSTA-84) is untouched, and the cookie workflow judge input is unchanged (test/cookie-workflow-judge-input.test.ts passes).

Follow-ups filed

Approvals

Tests

  • browse/test/proxy-direct-launch.test.ts (new, Linux, real Chromium): two logging CONNECT proxies on loopback, a target name that does not resolve. With HTTPS_PROXY set and BROWSE_PROXY_URL=direct: goto fails at DNS, no CONNECT reaches the proxy, the daemon log names the ignored variable, the state file has no proxy. On the unfixed tree this case fails with ERR_TUNNEL_CONNECTION_FAILED and a logged CONNECT (red-proved by stashing the fix). Controls: HTTPS_PROXY alone is the configured proxy and receives the CONNECT; a scheme-less HTTPS_PROXY is the configured proxy; --proxy beside HTTPS_PROXY sends the CONNECT only to the configured proxy.
  • browse/test/proxy-direct-launch-args.test.ts (new, Linux + macOS CI): the --proxy-server=direct:// switch on the launched Chromium command line, present on Linux and under BROWSE_PROXY_URL=direct, absent on macOS/Windows without the opt-out.
  • browse/test/proxy-direct-launch-paths.test.ts (new, Linux under Xvfb): the extension context, launchHeaded and handoff paths, with a configured-proxy control.
  • browse/test/proxy-env.test.ts, proxy-config.test.ts, restart-env.test.ts, proxy-env-daemon.test.ts: the scheme-less reading, the slash-less scheme spelling, the path/?/# refusal, the credential-spill and percent-encoding guards, the config hash, the per-platform mismatch remedies, the proxyDirect state and crash-restart re-emit, and the BROWSER.md literal contract.

Test plan

  • Remote free tier (Ubicloud, full Linux suite) on the pushed tree: 13442 tests, 0 failed.
  • Free Tests CI (workflow_dispatch, run 40279674222) on 15fafe0: success.
  • Windows Free Tests CI (workflow_dispatch, run 40279677455) on 15fafe0: success.
  • bun run eval:bg:pr paid cases on the pushed tree: browse basic commands, browse snapshot flags, diagram triplet, and the setup-browser-cookies and browse reference judges all PASS.
  • QA through the real CLI (Linux): 10 captures pass, including no-leak probes for a DOMAIN\user login.
  • bun run typecheck clean; bun run typecheck:test ratchet unchanged; module-size and cookie-workflow-judge-input tests pass.

🤖 Generated with Claude Code

…:// so proxy env vars never win silently (#3440 item 8)

BROWSE_PROXY_URL=direct only stopped gstack from configuring a proxy; the daemon
inherits the environment and the launch passed no proxy switch, so Chromium read
HTTPS_PROXY/HTTP_PROXY/ALL_PROXY itself and every goto still went through that
proxy while browse reported a direct connection. Every launch path now adds
--proxy-server=direct:// when no proxy is configured (chrome-headless-shell
ignores --no-proxy-server), the daemon logs the effective proxy mode on launch,
and BROWSER.md's proxy section says what Chromium actually gets.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 3 commits October 26, 2026 02:36
Name the direct-connection switch once (DIRECT_PROXY_ARG in proxy-config.ts) so the
launch argument and the daemon log line cannot drift apart.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…roxy; review fixes

Red team (ship Step 9.2): the first cut passed --proxy-server=direct:// on every
platform, but Chromium reads HTTPS_PROXY/HTTP_PROXY/ALL_PROXY itself only on
Linux. On macOS and Windows it follows the system proxy settings (PAC/WPAD),
which GStack Browser.app users behind a corporate proxy depend on, and
BROWSE_PROXY_URL cannot name a PAC. forcesDirect(env, platform) now gates the
switch: Linux always, elsewhere only with BROWSE_PROXY_URL=direct. The daemon
log says what is really ignored per platform, or that the system settings
apply.

Review pass 2: the CLI e2e asserts on the daemon-log slice its own invocation
wrote (the log is append-mode and shared across cases); connectProxy moves to
browse/test/helpers/connect-proxy.ts for both e2e files; the CHANGELOG Tests
bullets cover the generated cases. Adds the coverage-audit cases
(unparseable HTTPS_PROXY; extension, headed and handoff paths under Xvfb).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nd line per platform (#3440 item 8)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
garrytan and others added 5 commits October 26, 2026 03:21
Ship review pass 3 (red team, GStack Minder's decision B, 2026-10-26): on macOS
and Windows an explicit BROWSE_PROXY_URL=direct is the only thing that makes the
daemon bypass the system proxy settings, so explicitDirect() puts it in the
daemon config hash, server.ts records it as proxyDirect in the state file, and
buildRestartEnv re-emits it on a crash auto-restart. A reused daemon started on
the system proxy is now refused (the refusal names BROWSE_PROXY_URL and offers
browse stop or unsetting it) instead of silently keeping the system proxy while
the CLI reports direct. Linux hashes as before. BROWSER.md says the daemon log
records the mode each time the daemon starts, not on every launch. The Linux
desktop (GNOME/KDE) system-proxy question is filed as #3450.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…t-out; headed env and BROWSER.md contract checks (#3440 item 8)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Ship rerun review pass: proxy-direct-launch-args.test.ts joins the macOS
named-regressions job so its omission arm (no switch without the opt-out) runs
in CI; serverProxyEnv takes the platform so the state-file predicate is pinned
per platform instead of mirroring process.platform; buildHeadedServerEnv's
parameter type requires explicitDirect so a narrowed caller cannot drop the
opt-out silently; BROWSER.md's precedence item 6 and the reuse sentence say
what each platform does (a connect daemon gets the generic flags refusal);
CHANGELOG notes the one-time refusal against a pre-release daemon.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Ship adversarial pass: a crash restart re-emits BROWSE_PROXY_URL=direct from the
daemon state only when the invocation has no flags, so the env it hands the new
daemon never contradicts the config hash it also hands over; an explicit-direct
session is refused against a daemon with no recorded config hash, like --proxy
and --headed already were; the unparseable-variable hint says that the opt-out
also bypasses the system proxy settings on macOS and Windows; BROWSER.md notes
that a managed Chromium proxy policy still overrides the switch; CHANGELOG names
both files that joined the macOS named-regressions job.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
garrytan and others added 9 commits October 26, 2026 05:17
…cit direct launch keeps those sessions proxied (#3440 item 8)

A standard proxy variable without a scheme (curl-style host:port or
user:pass@host:port) was rejected by browse's parser with a "connects
directly" warning while Chromium on Linux read the variable itself, so the
session was proxied anyway. With the launch now explicit
(--proxy-server=direct://) that environment went genuinely direct. resolveProxy
now reads such values as http://, the way curl and Chromium's own environment
reader take them; --proxy and BROWSE_PROXY_URL still require the scheme, and a
value that does not parse even as http:// still warns and connects directly.

Also drops buildRestartEnv's persisted-state re-emit branch, which production
never reached (_globalFlags is set before any restart), names the four
BrowserManager launch sites in the CHANGELOG and excludes the cookie-import
worker, and carries the docs audit's one-line BROWSER.md project-tree note.

Decision: GStack Minder (2026-10-26), option A.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The lenient scheme-less proxy read is now gated on the plain
[user:pass@]host[:port] shape (SCHEMELESS_PROXY_RE, trimmed): a scheme'd value
with surrounding whitespace, a one-slash typo and a bare number keep the
behaviour they had, and a credential that would spill past the userinfo
(?, #, /) is not rewritten, so nothing can land outside the redacted part.
Credentials that are not valid percent-encoding are a ProxyConfigError for
every source instead of a URIError crash. buildRestartEnv's docblock, BROWSER.md
and the CHANGELOG describe the parse (port 80 default, macOS/Windows now treat
such a value as a configured proxy).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A backslash is excluded from the scheme-less proxy shape and parseProxyConfig
refuses any proxy URL with a path, query or fragment, for every source: WHATWG
parsing ends an http authority at a backslash, so a DOMAIN\user login or a /
in a password landed in the path, which the redactor does not mask, and was
printed in the clear on the start line, in the daemon log and in the state
file. Such values now warn (standard variables) or error (--proxy,
BROWSE_PROXY_URL) without echoing the credential. Docs updated.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… and tighten the proxy docs

A standard proxy variable whose userinfo opens with a known scheme
(https:bob:pw@host:3128, which the URL parser reads as https://) is no
longer taken as scheme-less credentials, so the protocol it names is kept.
parseProxyConfig refuses a literal ? or # anywhere in the value, not only
a non-empty query or fragment. The unparseable-variable test now puts the
credential in every looped value, so its no-echo assertion is real; new
cases pin the slash-less scheme spelling, the bare ?/#, an env-sourced
trailing slash, and that mixed credential sources stay a hard error for
the scheme-less spelling as for the http:// one (the cred-mixing refusal
predates this branch and its test on main pins it, so it is documented
rather than softened).

CHANGELOG and BROWSER.md: single backslashes inside code spans, "a path
other than a bare /", the socks5 bridge log lines in the effective-mode
list, and the character list applies anywhere in the value.

Decision: GStack Minder (2026-10-26), option B.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…o the pregate secret scan stays clean

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…set does not take process.platform

proxyMismatchLines defaulted to process.platform in the env-proxy-meets-direct-daemon case, so on the windows-free-tests lane the remedy read 'or unset HTTPS_PROXY' and the assertion failed. The case now passes 'linux' explicitly and pins the darwin/win32 remedy beside it. Test only; source unchanged since 1f6c85a.

Decision: GStack Minder (2026-10-26), option A.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nostic; say what the parser does with it

The CHANGELOG sentence and the SCHEMELESS_PROXY_RE docblock claimed a one-slash scheme 'keeps its diagnostic'; the URL parser has always read it as http://host:3128/ and browse/test/proxy-env.test.ts:83 pins that. Wording only, found by the Step 14.5 docs audit on 1f6c85a.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ntial-free-path narrowing and the new scheme-less cred-mix refusal

BROWSER.md said to percent-encode / \ ? # @ in http(s) credentials; ? and # are refused for every scheme, @ needs no encoding, and only the backslash is http(s)-specific. The CHANGELOG now states the narrowing that a credential-free standard-variable value with a path (http://proxy.corp:3128/pac) used to be read with the path dropped and now warns and goes direct, and that the cred-mix refusal is new for the scheme-less spelling. Wording only.

Decision: GStack Minder (2026-10-26), option A.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…st:port is newly proxied

Chromium's proxy spec parser (net/base/proxy_string_util.cc, ProxySchemeHostAndPortToProxyServer) returns an invalid server for any userinfo, so a scheme-less user:pass@host:port in HTTPS_PROXY was never honoured by Chromium on Linux and went direct; reading it as http:// follows curl and is new behaviour. BROWSER.md, the CHANGELOG, the resolveProxy docblock and the Linux e2e test comment now say so, and the scheme-less spill test is named for what it proves (those values never reach the path refusal; the http:// cases in the next test do). Wording only.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
….248.0 (#3448)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title fix(browse): direct mode launches Chromium with --proxy-server=direct:// so proxy env vars never win silently (#3440 item 8) v1.91.248.0 fix(browse): direct mode launches Chromium with --proxy-server=direct:// so proxy env vars never win silently (#3440 item 8) Oct 26, 2026
@capy-ai
capy-ai Bot merged commit 5755601 into main Oct 26, 2026
62 checks passed
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