mirror of
https://github.com/openai/codex.git
synced 2026-10-29 19:08:43 +00:00
codex: address PR review feedback (#28463)
This commit is contained in:
@@ -28,6 +28,8 @@ use codex_protocol::request_permissions::RequestPermissionProfile;
|
||||
use codex_protocol::request_permissions::RequestPermissionsResponse;
|
||||
use codex_protocol::user_input::UserInput;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_path_uri::ApiPathString;
|
||||
use codex_utils_path_uri::PathConvention;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use core_test_support::PathBufExt;
|
||||
use core_test_support::PathExt;
|
||||
@@ -298,7 +300,7 @@ fn remote_exec_wine_powershell(command: &str) -> Result<()> {
|
||||
let wrapper = codex_utils_cargo_bin::cargo_bin("wine-test-exec")?;
|
||||
let output = Command::new(wrapper)
|
||||
.args([
|
||||
r"C:\Program Files\PowerShell\7\pwsh.exe",
|
||||
"--powershell",
|
||||
"-NoLogo",
|
||||
"-NoProfile",
|
||||
"-NonInteractive",
|
||||
@@ -1080,6 +1082,15 @@ async fn remote_test_env_sandboxed_read_rejects_symlink_parent_dotdot_escape() -
|
||||
let outside_dir_uri = PathUri::from_abs_path(&outside_dir);
|
||||
let secret_path_uri = PathUri::from_abs_path(&secret_path);
|
||||
let symlink_path_uri = allowed_dir_uri.join("link")?;
|
||||
let windows_root = ApiPathString::from_path_uri(&root_uri, PathConvention::Windows)?;
|
||||
let windows_allowed_dir =
|
||||
ApiPathString::from_path_uri(&allowed_dir_uri, PathConvention::Windows)?;
|
||||
let windows_outside_dir =
|
||||
ApiPathString::from_path_uri(&outside_dir_uri, PathConvention::Windows)?;
|
||||
let windows_secret_path =
|
||||
ApiPathString::from_path_uri(&secret_path_uri, PathConvention::Windows)?;
|
||||
let windows_symlink_path =
|
||||
ApiPathString::from_path_uri(&symlink_path_uri, PathConvention::Windows)?;
|
||||
let linux_setup_command = format!(
|
||||
"rm -rf {root}; mkdir -p {allowed} {outside}; printf nope > {secret}; ln -s {outside} {allowed}/link",
|
||||
root = root.display(),
|
||||
@@ -1089,16 +1100,21 @@ async fn remote_test_env_sandboxed_read_rejects_symlink_parent_dotdot_escape() -
|
||||
);
|
||||
let windows_setup_command = format!(
|
||||
r#"$ErrorActionPreference = 'Stop'
|
||||
$root = ([Uri]'{root_uri}').LocalPath
|
||||
$allowed = ([Uri]'{allowed_dir_uri}').LocalPath
|
||||
$outside = ([Uri]'{outside_dir_uri}').LocalPath
|
||||
$secret = ([Uri]'{secret_path_uri}').LocalPath
|
||||
$link = ([Uri]'{symlink_path_uri}').LocalPath
|
||||
$root = '{root}'
|
||||
$allowed = '{allowed}'
|
||||
$outside = '{outside}'
|
||||
$secret = '{secret}'
|
||||
$link = '{link}'
|
||||
Remove-Item -LiteralPath $root -Recurse -Force -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType Directory -Path $allowed -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path $outside -Force | Out-Null
|
||||
[System.IO.File]::WriteAllText($secret, 'nope')
|
||||
New-Item -ItemType SymbolicLink -Path $link -Target $outside | Out-Null"#,
|
||||
root = windows_root.as_str(),
|
||||
allowed = windows_allowed_dir.as_str(),
|
||||
outside = windows_outside_dir.as_str(),
|
||||
secret = windows_secret_path.as_str(),
|
||||
link = windows_symlink_path.as_str(),
|
||||
);
|
||||
remote_exec(&linux_setup_command, &windows_setup_command)?;
|
||||
|
||||
@@ -1113,8 +1129,9 @@ New-Item -ItemType SymbolicLink -Path $link -Target $outside | Out-Null"#,
|
||||
let linux_cleanup_command = format!("rm -rf {}", root.display());
|
||||
let windows_cleanup_command = format!(
|
||||
r#"$ErrorActionPreference = 'Stop'
|
||||
$root = ([Uri]'{root_uri}').LocalPath
|
||||
$root = '{root}'
|
||||
Remove-Item -LiteralPath $root -Recurse -Force -ErrorAction SilentlyContinue"#,
|
||||
root = windows_root.as_str(),
|
||||
);
|
||||
remote_exec(&linux_cleanup_command, &windows_cleanup_command)?;
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user