mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +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
@@ -310,10 +310,7 @@ async fn read_bounded_text(
|
||||
};
|
||||
if sandbox.is_some_and(FileSystemSandboxContext::should_run_in_sandbox)
|
||||
&& path.infer_path_convention() == Some(PathConvention::Windows)
|
||||
&& sandbox.is_some_and(|context| {
|
||||
context.windows_sandbox_level
|
||||
== codex_protocol::config_types::WindowsSandboxLevel::Disabled
|
||||
})
|
||||
&& sandbox.is_some_and(|context| !context.windows_sandbox_is_requested())
|
||||
{
|
||||
return Err(SkillProviderError::new(
|
||||
"executor skill resource requires an unavailable filesystem sandbox",
|
||||
|
||||
@@ -30,6 +30,7 @@ use codex_exec_server::WalkEntry;
|
||||
use codex_exec_server::WalkEntryKind;
|
||||
use codex_exec_server::WalkOptions;
|
||||
use codex_exec_server::WalkOutcome;
|
||||
use codex_exec_server::WindowsSandboxSelection;
|
||||
use codex_exec_server::WriteFileOptions;
|
||||
use codex_protocol::capabilities::CapabilityRootLocation;
|
||||
use codex_protocol::capabilities::SelectedCapabilityRoot;
|
||||
@@ -301,12 +302,12 @@ async fn skill_loading_and_reads_use_the_supplied_executor_file_system() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn windows_executor_skill_read_rejects_disabled_sandbox_on_any_orchestrator() {
|
||||
async fn windows_executor_skill_read_requires_a_requested_sandbox() {
|
||||
let provider = ExecutorSkillProvider::new_with_restriction_product(
|
||||
Arc::new(EnvironmentManager::default_for_tests()),
|
||||
/*restriction_product*/ None,
|
||||
);
|
||||
let sandbox = FileSystemSandboxContext::from_permission_profile(
|
||||
let mut sandbox = FileSystemSandboxContext::from_permission_profile(
|
||||
PermissionProfile::from_runtime_permissions(
|
||||
&FileSystemSandboxPolicy::restricted(Vec::new()),
|
||||
NetworkSandboxPolicy::Restricted,
|
||||
@@ -317,6 +318,25 @@ async fn windows_executor_skill_read_rejects_disabled_sandbox_on_any_orchestrato
|
||||
"local",
|
||||
PathUri::parse("file:///C:/skill/SKILL.md").expect("Windows resource URI"),
|
||||
);
|
||||
let error = provider
|
||||
.read(SkillReadRequest {
|
||||
_lifetime: PhantomData,
|
||||
authority: SkillAuthority::new(SkillSourceKind::Executor, "windows-root"),
|
||||
package: SkillPackageId("skill://windows-root/C:/skill".into()),
|
||||
resource: resource.clone(),
|
||||
resolved_executor_roots: Vec::new(),
|
||||
sandbox: Some(sandbox.clone()),
|
||||
host_snapshot: None,
|
||||
mcp_resources: None,
|
||||
})
|
||||
.await
|
||||
.expect_err("disabled Windows sandbox must fail closed");
|
||||
assert_eq!(
|
||||
error.message,
|
||||
"executor skill resource requires an unavailable filesystem sandbox"
|
||||
);
|
||||
|
||||
sandbox.windows_sandbox_selection = WindowsSandboxSelection::Mxc;
|
||||
let error = provider
|
||||
.read(SkillReadRequest {
|
||||
_lifetime: PhantomData,
|
||||
@@ -329,11 +349,12 @@ async fn windows_executor_skill_read_rejects_disabled_sandbox_on_any_orchestrato
|
||||
mcp_resources: None,
|
||||
})
|
||||
.await
|
||||
.expect_err("disabled Windows sandbox must fail closed");
|
||||
|
||||
assert_eq!(
|
||||
error.message,
|
||||
"executor skill resource requires an unavailable filesystem sandbox"
|
||||
.expect_err("synthetic Windows resource should not be readable");
|
||||
assert!(
|
||||
error
|
||||
.message
|
||||
.starts_with("failed to read executor skill resource"),
|
||||
"{error:?}"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user