anthropics / anthropics/sandbox-runtime

Document that --proc /proc requires permissive seccomp profile in containers, even with CAP_SYS_ADMIN

Open
#214 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.2k
Forks
439
Avg merge
2d 9m
Merged PRs (30d)
13

Description

## Problem

When running inside Docker/Kubernetes containers, bubblewrap's `--proc /proc` flag fails with `"Can't mount proc on /newroot/proc: Operation not permitted"` even when the container has `CAP_SYS_ADMIN`. This is because the default container seccomp profile blocks mounting `procfs` inside a new PID namespace.

The `enableWeakerNestedSandbox` option correctly handles this by skipping `--proc`, but the relationship between `CAP_SYS_ADMIN`, seccomp profiles, and `/proc` mounting is not documented.

## Details

Testing inside a Kubernetes pod with `CAP_SYS_ADMIN`:

```bash
# Works - basic bwrap without PID namespace
bwrap --ro-bind / / --dev /dev --proc /proc -- echo "ok"

# Works - PID namespace without /proc
bwrap --unshare-pid --ro-bind / / --dev /dev -- echo "ok"

# Fails - PID namespace with /proc mount
bwrap --unshare-pid --ro-bind / / --dev /dev --proc /proc -- echo "fail"
# bwrap: Can't mount proc on /newroot/proc: Operation not permitted
```

The issue is that mounting a new `/proc` inside a PID namespace requires either:
- `--privileged` (disables seccomp entirely)
- A custom seccomp profile that allows `mount` of `procfs`

`CAP_SYS_ADMIN` alone is not sufficient because the default seccomp profile independently blocks this syscall pattern.

## Suggestion

Add a section to the README or docs explaining the container deployment requirements:

| Sandbox feature | Requires |
|---|---|
| User namespaces (`CLONE_NEWUSER`) | `CAP_SYS_ADMIN` or host sysctl `kernel.unprivileged_userns_clone=1` |
| PID/net/mount namespaces | `CAP_SYS_ADMIN` |
| `/proc` mounting in PID namespace | Permissive seccomp profile OR use `enableWeakerNestedSandbox` |

Also clarify that `enableWeakerNestedSandbox` is the recommended approach for standard Docker/K8s containers (which use the default seccomp profile), and that it still provides filesystem + network isolation via namespace separation.

## Environment

- sandbox-runtime: 0.0.49
- Linux (EKS, kernel 6.12)
- Container with `CAP_SYS_ADMIN`, default seccomp profile

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.