mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
linux-sandbox: use standalone bundled bwrap
This commit is contained in:
@@ -7,5 +7,8 @@ codex_rust_crate(
|
||||
# they install process-global test-binary dispatch state, and the remote
|
||||
# exec-server cases already rely on serialization around the full CLI path.
|
||||
integration_test_args = ["--test-threads=1"],
|
||||
extra_binaries = [
|
||||
"//codex-rs/bwrap:bwrap",
|
||||
],
|
||||
test_tags = ["no-sandbox"],
|
||||
)
|
||||
|
||||
@@ -29,6 +29,15 @@ use crate::rpc::internal_error;
|
||||
use crate::rpc::invalid_request;
|
||||
|
||||
const FS_HELPER_ENV_ALLOWLIST: &[&str] = &["PATH", "TMPDIR", "TMP", "TEMP"];
|
||||
#[cfg(debug_assertions)]
|
||||
const FS_HELPER_BAZEL_BWRAP_ENV_ALLOWLIST: &[&str] = &[
|
||||
"CARGO_BIN_EXE_bwrap",
|
||||
"RUNFILES_DIR",
|
||||
"RUNFILES_MANIFEST_FILE",
|
||||
"RUNFILES_MANIFEST_ONLY",
|
||||
"TEST_SRCDIR",
|
||||
"TEST_WORKSPACE",
|
||||
];
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct FileSystemSandboxRunner {
|
||||
@@ -220,7 +229,19 @@ fn helper_env_from_vars(
|
||||
}
|
||||
|
||||
fn helper_env_key_is_allowed(key: &str) -> bool {
|
||||
FS_HELPER_ENV_ALLOWLIST.contains(&key) || (cfg!(windows) && key.eq_ignore_ascii_case("PATH"))
|
||||
FS_HELPER_ENV_ALLOWLIST.contains(&key)
|
||||
|| bazel_bwrap_env_key_is_allowed(key)
|
||||
|| (cfg!(windows) && key.eq_ignore_ascii_case("PATH"))
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
fn bazel_bwrap_env_key_is_allowed(key: &str) -> bool {
|
||||
option_env!("BAZEL_PACKAGE").is_some() && FS_HELPER_BAZEL_BWRAP_ENV_ALLOWLIST.contains(&key)
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
fn bazel_bwrap_env_key_is_allowed(_key: &str) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
async fn run_command(
|
||||
|
||||
Reference in New Issue
Block a user