mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
## Why Older executors sandbox reads whenever a policy is supplied, even when the policy allows unrestricted reads. This can interfere with loading skills across executor versions. ## What changed - Omit sandbox contexts from remote read operations when reads are unrestricted and explicit permission paths are valid for the target path convention. Retain contexts that require executor-side path validation. - Check remote `windows_mxc` support before sending MXC sandbox contexts for reads or capability discovery, returning an update-executor error when unsupported. ## Testing Add coverage for permission path validation across read operations, unsupported MXC requests, and skill loading over Noise with mismatched app and executor versions, including selected skill roots with capability discovery disabled. GitOrigin-RevId: 4a2a7ccaa2ba4daac657bd84aea603404452be45
47 lines
1.9 KiB
Rust
47 lines
1.9 KiB
Rust
//! Resolves local sandbox implementations and checks support for an explicitly selected remote MXC.
|
|
|
|
use codex_file_system::FileSystemSandboxContext;
|
|
use codex_file_system::WindowsSandboxSelection;
|
|
use codex_protocol::config_types::WindowsSandboxLevel;
|
|
use codex_protocol::models::PermissionProfile;
|
|
use codex_sandboxing::SandboxManager;
|
|
use codex_sandboxing::SandboxType;
|
|
use codex_sandboxing::SandboxablePreference;
|
|
|
|
pub(crate) fn validate_remote_mxc(info: &crate::EnvironmentInfo) -> std::io::Result<()> {
|
|
if !info.capabilities.windows_mxc {
|
|
return Err(std::io::Error::new(
|
|
std::io::ErrorKind::Unsupported,
|
|
"exec-server does not support the requested MXC Windows sandbox; update the executor",
|
|
));
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
pub(crate) fn select_sandbox(
|
|
manager: &SandboxManager,
|
|
permission_profile: &PermissionProfile,
|
|
sandbox_context: &FileSystemSandboxContext,
|
|
has_managed_network_requirements: bool,
|
|
) -> (SandboxType, Option<WindowsSandboxLevel>) {
|
|
let windows_sandbox_level = match sandbox_context.windows_sandbox_selection {
|
|
WindowsSandboxSelection::Disabled => WindowsSandboxLevel::Disabled,
|
|
WindowsSandboxSelection::RestrictedToken => WindowsSandboxLevel::RestrictedToken,
|
|
WindowsSandboxSelection::Elevated => WindowsSandboxLevel::Elevated,
|
|
WindowsSandboxSelection::Mxc => return (SandboxType::WindowsMxc, None),
|
|
};
|
|
let windows_sandbox_type = match windows_sandbox_level {
|
|
WindowsSandboxLevel::Disabled => SandboxType::None,
|
|
WindowsSandboxLevel::RestrictedToken | WindowsSandboxLevel::Elevated => {
|
|
SandboxType::WindowsRestrictedToken
|
|
}
|
|
};
|
|
let sandbox_type = manager.select_initial(
|
|
permission_profile,
|
|
SandboxablePreference::Require,
|
|
windows_sandbox_type,
|
|
has_managed_network_requirements,
|
|
);
|
|
(sandbox_type, Some(windows_sandbox_level))
|
|
}
|