Isolate IPC in Bubblewrap sandboxes (#39586)

## What changed

- Pass `--unshare-ipc` when building Bubblewrap arguments for both restricted-filesystem and full-filesystem sandbox paths.
- Update the Bubblewrap argument tests to cover the new namespace flag.

GitOrigin-RevId: 61fb1d5150d09626a3b6ee7a9c6a508108c52e80
This commit is contained in:
Jeremy Rose
2026-08-19 18:06:17 +00:00
committed by copyberry
parent 6141747444
commit 3bebaea8f2
2 changed files with 4 additions and 0 deletions

View File

@@ -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(),

View File

@@ -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(),