mirror of
https://github.com/openai/codex.git
synced 2026-11-18 15:01:48 +00:00
Delegate remote process sandboxing to the executor (#37480)
## What changed - Preserve executor-native working directories, workspace roots, and permission profiles when preparing remote `exec_command` requests instead of resolving them through the host platform. - Send sandbox intent to the remote executor, including a restricted-token default for Windows executors and `-NoProfile` for elevated PowerShell commands. - Reject intercepted cross-platform `apply_patch` commands when filesystem writes are restricted, while continuing to allow them for unsandboxed or full-disk-write profiles. ## Testing Extended remote unified-exec coverage for foreign Windows workspaces, elevated PowerShell, sandbox metadata, and restricted and unrestricted intercepted patches. GitOrigin-RevId: 9fd328879fa2c15594fd58e40b6b32e8ba0847e7
This commit is contained in:
1 parent
92fb33b758
commit
511262b984
8 files changed
+284
-44
No files matched your search
@@ -24,7 +24,6 @@ pub(crate) use codex_network_proxy::strip_managed_proxy_env;
|
||||
use codex_protocol::config_types::WindowsSandboxLevel;
|
||||
use codex_protocol::models::AdditionalPermissionProfile;
|
||||
use codex_sandboxing::SandboxCommand;
|
||||
use codex_sandboxing::SandboxType;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use std::collections::HashMap;
|
||||
@@ -179,11 +178,11 @@ pub(crate) fn apply_zsh_fork_path_prepend(
|
||||
pub(crate) fn disable_powershell_profile_for_elevated_windows_sandbox(
|
||||
command: &[String],
|
||||
shell_type: Option<&ShellType>,
|
||||
sandbox: SandboxType,
|
||||
sandbox_requested: bool,
|
||||
windows_sandbox_level: WindowsSandboxLevel,
|
||||
) -> Vec<String> {
|
||||
if shell_type != Some(&ShellType::PowerShell)
|
||||
|| sandbox != SandboxType::WindowsRestrictedToken
|
||||
|| !sandbox_requested
|
||||
|| windows_sandbox_level != WindowsSandboxLevel::Elevated
|
||||
|| command.is_empty()
|
||||
{
|
||||
@@ -428,7 +427,7 @@ mod disable_powershell_profile_tests {
|
||||
let rewritten = disable_powershell_profile_for_elevated_windows_sandbox(
|
||||
&command,
|
||||
Some(&ShellType::PowerShell),
|
||||
SandboxType::WindowsRestrictedToken,
|
||||
/*sandbox_requested*/ true,
|
||||
WindowsSandboxLevel::Elevated,
|
||||
);
|
||||
|
||||
@@ -454,7 +453,7 @@ mod disable_powershell_profile_tests {
|
||||
let rewritten = disable_powershell_profile_for_elevated_windows_sandbox(
|
||||
&command,
|
||||
Some(&ShellType::PowerShell),
|
||||
SandboxType::WindowsRestrictedToken,
|
||||
/*sandbox_requested*/ true,
|
||||
WindowsSandboxLevel::Elevated,
|
||||
);
|
||||
|
||||
@@ -481,7 +480,7 @@ mod disable_powershell_profile_tests {
|
||||
let rewritten = disable_powershell_profile_for_elevated_windows_sandbox(
|
||||
&command,
|
||||
Some(&ShellType::PowerShell),
|
||||
SandboxType::WindowsRestrictedToken,
|
||||
/*sandbox_requested*/ true,
|
||||
WindowsSandboxLevel::Elevated,
|
||||
);
|
||||
|
||||
@@ -499,7 +498,7 @@ mod disable_powershell_profile_tests {
|
||||
let rewritten = disable_powershell_profile_for_elevated_windows_sandbox(
|
||||
&command,
|
||||
Some(&ShellType::PowerShell),
|
||||
SandboxType::WindowsRestrictedToken,
|
||||
/*sandbox_requested*/ true,
|
||||
WindowsSandboxLevel::RestrictedToken,
|
||||
);
|
||||
|
||||
@@ -517,7 +516,7 @@ mod disable_powershell_profile_tests {
|
||||
let rewritten = disable_powershell_profile_for_elevated_windows_sandbox(
|
||||
&command,
|
||||
Some(&ShellType::PowerShell),
|
||||
SandboxType::None,
|
||||
/*sandbox_requested*/ false,
|
||||
WindowsSandboxLevel::Elevated,
|
||||
);
|
||||
|
||||
@@ -535,7 +534,7 @@ mod disable_powershell_profile_tests {
|
||||
let rewritten = disable_powershell_profile_for_elevated_windows_sandbox(
|
||||
&command,
|
||||
Some(&ShellType::Bash),
|
||||
SandboxType::WindowsRestrictedToken,
|
||||
/*sandbox_requested*/ true,
|
||||
WindowsSandboxLevel::Elevated,
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user