Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Isolate IPC in Bubblewrap sandboxes (#39586)

Jeremy Rose3bebaea8f209
diff --git a/codex-rs/linux-sandbox/src/bwrap.rs b/codex-rs/linux-sandbox/src/bwrap.rs
index f809c5a461..ff46583762 100644
--- a/codex-rs/linux-sandbox/src/bwrap.rs
+++ b/codex-rs/linux-sandbox/src/bwrap.rs
@@ -282,6 +282,7 @@ fn create_bwrap_flags_full_filesystem(command: Vec<String>, options: BwrapOption
// not need ambient CAP_SYS_ADMIN to create the remaining namespaces.
"--unshare-user".to_string(),
"--unshare-pid".to_string(),
+ "--unshare-ipc".to_string(),
];
if options.network_mode.should_unshare_network() {
args.push("--unshare-net".to_string());
@@ -331,6 +332,7 @@ fn create_bwrap_flags(
// auto-enable behavior, which is skipped when the caller runs as uid 0.
args.push("--unshare-user".to_string());
args.push("--unshare-pid".to_string());
+ args.push("--unshare-ipc".to_string());
if options.network_mode.should_unshare_network() {
args.push("--unshare-net".to_string());
}
@@ -1422,6 +1424,7 @@ mod tests {
"/dev/shm".to_string(),
"--unshare-user".to_string(),
"--unshare-pid".to_string(),
+ "--unshare-ipc".to_string(),
"--unshare-net".to_string(),
"--proc".to_string(),
"/proc".to_string(),
diff --git a/codex-rs/linux-sandbox/src/linux_run_main_tests.rs b/codex-rs/linux-sandbox/src/linux_run_main_tests.rs
index cf0660ff34..c38b51ae79 100644
--- a/codex-rs/linux-sandbox/src/linux_run_main_tests.rs
+++ b/codex-rs/linux-sandbox/src/linux_run_main_tests.rs
@@ -81,6 +81,7 @@ fn inserts_bwrap_argv0_before_command_separator() {
"/dev".to_string(),
"--unshare-user".to_string(),
"--unshare-pid".to_string(),
+ "--unshare-ipc".to_string(),
"--proc".to_string(),
"/proc".to_string(),
"--cap-drop".to_string(),