Repository navigation
Conversation
Headless Chromium can't start in the macOS agent sandbox. Every Chromium process checks in `org.chromium.Chromium.MachPortRendezvousServer.<pid>` at startup, and the agent profile grants no `mach-register` at all, so Playwright's chrome-headless-shell aborts with `bootstrap_check_in ... Permission denied (1100)`. It also can't read the DNS config, because the SystemConfiguration services aren't in the lookup allowlist. Kits could only add paths and env, so this adds typed Mach grants to them: `Expanded::mach_lookup`/`mach_register` hold `sandbox::MachName` values (an exact `global-name` or an anchored `global-name-regex`). `run_agent` copies them onto `AgentPolicy`, and `generate_agent_profile` emits them after the harness profile rules and before the final denies. The builder refuses a name with a control character, a quote, or a backslash in a plain name. Only built-in kits produce them: no `[kits.<name>]` field can, because a Mach service leads out of the sandbox into whatever process serves it. Landlock ignores them. `airlock config` lists them next to a kit's paths. The `playwright` kit reads `PLAYWRIGHT_BROWSERS_PATH`, or the platform cache, and on macOS grants register and lookup on the rendezvous regex plus lookup on `com.apple.SystemConfiguration.configd` and `.DNSConfiguration`. It doesn't grant `com.apple.sysmond`, which would let the agent list every process the user runs. Shared mode makes the browser cache writable so `playwright install` works. That breaks the rule every other kit keeps of never writing executables that run outside the sandbox, so SECURITY.md documents it as an explicit opt-in. Not checked end to end: this was written inside an Airlock agent sandbox, which refuses both a nested `sandbox-exec` and the cargo registry, so the unit tests and a real Chromium launch under the generated profile still need a run outside it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a built-in
playwrightkit so headless Chromium (Playwright'schrome-headless-shell) can start inside the macOS agent sandbox. Today it aborts at launch:There is also a non-fatal
Failed to read DnsConfig.Typed Mach grants for built-in kits
sandbox::MachName { Global(String), Regex(String) }becomes(global-name "…")/(global-name-regex #"…").kits::ExpandedandAgentPolicygetmach_lookup/mach_register.run_agentcopies them across next to the kit paths.generate_agent_profileemits them after the harness profile rules and before the final denies. A name with a control character, a", or a\(plain names only) is refused withSandboxError::InvalidMachName.RawKitConfigis unchanged, so no user config can add a Mach name. Linux/Landlock ignores them.airlock configlists a kit's Mach names next to its paths.playwrightkitPLAYWRIGHT_BROWSERS_PATHif set, otherwise~/Library/Caches/ms-playwright(macOS) or~/.cache/ms-playwright(Linux). Grants nothing when it is0, because the browsers are then innode_modules.mach-registerandmach-lookupon^org\.chromium\.Chromium\.MachPortRendezvousServer\.[0-9]+$;mach-lookuponcom.apple.SystemConfiguration.configdandcom.apple.SystemConfiguration.DNSConfiguration.com.apple.sysmondis not granted (it would list every user process).playwright installworks.Review needed: shared mode writes executables
Every other kit refuses to write executables that run outside the sandbox. The mise kit, for example, refuses
mise install. Sharedplaywrightbreaks that rule. The cache holds the browser builds that the user's own Playwright runs, and any unsandboxed Playwright MCP server, launch outside the sandbox. SECURITY.md documents this as an explicit, opt-in exception, and the docs recommend isolated mode. The alternative is to have shared mode match isolated, so no mode writes the cache. Please decide.Docs
README (Kits), SECURITY (Kits + new "Kit Mach services"), SKILL, ARCHITECTURE (Kits), docs/airlock-v2-design.md (kit table + Mach paragraph), config templates.
Tests
kits.rs: playwright expansion in both modes and on both platforms, thePLAYWRIGHT_BROWSERS_PATHoverride and0, Mach names on macOS only, and no other built-in granting Mach names. The hard-coded known-kit list is updated.sandbox.rs(macOS): nomach-register/regex/SystemConfiguration without a kit, under every profile kind. Exact register/lookup blocks are checked, and they come after the Claude profile rules. Injection attempts are refused. The b7 final-denies test now includes kit Mach names.Not verified locally
I wrote this inside an Airlock agent sandbox. It refused:
cargo build/cargo test:~/.cargo→Operation not permitted;nix build:/nix/var/nix/daemon-socket/socket→Operation not permitted;sandbox-exec:sandbox_apply: Operation not permitted.So nothing has been compiled or tested locally yet. Only
cargo fmt --checkran. CI is the first compile.A real Chromium launch under the generated profile is also unverified. To check it from a normal terminal:
If Chromium then fails on another Mach name,
log stream --predicate 'sender == "Sandbox"'shows which one.🤖 Generated with Claude Code