mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Separate executor sandbox selection from Windows sandbox levels (#45730)
## Why MXC is a sandbox implementation, not a restricted-token sandbox level. Executor requests need to represent that choice separately from `WindowsSandboxLevel`. ## What changed - Introduce `WindowsSandboxSelection` for executor sandbox contexts and remove `Mxc` from `WindowsSandboxLevel`. - Preserve the `windowsSandboxLevel` wire field and its serialized values for compatibility. - Share sandbox selection between executor process launches and filesystem helpers, and use the new selection in capability discovery and skill reads. - Disable Windows sandbox selection for executor paths that do not use Windows path conventions. ## Testing Extend coverage for MXC wire serialization, Windows skill-read sandbox checks, and capability discovery with distinct permissions. Exercise remote filesystem write restrictions with both restricted-token and MXC sandboxes, including rejection when native MXC is unavailable. GitOrigin-RevId: 266211377bcb138a0dc75861e9ff2225fa37a53d
This commit is contained in:
1 parent
a9d2564bcb
commit
d4e11a9b97
32 files changed
+256
-150
No files matched your search
@@ -13,7 +13,7 @@ use crate::tools::sandboxing::Sandboxable;
|
||||
use crate::tools::sandboxing::ToolCtx;
|
||||
use crate::tools::sandboxing::ToolError;
|
||||
use crate::tools::sandboxing::ToolRuntime;
|
||||
use crate::tools::sandboxing::executor_windows_sandbox_level;
|
||||
use crate::tools::sandboxing::executor_windows_sandbox_selection;
|
||||
use codex_apply_patch::AppliedPatchDelta;
|
||||
use codex_apply_patch::ApplyPatchAction;
|
||||
use codex_apply_patch::ApplyPatchOptions;
|
||||
@@ -102,7 +102,7 @@ impl ApplyPatchRuntime {
|
||||
workspace_roots: attempt.workspace_roots.to_vec(),
|
||||
user_home_dir: req.turn_environment.user_home_dir.clone(),
|
||||
temporary_directories: None,
|
||||
windows_sandbox_level: executor_windows_sandbox_level(
|
||||
windows_sandbox_selection: executor_windows_sandbox_selection(
|
||||
attempt.windows_sandbox_level,
|
||||
attempt.sandbox_cwd,
|
||||
),
|
||||
|
||||
@@ -276,8 +276,12 @@ async fn file_system_sandbox_context_preserves_executor_workspace_permissions()
|
||||
Some(codex_utils_path_uri::PathUri::from_abs_path(&path))
|
||||
);
|
||||
assert_eq!(
|
||||
sandbox.windows_sandbox_level,
|
||||
WindowsSandboxLevel::RestrictedToken
|
||||
sandbox.windows_sandbox_selection,
|
||||
if cfg!(windows) {
|
||||
codex_file_system::WindowsSandboxSelection::RestrictedToken
|
||||
} else {
|
||||
codex_file_system::WindowsSandboxSelection::Disabled
|
||||
}
|
||||
);
|
||||
assert_eq!(sandbox.windows_sandbox_private_desktop, true);
|
||||
assert_eq!(sandbox.use_legacy_landlock, true);
|
||||
@@ -349,7 +353,7 @@ async fn file_system_sandbox_context_respects_sandbox_request() {
|
||||
workspace_roots: vec![cwd],
|
||||
user_home_dir: Some(user_home_dir),
|
||||
temporary_directories: None,
|
||||
windows_sandbox_level: WindowsSandboxLevel::RestrictedToken,
|
||||
windows_sandbox_selection: codex_file_system::WindowsSandboxSelection::RestrictedToken,
|
||||
windows_sandbox_private_desktop: false,
|
||||
windows_sandbox_proxy_settings_mode: None,
|
||||
use_legacy_landlock: false,
|
||||
|
||||
Reference in new issue
Block a user