Skip to content

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

refactor(sandbox): drop host-side docker policy validation

Steven Enamakel06a9e523cdec
diff --git a/crates/openhuman-core/src/sandbox/docker.rs b/crates/openhuman-core/src/sandbox/docker.rs
index fcbf5d7ab8..1b324258c9 100644
--- a/crates/openhuman-core/src/sandbox/docker.rs
+++ b/crates/openhuman-core/src/sandbox/docker.rs
@@ -215,46 +215,6 @@ fn docker_handle_for_status(available: bool) -> SandboxBackendHandle {
}
}
-/// Validate that a sandbox policy's Docker configuration doesn't have
-/// dangerous settings (host network, privileged mounts, etc.).
-pub fn validate_docker_policy(policy: &SandboxPolicy) -> Result<(), Vec<String>> {
- let mut issues = Vec::new();
-
- if let Some(overrides) = &policy.docker_overrides {
- if overrides.network.as_deref() == Some("host") {
- issues.push("Docker sandbox uses host network — defeats network isolation".into());
- }
- }
-
- // Check for dangerous mount paths.
- let dangerous_mounts = ["/", "/etc", "/var/run/docker.sock", "/proc", "/sys"];
- for mount in &policy.read_only_mounts {
- let path_str = mount.to_string_lossy();
- for &dangerous in &dangerous_mounts {
- if path_str == dangerous {
- issues.push(format!(
- "Dangerous read-only mount: {path_str} — could leak host secrets"
- ));
- }
- }
- }
-
- let workspace_str = policy.workspace_root.to_string_lossy();
- for &dangerous in &dangerous_mounts {
- if workspace_str == dangerous {
- issues.push(format!(
- "Workspace root is a dangerous path: {workspace_str}"
- ));
- }
- }
-
- if issues.is_empty() {
- Ok(())
- } else {
- Err(issues)
- }
-}
-
#[cfg(test)]
#[path = "docker_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/sandbox/docker_tests.rs b/crates/openhuman-core/src/sandbox/docker_tests.rs
index e7f6a7407b..a097d94386 100644
--- a/crates/openhuman-core/src/sandbox/docker_tests.rs
+++ b/crates/openhuman-core/src/sandbox/docker_tests.rs
@@ -15,50 +15,28 @@ fn test_policy() -> SandboxPolicy {
}
}
+/// Policy validation (host network, dangerous mounts) is owned by the TinyBox
+/// module since contract 1.17; the host must forward the policy unchanged so
+/// the module can refuse it.
+#[cfg(feature = "modules")]
#[test]
-fn validate_docker_policy_accepts_safe_config() {
- let policy = test_policy();
- assert!(validate_docker_policy(&policy).is_ok());
-}
-
-#[test]
-fn validate_docker_policy_rejects_host_network() {
- let mut policy = test_policy();
- policy.docker_overrides = Some(DockerOverrides {
- network: Some("host".into()),
- ..DockerOverrides::default()
- });
- let issues = validate_docker_policy(&policy).unwrap_err();
- assert!(issues.iter().any(|i| i.contains("host network")));
-}
-
-#[test]
-fn validate_docker_policy_rejects_dangerous_mounts() {
- let mut policy = test_policy();
- policy.read_only_mounts = vec![PathBuf::from("/var/run/docker.sock")];
- let issues = validate_docker_policy(&policy).unwrap_err();
- assert!(issues.iter().any(|i| i.contains("docker.sock")));
-}
-
-#[test]
-fn validate_docker_policy_rejects_root_workspace() {
- let mut policy = test_policy();
- policy.workspace_root = PathBuf::from("/");
- let issues = validate_docker_policy(&policy).unwrap_err();
- assert!(issues.iter().any(|i| i.contains("dangerous path")));
-}
-
-#[test]
-fn validate_docker_policy_multiple_issues() {
+fn host_network_and_dangerous_mounts_reach_the_module_unfiltered() {
let mut policy = test_policy();
policy.workspace_root = PathBuf::from("/etc");
- policy.read_only_mounts = vec![PathBuf::from("/proc")];
+ policy.read_only_mounts = vec![PathBuf::from("/var/run/docker.sock")];
policy.docker_overrides = Some(DockerOverrides {
network: Some("host".into()),
..DockerOverrides::default()
});
- let issues = validate_docker_policy(&policy).unwrap_err();
- assert!(issues.len() >= 3);
+ let request = SandboxExecRequest {
+ command: "true".into(),
+ env: Default::default(),
+ timeout: std::time::Duration::from_secs(1),
+ };
+ let run = build_docker_request(&policy, &request).expect("host adapter forwards policy");
+ assert_eq!(run.workspace, "/etc");
+ assert_eq!(run.network.as_deref(), Some("host"));
+ assert_eq!(run.read_only_mounts, vec!["/var/run/docker.sock".to_owned()]);
}
#[cfg(feature = "modules")]