mirror of
https://github.com/openai/codex.git
synced 2026-11-06 16:32:29 +00:00
Preserve custom arg0 for sandboxed exec-server processes (#34497)
## Why Sandbox wrappers replaced the process launch command and did not carry an `ExecParams.arg0` override through to the inner process. ## What changed - Route sandboxed Unix launches with a custom `arg0` through a helper mode that re-execs the requested program with the override. - Expose the helper executable to the filesystem sandbox and dispatch its mode from Codex and exec-server test binaries. ## Testing Add coverage for the prepared sandbox command and an end-to-end remote process that verifies both the custom `arg0` and filesystem restrictions. GitOrigin-RevId: c9f8eef3906d184e670184c2eeed250d5895a9ca
This commit is contained in:
1 parent
99eb575649
commit
4f1992732c
10 files changed
+243
-14
No files matched your search
@@ -2,8 +2,8 @@
|
||||
//!
|
||||
//! This mirrors `//codex-rs/exec-server/testing:exec-server` so Cargo-backed
|
||||
//! app-server integration tests can receive `CARGO_BIN_EXE_exec-server`. It
|
||||
//! also handles the filesystem-helper argv mode because exec-server re-execs
|
||||
//! `codex_self_exe` for sandboxed filesystem requests.
|
||||
//! also handles the helper argv modes because exec-server re-execs
|
||||
//! `codex_self_exe` for sandboxed filesystem and process requests.
|
||||
|
||||
use codex_exec_server::ExecServerRuntimePaths;
|
||||
use std::ffi::OsStr;
|
||||
@@ -13,7 +13,12 @@ const CODEX_LINUX_SANDBOX_EXE_ENV_VAR: &str = "CODEX_TEST_LINUX_SANDBOX_EXE";
|
||||
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
let mut args = std::env::args_os();
|
||||
let _ = args.next();
|
||||
if args.next().as_deref() == Some(OsStr::new(codex_exec_server::CODEX_FS_HELPER_ARG1)) {
|
||||
let argv1 = args.next();
|
||||
#[cfg(unix)]
|
||||
if argv1.as_deref() == Some(OsStr::new(codex_exec_server::CODEX_ARG0_EXEC_HELPER_ARG1)) {
|
||||
codex_exec_server::run_arg0_exec_helper_main();
|
||||
}
|
||||
if argv1.as_deref() == Some(OsStr::new(codex_exec_server::CODEX_FS_HELPER_ARG1)) {
|
||||
codex_exec_server::run_fs_helper_main();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user