Run sandbox integrity checks before commands and filesystem operations (#51843)

## What changed

Wire existing sandbox integrity checks into local command preparation, exec-server process preparation, and sandboxed filesystem helper and file-open operations. Make execution request preparation asynchronous so callers can await the checks.

The checks remain observational: failures and timeouts do not prevent command execution.

## Testing

Add regression tests that launch a real command after checker preparation fails or exceeds its timeout, verifying successful output and exit status.

GitOrigin-RevId: a82399f8aeb8b08f9965e6121b4c7f460552af3f
This commit is contained in:
iceweasel-oai
2026-10-07 21:52:43 +00:00
committed by copyberry
parent c2eb1f42a0
commit cba716c0f1
15 changed files with 151 additions and 28 deletions
+4 -3
View File
@@ -329,7 +329,8 @@ pub async fn process_exec_tool_call(
codex_self_exe,
windows_sandbox_type,
use_legacy_landlock,
)?;
)
.await?;
// Route through the sandboxing module for a single, unified execution path.
crate::sandboxing::execute_env(exec_req, stdout_stream).await
@@ -338,7 +339,7 @@ pub async fn process_exec_tool_call(
/// Transform a portable exec request into the concrete argv/env that should be
/// spawned under the requested sandbox policy.
#[allow(clippy::too_many_arguments)]
pub fn build_exec_request(
pub async fn build_exec_request(
params: ExecParams,
permission_profile: &PermissionProfile,
sandbox_cwd: &AbsolutePathBuf,
@@ -439,7 +440,7 @@ pub fn build_exec_request(
} else {
Vec::new()
};
ExecRequest::from_sandbox_exec_request(request, options, windows_sandbox_workspace_roots)
ExecRequest::from_sandbox_exec_request(request, options, windows_sandbox_workspace_roots).await
}
pub(crate) async fn execute_exec_request(