Drop capabilities from Linux sandbox processes (#39103)

## What changed

- Pass `--cap-drop ALL` in both bubblewrap launch modes.
- Verify in the inner sandbox stage that the effective and permitted Linux
  capability sets are empty, and abort before executing the command otherwise.
- Cover the generated bubblewrap arguments, capability state of sandboxed
  commands, and rejection of a capability-bearing inner-stage process.

GitOrigin-RevId: 9dbd651d306d92327e36c9b3f308619db7d80a67
This commit is contained in:
Eric Traut authored and copyberry committed 2026-08-17 23:21:28 +00:00
1 parent 2eee483e49
commit 632420e67a
4 files changed
+107

No files matched your search

+6
View File
@@ -290,6 +290,8 @@ fn create_bwrap_flags_full_filesystem(command: Vec<String>, options: BwrapOption
args.push("--proc".to_string());
args.push("/proc".to_string());
}
args.push("--cap-drop".to_string());
args.push("ALL".to_string());
args.push("--".to_string());
args.extend(command);
BwrapArgs {
@@ -345,6 +347,8 @@ fn create_bwrap_flags(
args.push("--chdir".to_string());
args.push(path_to_string(normalized_command_cwd.as_path()));
}
args.push("--cap-drop".to_string());
args.push("ALL".to_string());
args.push("--".to_string());
args.extend(command);
Ok(BwrapArgs {
@@ -1421,6 +1425,8 @@ mod tests {
"--unshare-net".to_string(),
"--proc".to_string(),
"/proc".to_string(),
"--cap-drop".to_string(),
"ALL".to_string(),
"--".to_string(),
"/bin/true".to_string(),
]