mirror of
https://github.com/openai/codex.git
synced 2026-11-28 23:34:06 +00:00
Enforce managed deny-read rules in the Windows sandbox (#38660)
## Why Windows sandbox requests must preserve managed filesystem deny rules across every execution path and setup refresh. Unsupported policies should fail closed instead of allowing a command to run without the requested protection. ## What changed - Resolve Windows filesystem overrides while constructing each sandbox execution request so both `shell_command` and `exec_command` enforce exact-path and glob deny-read entries. - Carry resolved deny-read paths into Windows sandbox setup refreshes, including workspace-relative entries. - Reject unelevated restricted-token requests that cannot enforce deny-read rules. - Reject recursive globs rooted at a filesystem root unless `glob_scan_max_depth` bounds their expansion. ## Testing Added coverage for deny-read enforcement through both command runtimes, setup refresh resolution, restricted-token failure, and bounded root-level glob scans. GitOrigin-RevId: 33dfa4d1a45b14850cbf58f9173717e3e707d9bf
This commit is contained in:
1 parent
5186e2ccc3
commit
848cbad7f4
8 files changed
+486
-47
No files matched your search
@@ -453,11 +453,7 @@ impl<'a> SandboxAttempt<'a> {
|
||||
.iter()
|
||||
.map(PathUri::to_abs_path)
|
||||
.collect::<std::io::Result<Vec<_>>>()?;
|
||||
Ok(crate::sandboxing::ExecRequest::from_sandbox_exec_request(
|
||||
request,
|
||||
options,
|
||||
workspace_roots,
|
||||
))
|
||||
crate::sandboxing::ExecRequest::from_sandbox_exec_request(request, options, workspace_roots)
|
||||
}
|
||||
|
||||
pub fn env_for_exec_server(
|
||||
@@ -487,8 +483,11 @@ impl<'a> SandboxAttempt<'a> {
|
||||
windows_sandbox_private_desktop: self.windows_sandbox_private_desktop,
|
||||
})
|
||||
.map_err(CodexErr::from)?;
|
||||
let mut exec_request =
|
||||
crate::sandboxing::ExecRequest::from_sandbox_exec_request(request, options, Vec::new());
|
||||
let mut exec_request = crate::sandboxing::ExecRequest::from_sandbox_exec_request(
|
||||
request,
|
||||
options,
|
||||
Vec::new(),
|
||||
)?;
|
||||
exec_request.exec_server_managed_network = managed_network;
|
||||
if self.sandbox_requested {
|
||||
exec_request.exec_server_sandbox = Some(FileSystemSandboxContext {
|
||||
|
||||
Reference in new issue
Block a user