The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(mcp): add sandbox enforcement mode to stdio config
Steven Enamakel4acb15cb22f7
diff --git a/crates/openhuman-core/src/mcp/host_sandbox.rs b/crates/openhuman-core/src/mcp/host_sandbox.rsindex 6fbd77624f..7ac1168c0b 100644--- a/crates/openhuman-core/src/mcp/host_sandbox.rs+++ b/crates/openhuman-core/src/mcp/host_sandbox.rs@@ -21,7 +21,7 @@use std::path::{Path, PathBuf};-use tinymcp_bus::StdioSandboxConfig;+use tinymcp_bus::{StdioSandboxConfig, StdioSandboxEnforcement};use crate::config::Config;use crate::security::SecurityPolicy;@@ -60,6 +60,7 @@ pub(super) fn stdio_sandbox(config: &Config) -> Option<StdioSandboxConfig> {allow_net: true,allow_subprocess: true,require_process_isolation: isolated,+ enforcement: enforcement(isolated),})}@@ -112,6 +113,19 @@ pub(super) fn require_process_isolation(saas: bool) -> bool {saas || !cfg!(target_os = "macos")}+/// How the module treats a backend that cannot meet the isolation floor+/// (`StdioSandboxEnforcement`, tinymcp contract 1.27). Where the host accepts a+/// best-effort backend (the macOS desktop's Seatbelt) the jail is `Declared`,+/// so the module starts the server instead of refusing the best-effort+/// backend; everywhere else it is `Enforced`.+pub(super) fn enforcement(isolated: bool) -> StdioSandboxEnforcement {+ if isolated {+ StdioSandboxEnforcement::Enforced+ } else {+ StdioSandboxEnforcement::Declared+ }+}+fn merge(into: &mut Vec<String>, extra: &[PathBuf]) {for path in extra {let path = path_string(path);diff --git a/crates/openhuman-core/src/mcp/host_sandbox_tests.rs b/crates/openhuman-core/src/mcp/host_sandbox_tests.rsindex 19a2078813..f5533f8e9e 100644--- a/crates/openhuman-core/src/mcp/host_sandbox_tests.rs+++ b/crates/openhuman-core/src/mcp/host_sandbox_tests.rs@@ -59,3 +59,31 @@ fn a_grant_that_contains_a_credential_store_is_not_admitted() {));assert!(!exposes_credentials(Path::new("/home/user"), None));}++#[test]+fn enforcement_is_declared_only_where_the_host_accepts_a_best_effort_backend() {+ assert_eq!(enforcement(true), StdioSandboxEnforcement::Enforced);+ assert_eq!(enforcement(false), StdioSandboxEnforcement::Declared);+ assert_eq!(+ enforcement(require_process_isolation(true)),+ StdioSandboxEnforcement::Enforced,+ "a SaaS tenant is always enforced"+ );+ let desktop = enforcement(require_process_isolation(false));+ if cfg!(target_os = "macos") {+ assert_eq!(desktop, StdioSandboxEnforcement::Declared);+ } else {+ assert_eq!(desktop, StdioSandboxEnforcement::Enforced);+ }+}++#[cfg(feature = "modules")]+#[test]+fn built_sandbox_enforcement_follows_the_isolation_requirement() {+ let tmp = tempfile::tempdir().unwrap();+ let sandbox = stdio_sandbox(&config_in(tmp.path())).expect("a sandbox");+ assert_eq!(+ sandbox.enforcement,+ enforcement(sandbox.require_process_isolation)+ );+}