Compare commits

...

1 Commits

Author SHA1 Message Date
David Wiesen
058916a2a9 Avoid WindowsApps ACL refresh roots 2026-04-15 10:09:31 -07:00

View File

@@ -345,6 +345,7 @@ fn gather_helper_read_roots(codex_home: &Path) -> Vec<PathBuf> {
let mut roots = Vec::new();
if let Ok(exe) = std::env::current_exe()
&& let Some(dir) = exe.parent()
&& !is_windowsapps_package_dir(dir)
{
roots.push(dir.to_path_buf());
}
@@ -354,6 +355,14 @@ fn gather_helper_read_roots(codex_home: &Path) -> Vec<PathBuf> {
roots
}
fn is_windowsapps_package_dir(path: &Path) -> bool {
let normalized = path
.to_string_lossy()
.replace('/', "\\")
.to_ascii_lowercase();
normalized.contains("\\program files\\windowsapps\\")
}
fn gather_legacy_full_read_roots(
command_cwd: &Path,
policy: &SandboxPolicy,
@@ -1060,6 +1069,16 @@ mod tests {
assert!(roots.contains(&expected));
}
#[test]
fn windowsapps_package_dirs_are_detected() {
assert!(is_windowsapps_package_dir(Path::new(
r"C:\Program Files\WindowsApps\OpenAI.Codex_26.409.7971.0_x64__2p2nqsd0c76g0\app\resources"
)));
assert!(!is_windowsapps_package_dir(Path::new(
r"C:\Users\alice\.codex\.sandbox\bin"
)));
}
#[test]
fn restricted_read_roots_skip_platform_defaults_when_disabled() {
let tmp = TempDir::new().expect("tempdir");