Keep sandbox preparation with the command through launch (#62205)

## What changed

- Keep the prepared `SandboxExecRequest` intact in core and let
  `command/exec` borrow the prepared command for streaming. Windows
  restricted-token commands continue through the dedicated sandbox launcher.
- Move runtime read-path selection for exec-server commands and filesystem
  helpers into `SandboxManager`. It derives the paths from the executor's
  binaries and, for managed process launches, finds the generated proxy CA
  bundle in the command environment.

GitOrigin-RevId: 8c9d278496d84589bc4a7b7d0ed08cb1b8e6ba21
This commit is contained in:
viyatb-oai
2026-11-18 06:22:36 +00:00
committed by copyberry
parent a734a13ad7
commit a4495dd5c9
22 changed files with 495 additions and 372 deletions
+7 -8
View File
@@ -59,24 +59,23 @@ pub(super) async fn spawn_command_under_sandbox(
.await
.map_err(|err| io::Error::other(err.to_string()))?;
let (program, args) = exec_request
.command
.split_first()
let command = exec_request
.direct_command()
.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "command args are empty"))?;
let mut child = tokio::process::Command::new(program);
if let Some(arg0) = exec_request.arg0.as_deref() {
let mut child = tokio::process::Command::new(command.program);
if let Some(arg0) = command.arg0 {
child.arg0(arg0);
}
child.args(args);
child.args(command.args);
// TODO(anp): Keep PathUri through the macOS sandbox process launch boundary.
let native_cwd = exec_request
let native_cwd = command
.cwd
.to_abs_path()
.map_err(|err| io::Error::other(err.to_string()))?;
child.current_dir(native_cwd);
child.env_clear();
child.envs(exec_request.env);
child.envs(command.env);
match stdio_policy {
StdioPolicy::RedirectForShellTool => {