feat: add AZKABAN_UNMASK_PROC for nested sandboxes #67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/unmask-proc"
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?
Why
Since #65, Claude Code's sandbox starts in a Linux client container,
but only with
sandbox.enableWeakerNestedSandbox. Podman masks parts ofthe container's
/proc, so the kernel refuses the fresh/procthatthe regular sandbox mounts. The weaker sandbox binds the container's
/procinstead, which lets its commands see every process in thecontainer. The diagnosis of #64 proposed an opt-in control to lift the
masks, and that work left it out. Lifting them by default, as #64
suggested, was set aside: it would expose the masked paths to every
launch of every client.
What changed
AZKABAN_UNMASK_PROC=1in an identity'senvorenv.<client>, or--unmask-procfor a single launch, adds--security-opt unmask=/proc/*to the Podman launch, ahead of the image. Without it, launches stay as
they were. Any value other than 0 or 1 stops the launch before Podman
runs. On macOS,
container runhas no option for this, so the launchgoes on without the unmask and prints one line saying so.
The smoke gate now also runs each image with the unmask. It requires a
bwrapjail that mounts its own/proc, whose PID 1 differs from thecontainer's shell, with a nested user namespace inside it. Nested
sandboxes, Launcher controls, the README's options table and Security
model, and the macOS differences describe the control and what it
exposes.
How to verify
On a Linux host with rootless Podman, from the branch:
ln -s "$PWD/bin/azkaban" /tmp/azk/claude, then run/tmp/azk/claude --unmask-proc --dry-run .. The output shows--security-opt unmask=/proc/\*after--http-proxy=false. Onmaster,
--unmask-proclands after the image, as a Claude argument.--unmask-proc, withsandbox.enabledon and withoutsandbox.enableWeakerNestedSandbox. Have Claude Code runls -d /proc/[0-9]*. It lists only the sandbox's processes, with nosandbox error.
make test-e2epasses and includes the new probe.Verify (
make lint && .agents/hooks/shellcheck.sh repo && make test)passes on the tip: 352 tests, 0 failures. The new and extended
launcher, help, and smoke unit tests all fail on master. macOS is
covered by the stubbed Darwin tests only, since no Mac was at hand.
Considerations
With the unmask on, every process in the container reads the unmasked
paths with the host user's permissions.
/proc/keys, for example,lists the metadata of the host user's kernel keys, though not their
contents. Nothing becomes writable, because host root owns
/proc/sysand its siblings. The README's Security model lists theunmask among the settings to review.