Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix: reject empty sandbox environment values

Steven Enamakelea3acbdacf92
diff --git a/crates/openhuman-core/src/agent/platform_shell.rs b/crates/openhuman-core/src/agent/platform_shell.rs
index 59793af3bf..6be83e15a5 100644
--- a/crates/openhuman-core/src/agent/platform_shell.rs
+++ b/crates/openhuman-core/src/agent/platform_shell.rs
@@ -100,7 +100,9 @@ pub fn assert_forwards_windows_bootstrap(allowlist: &[&str], launcher: &str) {
pub fn forward_windows_bootstrap_env(cmd: &mut tokio::process::Command) {
for var in WINDOWS_PROCESS_ENV_VARS {
if let Ok(val) = std::env::var(var) {
- cmd.env(var, val);
+ if !val.is_empty() {
+ cmd.env(var, val);
+ }
}
}
}
@@ -112,7 +114,9 @@ pub fn forward_windows_bootstrap_env(_cmd: &mut tokio::process::Command) {}
pub fn forward_windows_bootstrap_env_std(cmd: &mut std::process::Command) {
for var in WINDOWS_PROCESS_ENV_VARS {
if let Ok(val) = std::env::var(var) {
- cmd.env(var, val);
+ if !val.is_empty() {
+ cmd.env(var, val);
+ }
}
}
}
diff --git a/crates/openhuman-core/src/sandbox/ops.rs b/crates/openhuman-core/src/sandbox/ops.rs
index 99d134d675..6c4f83bfdf 100644
--- a/crates/openhuman-core/src/sandbox/ops.rs
+++ b/crates/openhuman-core/src/sandbox/ops.rs
@@ -273,7 +273,9 @@ async fn execute_unsandboxed(
cmd.env_clear();
for var in SANDBOX_ENV_PASSTHROUGH {
if let Ok(val) = std::env::var(var) {
- cmd.env(var, val);
+ if !val.is_empty() {
+ cmd.env(var, val);
+ }
}
}
platform_shell::forward_windows_bootstrap_env(&mut cmd);
@@ -402,7 +404,9 @@ async fn execute_local_jail(
cmd.env_clear();
for var in SANDBOX_ENV_PASSTHROUGH {
if let Ok(val) = std::env::var(var) {
- cmd.env(var, val);
+ if !val.is_empty() {
+ cmd.env(var, val);
+ }
}
}
platform_shell::forward_windows_bootstrap_env_std(&mut cmd);
diff --git a/tests/windows_sandbox_env_e2e.rs b/tests/windows_sandbox_env_e2e.rs
index 554f4956c8..8fa8699459 100644
--- a/tests/windows_sandbox_env_e2e.rs
+++ b/tests/windows_sandbox_env_e2e.rs
@@ -130,10 +130,10 @@ async fn sandboxed_child_receives_windows_bootstrap_env() {
#[cfg(windows)]
#[tokio::test]
async fn node_crypto_runs_through_sandbox_path() {
- if !tool_available("node") {
- eprintln!("test skipped: node_crypto_runs_through_sandbox_path (`node` is not on PATH)");
- return;
- }
+ assert!(
+ tool_available("node"),
+ "node is required for node_crypto_runs_through_sandbox_path; missing tooling must not silently pass"
+ );
let result = run_in_sandbox(
SandboxMode::None,
@@ -169,12 +169,10 @@ async fn node_crypto_runs_through_sandbox_path() {
#[cfg(windows)]
#[tokio::test]
async fn powershell_runs_through_sandbox_path() {
- if !tool_available("powershell.exe") {
- eprintln!(
- "test skipped: powershell_runs_through_sandbox_path (`powershell.exe` is not on PATH)"
- );
- return;
- }
+ assert!(
+ tool_available("powershell.exe"),
+ "powershell.exe is required for powershell_runs_through_sandbox_path; missing tooling must not silently pass"
+ );
let result = run_in_sandbox(
SandboxMode::None,