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
fix(sandbox): refuse a module grant that contains a credential store
M3gA-Mind6441fae530c2
diff --git a/crates/openhuman-core/src/sandbox/local_grants.rs b/crates/openhuman-core/src/sandbox/local_grants.rsindex b65ba909b3..fbaf112c01 100644--- a/crates/openhuman-core/src/sandbox/local_grants.rs+++ b/crates/openhuman-core/src/sandbox/local_grants.rs@@ -126,13 +126,20 @@ pub(crate) fn grant_request(}}-/// Second gate: drop every returned path the host floor forbids. `/proc` is-/// the one sanctioned exception, and only when `allow_proc` is set.+/// Second gate: drop every returned path the host floor forbids, and every+/// path that contains one of the operator's credential stores (a grant of+/// `$HOME` or `/` reaches `~/.ssh`, and Landlock cannot carve it back out).+/// `/proc` is the one sanctioned exception to the floor, and only when+/// `allow_proc` is set.#[cfg(feature = "modules")]pub(crate) fn admit_module_grants(reply: crate::modules::tinybox::contract::LocalGrants,allow_proc: bool,) -> JailGrants {+ let stores = grant_home(crate::core::runtime::is_saas(), dirs::home_dir)+ .as_deref()+ .map(crate::security::policy::home_credential_stores)+ .unwrap_or_default();let admit = |raw: String| -> Option<PathBuf> {let path = PathBuf::from(raw);let sanctioned_proc = allow_proc && path == std::path::Path::new("/proc");@@ -143,6 +150,13 @@ pub(crate) fn admit_module_grants();return None;}+ if stores.iter().any(|store| store.starts_with(&path)) {+ tracing::warn!(+ path = %path.display(),+ "[sandbox:grants] refused module grant: it contains a credential store"+ );+ return None;+ }Some(path)};JailGrants {diff --git a/crates/openhuman-core/src/sandbox/local_grants_tests.rs b/crates/openhuman-core/src/sandbox/local_grants_tests.rsindex 065656131d..ca05598aae 100644--- a/crates/openhuman-core/src/sandbox/local_grants_tests.rs+++ b/crates/openhuman-core/src/sandbox/local_grants_tests.rs@@ -41,6 +41,23 @@ mod with_module {);}+ #[test]+ fn a_grant_containing_a_credential_store_is_refused() {+ let home = dirs::home_dir().expect("a home directory");+ let project = home.join("project");+ let reply = LocalGrants {+ read_only: vec![+ home.display().to_string(),+ "/".into(),+ project.display().to_string(),+ ],+ read_write: vec![home.display().to_string()],+ };+ let grants = admit_module_grants(reply, false);+ assert_eq!(grants.read_only, [project]);+ assert!(grants.read_write.is_empty(), "{:?}", grants.read_write);+ }+#[test]fn proc_is_admitted_only_through_allow_proc() {let reply = || LocalGrants {