mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Defer exec-server sandbox preparation to the execution host (#60663)
## Why Remote commands can use workspace paths from a different operating system. Preparing them on the client should preserve those paths and command arguments for the execution host. ## What changed - Build exec-server requests directly, carrying the native command and sandbox context without applying the client's sandbox transform. - Resolve workspace permissions and runtime read access in `SandboxManager` on the execution host, including helper binaries and validated managed-network CA bundles. - Add explicit backend selection and required platform sandbox selection, rejecting launches when the required sandbox is unavailable. ## Testing Extend request tests to cover foreign workspace paths, Unicode arguments, and empty arguments. Extend the remote process test on Unix to verify that restricted reads allow the sandbox helper and validated CA bundle while denying an untrusted certificate file. GitOrigin-RevId: 5fc02ac4208912ecefb80a212742389afc14ac05
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
//! Resolves local sandbox implementations and checks support for an explicitly selected remote MXC.
|
||||
//! Translates Windows sandbox selection and validates explicit remote MXC requests.
|
||||
|
||||
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::SandboxSelection;
|
||||
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 {
|
||||
@@ -18,29 +16,19 @@ pub(crate) fn validate_remote_mxc(info: &crate::EnvironmentInfo) -> std::io::Res
|
||||
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 {
|
||||
pub(crate) fn sandbox_selection(
|
||||
context: &FileSystemSandboxContext,
|
||||
) -> (SandboxSelection, WindowsSandboxLevel) {
|
||||
let level = match 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
|
||||
WindowsSandboxSelection::Mxc => {
|
||||
return (
|
||||
SandboxSelection::Explicit(SandboxType::WindowsMxc),
|
||||
WindowsSandboxLevel::Disabled,
|
||||
);
|
||||
}
|
||||
};
|
||||
let sandbox_type = manager.select_initial(
|
||||
permission_profile,
|
||||
SandboxablePreference::Require,
|
||||
windows_sandbox_type,
|
||||
has_managed_network_requirements,
|
||||
);
|
||||
(sandbox_type, Some(windows_sandbox_level))
|
||||
(SandboxSelection::RequirePlatform, level)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user