mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
Move sandbox preparation into platform backends (#62317)
## What changed Have `SandboxManager` handle backend selection and shared preparation, then delegate command wrapping and session setup to the Linux, macOS Seatbelt, Windows token, and Windows MXC backends. Centralize Windows managed proxy routing in `codex-sandboxing` so the exec server and other callers use the same rule for selecting dedicated MXC listeners. GitOrigin-RevId: a75886809aefebf6c267bb39dbc104f76bda3409
This commit is contained in:
@@ -17,16 +17,27 @@ pub(crate) fn validate_remote_mxc(info: &crate::EnvironmentInfo) -> std::io::Res
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn windows_sandbox_backend(selection: WindowsSandboxSelection) -> SandboxType {
|
||||
match selection {
|
||||
WindowsSandboxSelection::Disabled => SandboxType::None,
|
||||
WindowsSandboxSelection::RestrictedToken | WindowsSandboxSelection::Elevated => {
|
||||
SandboxType::WindowsRestrictedToken
|
||||
}
|
||||
WindowsSandboxSelection::Mxc => SandboxType::WindowsMxc,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn sandbox_selection(
|
||||
context: &FileSystemSandboxContext,
|
||||
) -> (SandboxSelection, WindowsSandboxLevel) {
|
||||
let windows_sandbox = windows_sandbox_backend(context.windows_sandbox_selection);
|
||||
let level = match context.windows_sandbox_selection {
|
||||
WindowsSandboxSelection::Disabled => WindowsSandboxLevel::Disabled,
|
||||
WindowsSandboxSelection::RestrictedToken => WindowsSandboxLevel::RestrictedToken,
|
||||
WindowsSandboxSelection::Elevated => WindowsSandboxLevel::Elevated,
|
||||
WindowsSandboxSelection::Mxc => {
|
||||
return (
|
||||
SandboxSelection::Explicit(SandboxType::WindowsMxc),
|
||||
SandboxSelection::Explicit(windows_sandbox),
|
||||
WindowsSandboxLevel::Disabled,
|
||||
);
|
||||
}
|
||||
@@ -34,11 +45,7 @@ pub(crate) fn sandbox_selection(
|
||||
(
|
||||
SandboxSelection::Platform {
|
||||
preference: SandboxablePreference::Require,
|
||||
windows_sandbox: if level == WindowsSandboxLevel::Disabled {
|
||||
SandboxType::None
|
||||
} else {
|
||||
SandboxType::WindowsRestrictedToken
|
||||
},
|
||||
windows_sandbox,
|
||||
},
|
||||
level,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user