mirror of
https://github.com/openai/codex.git
synced 2026-08-29 14:09:35 +00:00
## 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
31 lines
1.0 KiB
Rust
31 lines
1.0 KiB
Rust
//! Minimal exec-server fixture for Bazel-only integration tests.
|
|
//!
|
|
//! Linking only exec-server avoids depending on the full Codex CLI binary
|
|
//! when a test only needs a WebSocket executor endpoint. It handles the arg0
|
|
//! helper mode because sandboxed process requests re-exec this binary.
|
|
|
|
use codex_exec_server::ExecServerRuntimePaths;
|
|
#[cfg(unix)]
|
|
use std::ffi::OsStr;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|
#[cfg(unix)]
|
|
{
|
|
let mut args = std::env::args_os();
|
|
let _ = args.next();
|
|
if args.next().as_deref()
|
|
== Some(OsStr::new(
|
|
codex_exec_server::CODEX_ARG0_EXEC_HELPER_ARG1,
|
|
))
|
|
{
|
|
codex_exec_server::run_arg0_exec_helper_main();
|
|
}
|
|
}
|
|
|
|
let current_exe = std::env::current_exe()?;
|
|
let runtime_paths =
|
|
ExecServerRuntimePaths::new(current_exe, /*codex_linux_sandbox_exe*/ None)?;
|
|
codex_exec_server::run_main("ws://127.0.0.1:0", runtime_paths).await
|
|
}
|