fix(linux-sandbox): mask fragile bwrap carveout paths

Co-authored-by: Codex noreply@openai.com
This commit is contained in:
viyatb-oai
2026-04-13 22:41:34 -07:00
parent 4179952552
commit badb1beb36

View File

@@ -543,6 +543,10 @@ fn append_read_only_subpath_args(
}
if is_within_allowed_write_paths(subpath, allowed_write_paths) {
if fs::canonicalize(subpath).is_err() {
append_bwrap_mount_point_read_only_bind_args(args, cleanup_mount_points, subpath);
return;
}
args.push("--ro-bind".to_string());
args.push(path_to_string(subpath));
args.push(path_to_string(subpath));
@@ -1156,9 +1160,10 @@ mod tests {
]);
let args = create_filesystem_args(&policy, temp_dir.path()).expect("filesystem args");
assert_eq!(
args.cleanup_mount_points,
vec![first_missing_component.clone()]
assert!(
args.cleanup_mount_points.contains(&first_missing_component),
"missing protected subtree should be registered for cleanup: {:#?}",
args.cleanup_mount_points
);
let first_missing_component = path_to_string(&first_missing_component);
let protected_path = path_to_string(&protected_path);