mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Ignore symbolic slash-tmp permissions on Windows (#36237)
## Why The `:slash_tmp` filesystem entry represents the Unix `/tmp` directory and should not affect Windows sandbox policy decisions. ## What changed - Ignore symbolic `SlashTmp` entries when resolving Windows filesystem access, converting permission profiles, and intersecting requested permissions. - Continue treating a literal `/tmp` entry as a regular filesystem path. ## Testing Add Windows-specific coverage for policy conversion, access checks, and permission-profile intersection. GitOrigin-RevId: f4cdd37ea41abc9debfe8a0d3a456b70da5e534c
This commit is contained in:
1 parent
3016671bb0
commit
413492cd6c
3 files changed
+145
-10
No files matched your search
@@ -294,6 +294,41 @@ fn intersect_permission_profiles_drops_explicit_empty_reads_without_grant() {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn intersect_permission_profiles_rejects_symbolic_slash_tmp_grants() {
|
||||
let cwd = TempDir::new().expect("tempdir");
|
||||
let slash_tmp = AbsolutePathBuf::from_absolute_path("/tmp").expect("absolute tmp path");
|
||||
let requested = PermissionProfile {
|
||||
file_system: Some(FileSystemPermissions::from_read_write_roots(
|
||||
/*read*/ None,
|
||||
Some(vec![slash_tmp]),
|
||||
)),
|
||||
..Default::default()
|
||||
};
|
||||
let granted = PermissionProfile {
|
||||
file_system: Some(FileSystemPermissions {
|
||||
entries: vec![FileSystemSandboxEntry::new(
|
||||
FileSystemPath::Special {
|
||||
value: FileSystemSpecialPath::SlashTmp,
|
||||
},
|
||||
FileSystemAccessMode::Write,
|
||||
)],
|
||||
glob_scan_max_depth: None,
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
intersect_permission_profiles(requested, granted.clone(), cwd.path()),
|
||||
PermissionProfile::default()
|
||||
);
|
||||
assert_eq!(
|
||||
intersect_permission_profiles(granted.clone(), granted, cwd.path()),
|
||||
PermissionProfile::default()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn intersect_permission_profiles_accepts_child_path_granted_for_requested_cwd() {
|
||||
let temp_dir = TempDir::new().expect("create temp dir");
|
||||
|
||||
Reference in new issue
Block a user