Stop --chdir from binding the working directory read-write
This commit is contained in:
@@ -6,7 +6,7 @@ Sandbox agentic coding assistants with [bubblewrap](https://github.com/container
|
||||
|
||||
### Whitelist
|
||||
|
||||
Tight sandbox for normal agent coding tasks. Only explicitly listed paths are visible — system binaries, libraries, a subset of `/etc`, `/sys` (all read-only), synthetic `/dev`, private `/proc`, `/tmp`, `/run`, and the working directory (read-write). Everything else is invisible. Whitelist always runs with hardening on (see below).
|
||||
Tight sandbox for normal agent coding tasks. Only explicitly listed paths are visible — system binaries, libraries, a subset of `/etc`, `/sys` (all read-only), synthetic `/dev`, private `/proc`, `/tmp` and `/run`. Everything else is invisible, including the working directory: bind it with `--rw .` (or `rw = ["$PWD"]` in the config). Whitelist always runs with hardening on (see below).
|
||||
|
||||
### Blacklist
|
||||
|
||||
@@ -82,6 +82,10 @@ Every sandbox contains a read-only `/run/agent-sandbox/bwrap-args` holding the e
|
||||
|
||||
A user `--rw`/`--ro` targeting `/run/agent-sandbox` overrides the directory, like any other built-in path.
|
||||
|
||||
## Working directory
|
||||
|
||||
The sandbox starts in the directory agent-sandbox was launched from, or in `--chdir PATH` (`chdir` in the config). Neither makes that directory visible or writable; only `--ro` and `--rw` do. If nothing binds it, bwrap refuses to start with `Can't chdir to PATH: No such file or directory`.
|
||||
|
||||
## Escape hatches
|
||||
|
||||
When the agent needs access to something the sandbox blocks, use `--rw` or `--ro` for paths and `--setenv`/`--unsetenv` for env vars. User overrides always win over the built-in policies.
|
||||
|
||||
Reference in New Issue
Block a user