mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve filesystem sandbox policy context when the cwd disappears (#46112)
## Why Removing the selected working directory can prevent filesystem sandbox helpers from launching, even when the requested absolute paths remain accessible. Permission rules must stay anchored to the selected directory while those operations continue. ## What changed - Require a policy `cwd` in `FileSystemSandboxContext` and launch filesystem helpers from the filesystem root while preserving the policy directory and workspace roots. - Carry explicit `policyContext` in filesystem RPCs, preserving legacy wire fields and resolving omitted directories from older clients at executor ingress. - Keep permission paths as executor file URIs and validate host compatibility where they are enforced. - Bind Windows relative denial globs to the policy directory before changing the helper's launch directory, preserving home-relative patterns. ## Testing Add regression coverage for `apply_patch` after working-directory removal, legacy RPC directory fallbacks, cross-platform permission URI transport, and Windows relative read denials. The patch regression verifies that an allowed file is updated while an explicitly denied file remains unreadable and unchanged. GitOrigin-RevId: b0f4db722b27cb72ec129fc297c85732afac11f7
This commit is contained in:
1 parent
108e6a6dbe
commit
841b5490b2
48 files changed
+2419
-326
No files matched your search
@@ -76,6 +76,13 @@ async fn discover_root(
|
||||
error: None,
|
||||
};
|
||||
|
||||
if let Some(sandbox) = sandbox
|
||||
&& let Err(error) = sandbox.validate_file_system_paths_for_current_host()
|
||||
{
|
||||
discovery.error = Some(format!("failed to inspect capability root {path}: {error}"));
|
||||
return discovery;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
if sandbox.is_some_and(|context| {
|
||||
context.should_run_in_sandbox() && !context.windows_sandbox_is_requested()
|
||||
|
||||
Reference in new issue
Block a user