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
@@ -333,9 +333,6 @@ impl SandboxManager {
|
||||
if !self.should_sandbox(permission_profile, pref, has_managed_network_requirements) {
|
||||
return SandboxType::None;
|
||||
}
|
||||
if cfg!(windows) && windows_sandbox_level == WindowsSandboxLevel::Mxc {
|
||||
return SandboxType::WindowsMxc;
|
||||
}
|
||||
get_platform_sandbox(windows_sandbox_level != WindowsSandboxLevel::Disabled)
|
||||
.unwrap_or(SandboxType::None)
|
||||
}
|
||||
|
||||
@@ -25,48 +25,6 @@ use pretty_assertions::assert_eq;
|
||||
use std::collections::HashMap;
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[test]
|
||||
fn mxc_selection_preserves_unsandboxed_requests_and_other_platforms() {
|
||||
let manager = SandboxManager::new();
|
||||
let platform_sandbox = if cfg!(windows) {
|
||||
SandboxType::WindowsMxc
|
||||
} else {
|
||||
get_platform_sandbox(/*windows_sandbox_enabled*/ false).unwrap_or(SandboxType::None)
|
||||
};
|
||||
for (permissions, preference, expected) in [
|
||||
(
|
||||
PermissionProfile::read_only(),
|
||||
SandboxablePreference::Auto,
|
||||
platform_sandbox,
|
||||
),
|
||||
(
|
||||
PermissionProfile::Disabled,
|
||||
SandboxablePreference::Require,
|
||||
platform_sandbox,
|
||||
),
|
||||
(
|
||||
PermissionProfile::read_only(),
|
||||
SandboxablePreference::Forbid,
|
||||
SandboxType::None,
|
||||
),
|
||||
(
|
||||
PermissionProfile::Disabled,
|
||||
SandboxablePreference::Auto,
|
||||
SandboxType::None,
|
||||
),
|
||||
] {
|
||||
assert_eq!(
|
||||
manager.select_initial(
|
||||
&permissions,
|
||||
preference,
|
||||
WindowsSandboxLevel::Mxc,
|
||||
/*has_managed_network_requirements*/ false,
|
||||
),
|
||||
expected,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn danger_full_access_defaults_to_no_sandbox_without_network_requirements() {
|
||||
let manager = SandboxManager::new();
|
||||
|
||||
Reference in new issue
Block a user