mirror of
https://github.com/openai/codex.git
synced 2026-11-27 15:30:27 +00:00
Mount a minimal /dev in full-filesystem Bubblewrap sandboxes (#37349)
## Why Binding the full host filesystem into a network-isolated Bubblewrap sandbox also inherits the host's device tree. ## What changed - Overlay `/dev` with Bubblewrap's minimal device filesystem while preserving the root bind's `nodev` behavior. - Bind `/dev/shm` back into the sandbox when available so host and sandbox processes can continue to share memory files. ## Testing Add a managed-proxy integration test that verifies standard device nodes remain usable, `/dev` is not the host directory, and `/dev/shm` writes are shared with the host. GitOrigin-RevId: 1d91fe44affd792d2777adae8f2cce6d85d14103
This commit is contained in:
1 parent
4bb7ee3472
commit
912524d6fe
2 files changed
+90
No files matched your search
@@ -271,6 +271,13 @@ fn create_bwrap_flags_full_filesystem(command: Vec<String>, options: BwrapOption
|
||||
"--bind".to_string(),
|
||||
"/".to_string(),
|
||||
"/".to_string(),
|
||||
// Preserve nodev on the root bind while exposing only standard devices.
|
||||
"--dev".to_string(),
|
||||
"/dev".to_string(),
|
||||
// Restore shared memory without exposing other host devices.
|
||||
"--bind-try".to_string(),
|
||||
"/dev/shm".to_string(),
|
||||
"/dev/shm".to_string(),
|
||||
// Always enter a fresh user namespace so root inside a container does
|
||||
// not need ambient CAP_SYS_ADMIN to create the remaining namespaces.
|
||||
"--unshare-user".to_string(),
|
||||
@@ -1401,6 +1408,11 @@ mod tests {
|
||||
"--bind".to_string(),
|
||||
"/".to_string(),
|
||||
"/".to_string(),
|
||||
"--dev".to_string(),
|
||||
"/dev".to_string(),
|
||||
"--bind-try".to_string(),
|
||||
"/dev/shm".to_string(),
|
||||
"/dev/shm".to_string(),
|
||||
"--unshare-user".to_string(),
|
||||
"--unshare-pid".to_string(),
|
||||
"--unshare-net".to_string(),
|
||||
|
||||
Reference in new issue
Block a user