Headless browser sandbox: what the Playwright debate means

A viral claim about Playwright, Chromium and a disabled sandbox put headless browser security back in focus. Here is what is true, and how to check your scrapers and AI browser agents.

Puppetflow Team8 min read
A padlock over digital code, illustrating headless browser sandbox security

You run scrapers, login flows or AI agents that open pages you do not control. Early November, a viral post claimed that the Playwright browser those scripts launch ships an outdated Chromium and runs with its sandbox off. The claim was partly right, partly a misunderstanding, and it raised a question every team running a headless browser sandbox should answer: is the sandbox actually on in your setup?

This article breaks down what happened, what the real risk is, and what to check on your own automations, whether you use Playwright, Puppeteer or Puppetflow.

What happened with the Playwright sandbox debate

On November 2, a developer posted a warning on X telling people who run AI coding agents on their laptops without containers to remove Playwright. The post, published by nisten, made two claims. First, that Playwright 1.64.1 ships a Chromium 156 build that predates a late October Chrome security fix tied to several CVEs. Second, that the Playwright sandbox is off by default.

The Playwright team replied on X the same week. Their position is that no Playwright package bundles a browser in the sense of a permanent copy. Agents running through Playwright MCP or the Playwright CLI use your stable Chrome, which receives its normal security updates, with the sandbox on.

A verification repository published by a third party tested the library path. Its finding is that a default chromium.launch() call passes --no-sandbox and uses the pinned build. It also notes that enabling the sandbox fails on stock Ubuntu 24.04 runners, because the Chromium sandbox needs unprivileged user namespaces, which that distribution restricts through AppArmor.

So both sides have a point. The details depend on how you launch the browser.

The headless browser sandbox in plain terms

Chromium runs web pages in renderer processes. The sandbox is the layer that limits what a compromised renderer can do to the rest of the machine. Without it, a browser exploit triggered by a malicious page can reach your files and credentials.

For a test suite that only visits your own staging site, this matters little. For scrapers, price monitors, agent scripts and anything that follows links on the open web, it matters a lot.

The TestMu AI breakdown summarizes how Playwright behaves depending on how you use it:

How you use Playwright Default browser Sandbox by default Gets Chrome security fixes
Playwright MCP or CLI Your installed Chrome On With your normal Chrome updates
Library API, chromium.launch() Pinned Chrome for Testing Off When you upgrade Playwright
Playwright Docker image Browser from the image Off When you update the image

The same article quotes Playwright's own documentation: "Never use Playwright or Playwright MCP to browse untrusted web content." The sandbox protects your machine from the page. It does not protect your agent from instructions hidden in the page, which is a separate problem.

The one line fix for Playwright scripts

If you use the library API on pages you do not control, the recommended hardening is to use installed Chrome and turn the sandbox on explicitly:

import { chromium } from 'playwright';

const browser = await chromium.launch({
  channel: 'chrome',      // installed Google Chrome, patched by its own updater
  chromiumSandbox: true,  // do not pass --no-sandbox
});

Two caveats come with it. Keep Chrome itself updated, since some bugs can escape a sandbox. And expect a launch failure in some containers and CI runners until the host allows the namespaces Chromium needs.

Puppeteer and Docker: the same trap, a different default

This is not a Playwright only story. Anyone who has put Puppeteer in a container has met the sandbox error. Chrome refuses to start as root without --no-sandbox, and the usual fix on the internet is to add that flag and move on.

The Browserless guide to running Puppeteer in Docker describes the better path. Give the image a non-root user, and grant the container permission to create user namespaces, either with --cap-add=SYS_ADMIN or a custom seccomp profile. Without that permission Chrome exits with a "No usable sandbox" error.

Copy pasted --no-sandbox flags are the real exposure here. They quietly turn a safety layer off in a container that often also holds API keys and session cookies.

A practical checklist for scrapers and AI browser agents

Whatever tool you use, run through these points:

  1. Find out how your browser is launched. Search your code and Dockerfiles for --no-sandbox and chromiumSandbox.
  2. Run as a non-root user. A root container is the most common reason people disable the sandbox.
  3. Update the browser, not just the library. A pinned browser only changes when you upgrade the tool that pins it.
  4. Isolate the host. Use a VM or a dedicated container, with no mounted home folder and no personal credentials.
  5. Use throwaway profiles. Do not reuse the browser profile you log into your own accounts with.
  6. Limit what each automation can reach. An agent that only needs one site does not need every secret.
  7. Keep a human on risky steps. Payments, deletions and account changes deserve an approval.

Where Puppetflow fits

Puppetflow is a self-hosted and cloud browser automation platform. Flows run JavaScript in a sandboxed Puppeteer environment, and you can build them visually or in code. The documentation covers both modes. None of the tool choices can replace the checklist above, but several features make it easier to apply.

Self-hosted means you control the isolation

On a self-hosted instance, the host, the container user and the network rules are yours. You can run Puppetflow on a dedicated machine or VM that holds nothing else, which covers the isolation and credential points on the checklist. The self-hosting guide in the repository explains installation and updates.

Check your own deployment against the list too. Look at which user the containers run as and how Chrome is launched, and update when new images ship.

Keep credentials scoped to the flows that need them

A flow that logs into one service does not need access to ten others. Splitting automations into small flows, each with its own login steps, keeps the blast radius small. The LinkedIn posting tutorial shows a login that handles two factor codes inside a single focused flow.

Add a human in the loop on sensitive steps

When a flow reaches an action you would not want a script to take alone, you can pause it and wait for a person. This is useful for payments, deletions and account changes, and it limits the damage if an automated page visit goes wrong. The Lotto flow tutorial uses this pattern for a captcha.

Recordings, triggers and data tables give you an audit trail

Runs can be recorded, so you can review what the browser actually did. Cron and webhook triggers start flows on a schedule or from an event, and data tables store results in one place instead of scattered files. If a flow behaves strangely, you have something concrete to inspect.

Agents that use MCP

Every Puppetflow instance can expose a remote MCP server, so clients like Claude, Cursor or Cline can search, inspect, create and run flows. The browser does not run on the agent's machine. It runs on your Puppetflow instance, and you control access with a token. The MCP guide lists the available tools. That separation matches the advice from the debate: keep the agent away from your laptop, and keep the browser in a place you chose.

This does not make agents safe from malicious page content. Treat anything a page says as data, scope the token, and keep approvals on actions that matter.

What to do this week

Open your most exposed automation, the one that visits pages you do not control. Check three things: how the browser launches, which user it runs as, and which credentials sit next to it. If you find --no-sandbox in a Dockerfile, fix the cause instead of keeping the flag.

If you are building new automations, consider starting from a setup where isolation is designed in. You can try Puppetflow in the cloud or on your own server, and pair it with the checklist above.