Skip to content

Sandbox Linux

xsyetopz edited this page Oct 19, 2026 · 2 revisions

Sandbox Linux

just sandbox-linux runs one live Claude Code session in a Linux container. It checks that the sandbox blocks a Unix socket in a Bash call. Run it before you change the sandbox keys of the settings snippet. It uses your login and costs money.

What It Checks

The seccomp helper of the native Claude Code build must block a Unix socket in a sandboxed Bash call. The script is tools/sandbox/linux/run.ts, and it runs tools/sandbox/linux/check.sh in the container.

The session uses these settings:

{"sandbox": {"enabled": true, "failIfUnavailable": true,
  "allowUnsandboxedCommands": false, "autoAllowBashIfSandboxed": true}}

The prompt asks Claude to run one socat call to $SSH_AUTH_SOCK. The socket is a fake agent of socat in the container, not the ssh-agent of the host. A control call outside the sandbox must connect.

Verdict Meaning
blocked The control connects and the sandboxed call does not
reached The sandboxed call connects
unknown The control fails or the session gives no result

The recipe exits with 1 for any verdict but blocked.

How It Runs

  1. Build the image from the image of just docker, with bubblewrap and socat added (tools/sandbox/linux/Dockerfile).
  2. Read the login of the host, from the Keychain on macOS or .credentials.json on Linux.
  3. Stop when the access token has less than LINUX_TOKEN_MIN_MINUTES (30) minutes left. A refresh in the container would make the login of the host fail. Run one claude command on the host to refresh it, then run the recipe again.
  4. Run the container with --rm, --privileged (so bwrap can make namespaces), and DOCKER_CPUS CPUs. The login goes in on stdin, and no file of the host gets it.
  5. Print the control result, each Bash command and result, the sandbox lines of stderr, and the verdict.

Cost and Approval

The session uses the model LINUX_SESSION_MODEL (haiku) for one short turn of at most 3 turns. Ask the user before each run. The recipe does not run in just docker, because it needs the login of the host.

See Also

Clone this wiki locally