fix(web): launch Chromium with its sandbox on where it can start
Merged
VA
5d ago+388+388+012345678901234567890123456789-21-21-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.
What changed
- A locally launched Chromium runs with its OS sandbox on by default on macOS and Windows.
- On Linux the default stays off. The sandbox needs unprivileged user namespaces there, which root, most containers, and Ubuntu 23.10+ block, so on would fail the launch on most CI hosts.
web({ chromiumSandbox })sets it either way:trueon a Linux host that can sandbox,falseelsewhere.- A sandbox that is on and cannot start fails with an
ENGINE_FAILUREthat names the option, in place of Playwright's launch call log. connect, browser providers, Firefox and WebKit are untouched.
web({ chromiumSandbox: true }); // default: true on macOS and Windows, false on Linux
packages/web/src/browser-connection.ts:defaultChromiumSandbox(), andacquiretakes an options object.- Docs:
docs/reference/web.mdx,docs/security.mdx(plusjaandzh),SECURITY.md, the skill'ssetup.md.
Verified
Ran it locally: yes
- testbed,
e2e run tests/todos.e2e.tson macOS, watching the Chromium the CLI spawned:
| main | this branch |
|---|---|
browser process carries --no-sandbox | default: no --no-sandbox, renderers start with --seatbelt-client; 7 passed |
| no option to change it | web({ chromiumSandbox: false }): --no-sandbox is back; 7 passed |
- Web integration suite on macOS, now sandboxed by default: 484 passed, 1 skipped.
- Not run:
chromiumSandbox: trueon a Linux host that allows user namespaces. Linux CI runs the default, which is the same launch as main.