Skip to content

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

chore(deps): update workspace dependencies and add sandbox config tests

Steven Enamakelc309c72e1c7f
diff --git a/Cargo.lock b/Cargo.lock
index 07e5f96f47..fb58f9e51c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -100,6 +100,12 @@ dependencies = [
"pkg-config",
]
+[[package]]
+name = "ambient-authority"
+version = "0.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b"
+
[[package]]
name = "android_system_properties"
version = "0.1.6"
@@ -145,7 +151,7 @@ version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
dependencies = [
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -156,7 +162,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
dependencies = [
"anstyle",
"once_cell_polyfill",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -701,6 +707,48 @@ dependencies = [
"serde",
]
+[[package]]
+name = "cap-fs-ext"
+version = "4.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56ff379b70af8e08307a8f65e7040c7301cb4a572538ade16b4984f0da77847f"
+dependencies = [
+ "cap-primitives",
+ "cap-std",
+ "io-lifetimes 3.0.1",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "cap-primitives"
+version = "4.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b5f74729fd2f44701d1a8eb47e906cdb3ccd9ec0f02baad85a744b791940b18"
+dependencies = [
+ "ambient-authority",
+ "fs-set-times",
+ "io-extras",
+ "io-lifetimes 3.0.1",
+ "ipnet",
+ "maybe-owned",
+ "rustix",
+ "rustix-linux-procfs",
+ "windows-sys 0.61.2",
+ "winx",
+]
+
+[[package]]
+name = "cap-std"
+version = "4.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1ec78e242cfa2cfe276807ac2ecc00315a6c97786977414bcd1c3963b6c91b8"
+dependencies = [
+ "cap-primitives",
+ "io-extras",
+ "io-lifetimes 3.0.1",
+ "rustix",
+]
+
[[package]]
name = "castaway"
version = "0.2.4"
@@ -1657,7 +1705,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1884,7 +1932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -2124,6 +2172,17 @@ dependencies = [
"percent-encoding",
]
+[[package]]
+name = "fs-set-times"
+version = "0.20.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a"
+dependencies = [
+ "io-lifetimes 2.0.4",
+ "rustix",
+ "windows-sys 0.52.0",
+]
+
[[package]]
name = "fs2"
version = "0.4.3"
@@ -2645,7 +2704,7 @@ dependencies = [
"js-sys",
"log",
"wasm-bindgen",
- "windows-core 0.58.0",
+ "windows-core 0.62.2",
]
[[package]]
@@ -2841,6 +2900,28 @@ dependencies = [
"syn 3.0.6",
]
+[[package]]
+name = "io-extras"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20fd6de4ccfcc187e38bc21cfa543cb5a302cb86a8b114eb7f0bf0dc9f8ac00f"
+dependencies = [
+ "io-lifetimes 3.0.1",
+ "windows-sys 0.60.2",
+]
+
+[[package]]
+name = "io-lifetimes"
+version = "2.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06432fb54d3be7964ecd3649233cddf80db2832f47fec34c01f65b3d9d774983"
+
+[[package]]
+name = "io-lifetimes"
+version = "3.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f0fb0570afe1fed943c5c3d4102d5358592d8625fda6a0007fdbe65a92fba96"
+
[[package]]
name = "ipnet"
version = "2.12.2"
@@ -2853,15 +2934,6 @@ version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
-[[package]]
-name = "itertools"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
-dependencies = [
- "either",
-]
-
[[package]]
name = "itertools"
version = "0.14.0"
@@ -3142,10 +3214,13 @@ version = "0.11.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2c646bd5cc763b1087b15493e29a64be6147ba8f19342004fa52048ee596eae"
dependencies = [
+ "async-trait",
"base64 0.23.1",
"email-encoding",
"email_address",
"fastrand",
+ "futures-io",
+ "futures-util",
"httpdate",
"idna",
"mime",
@@ -3155,6 +3230,7 @@ dependencies = [
"rustls",
"socket2",
"tokio",
+ "tokio-rustls",
"url",
"webpki-roots 1.0.9",
]
@@ -3331,6 +3407,12 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
+[[package]]
+name = "maybe-owned"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4"
+
[[package]]
name = "md5"
version = "0.8.1"
@@ -3542,7 +3624,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -4803,7 +4885,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf"
dependencies = [
"anyhow",
- "itertools 0.13.0",
+ "itertools",
"proc-macro2",
"quote",
"syn 2.0.119",
@@ -4889,7 +4971,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -5045,7 +5127,7 @@ dependencies = [
"compact_str 0.9.1",
"critical-section",
"hashbrown 0.17.1",
- "itertools 0.14.0",
+ "itertools",
"kasuari",
"lru",
"palette",
@@ -5110,7 +5192,7 @@ dependencies = [
"hashbrown 0.17.1",
"indoc",
"instability",
- "itertools 0.14.0",
+ "itertools",
"line-clipping",
"ratatui-core",
"serde",
@@ -5371,7 +5453,17 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustix-linux-procfs"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056"
+dependencies = [
+ "once_cell",
+ "rustix",
]
[[package]]
@@ -5429,7 +5521,7 @@ dependencies = [
"security-framework 3.7.0",
"security-framework-sys",
"webpki-root-certs",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -5976,7 +6068,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
dependencies = [
"libc",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -6243,7 +6335,7 @@ dependencies = [
"getrandom 0.4.3",
"once_cell",
"rustix",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -6256,7 +6348,7 @@ dependencies = [
"parking_lot",
"rustix",
"signal-hook",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -6504,6 +6596,7 @@ dependencies = [
"tinyinference-llm",
"tinytools",
"tokio",
+ "tracing",
"uuid",
]
@@ -7048,7 +7141,7 @@ dependencies = [
[[package]]
name = "tinymcp"
-version = "0.3.7"
+version = "0.4.0"
dependencies = [
"anyhow",
"async-trait",
@@ -7075,7 +7168,7 @@ dependencies = [
[[package]]
name = "tinymcp-bus"
-version = "0.3.7"
+version = "0.4.0"
dependencies = [
"schemars",
"serde",
@@ -7084,19 +7177,20 @@ dependencies = [
[[package]]
name = "tinymemory-api"
-version = "1.23.1"
+version = "1.23.5"
dependencies = [
"async-trait",
"chrono",
+ "chrono-tz",
"serde",
"serde_json",
- "sha2 0.10.9",
+ "sha2 0.11.0",
"thiserror 2.0.20",
]
[[package]]
name = "tinymemory-integrations"
-version = "1.23.1"
+version = "1.23.5"
dependencies = [
"async-trait",
"chrono",
@@ -7108,7 +7202,7 @@ dependencies = [
"schemars",
"serde",
"serde_json",
- "sha2 0.10.9",
+ "sha2 0.11.0",
"thiserror 2.0.20",
"tinymemory-api",
"tinymemory-tools",
@@ -7119,7 +7213,7 @@ dependencies = [
[[package]]
name = "tinymemory-tools"
-version = "1.23.1"
+version = "1.23.5"
dependencies = [
"chrono",
"futures",
@@ -7159,8 +7253,10 @@ dependencies = [
[[package]]
name = "tinyskills"
-version = "0.2.7"
+version = "0.2.8"
dependencies = [
+ "cap-fs-ext",
+ "cap-std",
"rustix",
"serde",
"serde_json",
@@ -7215,7 +7311,7 @@ version = "0.5.0"
dependencies = [
"anyhow",
"async-trait",
- "base64 0.22.1",
+ "base64 0.23.1",
"fs2",
"futures-util",
"glob",
@@ -7742,7 +7838,7 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5"
dependencies = [
- "itertools 0.14.0",
+ "itertools",
"unicode-segmentation",
"unicode-width",
]
@@ -8404,7 +8500,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -8790,6 +8886,16 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "winx"
+version = "0.36.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d"
+dependencies = [
+ "bitflags 2.13.2",
+ "windows-sys 0.52.0",
+]
+
[[package]]
name = "wiremock"
version = "0.6.5"
diff --git a/crates/openhuman-core/src/core/runtime/saas_tests.rs b/crates/openhuman-core/src/core/runtime/saas_tests.rs
index adc62803c6..0329f98791 100644
--- a/crates/openhuman-core/src/core/runtime/saas_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/saas_tests.rs
@@ -7,6 +7,7 @@ fn loads_an_operator_file_with_defaults() {
std::fs::write(&path, "root = \"/srv/openhuman\"\n").unwrap();
let config = SaasConfig::load(&path).unwrap();
assert_eq!(config, SaasConfig::new("/srv/openhuman"));
+ assert_eq!(config.sandbox.network, "none");
assert_eq!(
config.service_token_path(),
PathBuf::from("/srv/openhuman/service.token")
@@ -22,13 +23,19 @@ fn reads_every_operator_setting() {
r#"
root = "/srv/oh"
service_token_file = "/run/secrets/gateway"
-tool_allowlist = ["documents"]
+tool_allowlist = ["host_shell"]
rpc_allowlist_extra = ["threads.list"]
max_agents_open = 8
idle_evict_secs = 60
shared_backend_api_key = true
custom_definitions = true
require_user_signature = false
+
+[sandbox]
+image = "registry.example/sandbox:1"
+network = "egress"
+memory_limit_mb = 256
+cpu_limit = 0.5
"#,
)
.unwrap();
@@ -37,7 +44,11 @@ require_user_signature = false
config.service_token_path(),
PathBuf::from("/run/secrets/gateway")
);
- assert_eq!(config.tool_allowlist, vec!["documents".to_string()]);
+ assert_eq!(config.tool_allowlist, vec!["host_shell".to_string()]);
+ assert_eq!(config.sandbox.image, "registry.example/sandbox:1");
+ assert_eq!(config.sandbox.network, "egress");
+ assert_eq!(config.sandbox.memory_limit_mb, 256);
+ assert_eq!(config.sandbox.cpu_limit, 0.5);
assert_eq!(config.rpc_allowlist_extra, vec!["threads.list".to_string()]);
assert_eq!(config.max_agents_open, 8);
assert_eq!(config.idle_evict_secs, 60);
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index 9df9d78038..f5bf66be44 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -376,7 +376,10 @@ impl ShellTool {
}
Err(why) => {
tracing::warn!(reason = %why, "[shell] SaaS sandbox refused the command");
- (true, ToolResult::error(format!("Sandbox unavailable: {why}")))
+ (
+ true,
+ ToolResult::error(format!("Sandbox unavailable: {why}")),
+ )
}
};
}
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index e7fa0386dd..b6afdbf7c9 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -930,7 +930,9 @@ pub fn all_tools_with_runtime(
let mut tools: Vec<Box<dyn Tool>> = if let Some(set) = domains {
tools
.into_iter()
- .filter(|t| crate::user_agents::tools::admits(t.name(), set.allows(tool_group(t.name()))))
+ .filter(|t| {
+ crate::user_agents::tools::admits(t.name(), set.allows(tool_group(t.name())))
+ })
.collect()
} else {
// No ambient context (unit tests / pre-boot) ⇒ no domain filtering.
diff --git a/crates/openhuman-core/src/user_agents/tools_tests.rs b/crates/openhuman-core/src/user_agents/tools_tests.rs
new file mode 100644
index 0000000000..2170c67415
--- /dev/null
+++ b/crates/openhuman-core/src/user_agents/tools_tests.rs
@@ -0,0 +1,142 @@
+use super::*;
+use std::path::PathBuf;
+
+#[test]
+fn groups_parse_by_id() {
+ for group in SaasToolGroup::ALL {
+ assert_eq!(SaasToolGroup::parse(group.id()), Some(group));
+ }
+ assert_eq!(
+ SaasToolGroup::parse(" host_files "),
+ Some(SaasToolGroup::HostFiles)
+ );
+ assert_eq!(SaasToolGroup::parse("coding"), None);
+}
+
+#[test]
+fn only_the_shell_needs_the_container() {
+ assert!(SaasToolGroup::HostShell.needs_sandbox());
+ assert!(!SaasToolGroup::HostFiles.needs_sandbox());
+}
+
+#[test]
+fn no_group_opens_a_hard_denied_tool() {
+ for group in SaasToolGroup::ALL {
+ for tool in group.tools() {
+ assert!(
+ !is_hard_denied(tool),
+ "{} opens denied `{tool}`",
+ group.id()
+ );
+ }
+ }
+}
+
+#[test]
+fn allowlist_parsing_keeps_groups_and_reports_the_rest() {
+ let entries = vec!["host_shell".to_string(), "coding".to_string()];
+ assert_eq!(parse_allowlist(&entries), vec![SaasToolGroup::HostShell]);
+ assert_eq!(unknown_entries(&entries), vec!["coding".to_string()]);
+}
+
+#[test]
+fn host_tools_need_their_group() {
+ assert!(!admits_with("shell", true, &[]));
+ assert!(!admits_with("file_read", true, &[SaasToolGroup::HostShell]));
+ assert!(admits_with("shell", false, &[SaasToolGroup::HostShell]));
+ assert!(admits_with("edit", false, &[SaasToolGroup::HostFiles]));
+}
+
+#[test]
+fn other_tools_follow_their_domain() {
+ assert!(admits_with("memory_recall", true, &[]));
+ assert!(!admits_with("memory_recall", false, &SaasToolGroup::ALL));
+}
+
+#[test]
+fn hard_denied_tools_never_pass() {
+ for tool in [
+ "install_tool",
+ "service_restart",
+ "mcp_registry_add",
+ "browser_open",
+ "curl",
+ ] {
+ assert!(!admits_with(tool, true, &SaasToolGroup::ALL), "{tool}");
+ }
+}
+
+#[test]
+fn the_gate_allows_only_allowlisted_groups() {
+ assert!(gate_verdict_with("shell", &[SaasToolGroup::HostShell]).is_ok());
+ let refused = gate_verdict_with("shell", &[]).unwrap_err();
+ assert!(refused.contains("no approval surface"), "{refused}");
+ // A domain tool that asks for approval has nowhere to ask in SaaS.
+ assert!(gate_verdict_with("send_email", &SaasToolGroup::ALL).is_err());
+}
+
+#[test]
+fn outside_saas_the_filter_is_the_domain_filter() {
+ assert!(admits("shell", true));
+ assert!(!admits("memory_recall", false));
+}
+
+fn root() -> PathBuf {
+ PathBuf::from("/srv/oh")
+}
+
+#[test]
+fn the_sandbox_policy_is_a_locked_down_container() {
+ let action = root().join("agents/u-abc/sandbox");
+ let state = root().join("agents/u-abc/workspace");
+ let policy =
+ sandbox_policy_with(&root(), &SaasSandboxConfig::default(), &action, &state).unwrap();
+ assert_eq!(policy.backend, SandboxBackendKind::Docker);
+ assert_eq!(policy.workspace_root, action);
+ assert!(!policy.allow_network);
+ assert!(policy.env_passthrough.is_empty());
+ assert!(policy.read_only_mounts.is_empty() && policy.read_write_mounts.is_empty());
+ let docker = policy.docker_overrides.unwrap();
+ assert_eq!(docker.read_only_rootfs, Some(true));
+ assert_eq!(docker.network.as_deref(), Some("none"));
+}
+
+#[test]
+fn a_named_network_allows_egress() {
+ let config = SaasSandboxConfig {
+ network: "egress".into(),
+ ..SaasSandboxConfig::default()
+ };
+ let action = root().join("agents/u-abc/sandbox");
+ let policy = sandbox_policy_with(&root(), &config, &action, &action).unwrap();
+ assert!(policy.allow_network);
+}
+
+#[test]
+fn the_sandbox_refuses_anything_but_a_user_sandbox() {
+ let config = SaasSandboxConfig::default();
+ for dir in [
+ "/srv/oh/agents/u-abc/workspace",
+ "/srv/oh/operator/sandbox",
+ "/srv/oh/agents/sandbox",
+ "/tmp/sandbox",
+ "/srv/oh/agents/u-abc/sandbox/nested",
+ ] {
+ let dir = PathBuf::from(dir);
+ assert!(
+ sandbox_policy_with(&root(), &config, &dir, &dir).is_err(),
+ "{}",
+ dir.display()
+ );
+ }
+}
+
+#[test]
+fn the_host_network_is_refused() {
+ let config = SaasSandboxConfig {
+ network: "host".into(),
+ ..SaasSandboxConfig::default()
+ };
+ let action = root().join("agents/u-abc/sandbox");
+ assert!(sandbox_policy_with(&root(), &config, &action, &action).is_err());
+}