fix(web): launch Chromium with its sandbox on by default
VA
4d ago+678+678+012345678901234567890123456789-55-55-01234567890123456789
Issue
Fixes #1613.
@e2e-dev/weblaunched Chromium withoutchromiumSandbox, so Playwright added--no-sandboxto every browser process.- The agent can follow the app to another origin, so a renderer exploit on a page it reaches ran unsandboxed as the user running
e2e run, with the checkout,.env, and model keys in reach. - There was no config option to turn the sandbox on.
What changed
- Chromium launches with
chromiumSandbox: trueby default. Firefox and WebKit never receive the option. web({ chromiumSandbox: false })opts out, as doesE2E_CHROMIUM_SANDBOX=0in the run's environment. An explicit option wins over the variable.- The flag resolves from the option, then the run's environment, then on. The process environment never decides a launch, per the
EngineInitInfo.envcontract, so a host that exports the variable in its shell cannot silently turn the sandbox off for an in-process run. BrowserConnection.acquiretakes the resolved flag as a required argument; the two integration tests that launch a browser directly passfalseexplicitly, the way they ran before.- Docs updated next to the no-origin-allowlist note (
docs/reference/web.mdx,docs/security.mdx,SECURITY.md,skills/e2e/references/setup.md), with a.changesetentry (@e2e-dev/web, patch). - CI opts out explicitly (
E2E_CHROMIUM_SANDBOX: '0'inspec.yml,benchmark.yml,agent.yml,examples.yml): the ubuntu-2404 runners restrict unprivileged user namespaces, so a sandboxed launch fails there. Tests that launch a real browser forward the flag into the run's environment instead of reading the process environment. - The smol VM's
--no-sandboxis unchanged: the VM is the boundary there, and the guest browser runs inside it.
Limits
- The sandbox contains the renderer; it does not fix the known Chromium CVEs by itself. Playwright 1.65.0 and Chromium 158 cover those through #1609.
- Test, config, and engine code still run with the runner's full OS authority; nothing here sandboxes them.
- On a host where the sandbox cannot start, leaving it on fails the launch with Playwright's "Chromium sandboxing failed!" error; set
falseorE2E_CHROMIUM_SANDBOX=0there.
Verified
Ran it locally: yes
pnpm check: green (lint, dead-code, typecheck, error codes, peer ranges, changeset bumps, plugins, mcp-server, docs).pnpm --filter @e2e-dev/web exec vitest run --project unit: 354 passed.pnpm --filter @e2e-dev/web exec vitest run --project integrationwithE2E_CHROMIUM_SANDBOX=0: 379 passed, 3 failed, 1 skipped. The 3 failures are the load-sensitiveapp-log,provider-downloads, andsemantic-fallbacktests; each passes in isolation, and all three fail intermittently under parallel load, including on amaincheckout in this environment.- Real CLI on the testbed (
apps/testbed,node node_modules/e2e/dist/cli/bin.js run tests/browser.e2e.ts):- default: 6 failed, every one with "Chromium sandboxing failed!"
E2E_CHROMIUM_SANDBOX=0: 6 passed
pnpm --filter e2e exec vitest run tests/integration/mcp-test-run.test.tswithE2E_CHROMIUM_SANDBOX=0: 13 passed.
| main | this branch |
|---|---|
| testbed browser suite passes: the launch is unsandboxed by default, the same launch the opt-out run exercises (6 passed) | testbed browser suite fails by default (6 failed, "Chromium sandboxing failed!") and passes with the opt-out (6 passed) |
| new sandbox unit tests fail: no such option (6 of 7 failed before the fix) | 13 new tests pass |
web integration suite: same 3 load flakes on a main checkout | same 3 load flakes, no new failures |