Sandbox each run's agents with bubblewrap: research, then build #203
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #201. A first layer is deployed (
c1228b4,agent-shells-see-only-their-run): agent shells get an environment from an allowlist, and a path guard refuses other runs' folders, osfd's secrets and/proc/*/environ. A text guard can be bypassed by a model that computes a path at run time (command substitution, an interpreter script, a symlink), so it is not the fix. The fix is that an agent's processes cannot reach what isn't theirs.A draft proposal exists, not approved:
openspec/changes/agents-reach-only-their-run/on main (proposal, design, specs, tasks, andprobes/run.sh, which re-runs its measurements on any Docker host). It recommends one bubblewrap sandbox per run:opencode serveand every project command inside it;osfdservice: a seccomp profile (Docker's default plus the namespace calls),systempaths=unconfinedandno-new-privileges, no added capabilities;It rejects a separate uid (fences by file mode only, leaves the network open), Landlock (missing on the local kernel; no network rules on the VM's) and a container per run (needs the Docker socket).
Tested so far, on Docker Desktop on a Mac only:
unshare -Urfails;systempaths=unconfined, the full sandbox works: other runs,keys/and the token file do not exist inside it, and osfd's API is unreachable;Research needed before building (the operator's call, 2026-10-18):
docker composeservices if a run uses them, npm/uv with the shared caches (#67), git hooks.Shipped in cmoriarty/braid#490 (main
799b2f05, on production since 2026-11-11 22:43 UTC), archived in cmoriarty/braid#491 asagents-reach-only-their-run. The capability isagent-sandbox.What changed
opencode servestarts under a Landlock fence: the run's folder, the image and its own key files, nothing else, and signals only to its own processes. The file tools run inside it.localhost, its own/tmp, its worktree and the run's shared folders. Steps side by side each have one.SHELLis a client that hands it to a spawner inside. So do the Playwright server, theapptool, installs, lanes, apply's suites, services and a project's own scripted steps.OSF_EGRESS_ALLOW. The guard refuses awebfetchto the same.OSF_SANDBOX=stepfails closed: a probe at start, and no run starts while it fails.Evidence
agent-leaves-its-stepreaches for the run's folder, the state volume, the forge token, the server's process and osfd's port by computed paths, finds none, and merges. Inparallel-groupseach group had its own sandbox with its own Playwright server, app and shells.OSF_SANDBOX=stepunder the stack's options: the fence line, five sandbox lines and six simulated runs with a real opencode. The deploy ran it again (deploy 487).osfd doctor0 failed, 0 warned;/api/statuslists no problem; the log says "the sandbox works (OSF_SANDBOX=step)".Not in it, each filed: model keys behind a gate (#492); osfd's own git in a worktree, and the forge token's split (#493); the allowlist in the console, with approved skills, plugins and MCP servers (#494); integrity of the shared caches (#495); CPU and memory limits per step (#496).
The first full run on it is the standard run of braid#489; what it turns up goes on that run's findings issue.