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): judge a symlinked credential store at its target
M3gA-Mind0e8ce2a3d312
diff --git a/crates/openhuman-core/src/sandbox/local_grants.rs b/crates/openhuman-core/src/sandbox/local_grants.rsindex 1f23229220..f246cfc0de 100644--- a/crates/openhuman-core/src/sandbox/local_grants.rs+++ b/crates/openhuman-core/src/sandbox/local_grants.rs@@ -156,6 +156,13 @@ fn admit_grants_under(stores.extend(crate::security::policy::home_credential_stores(&resolved));}}+ // A store that is itself a symlink (`~/.ssh` -> `~/dotfiles/ssh`) is also+ // judged at its target: a grant of that target exposes the same files.+ let targets: Vec<PathBuf> = stores+ .iter()+ .filter_map(|s| s.canonicalize().ok())+ .collect();+ stores.extend(targets);let admit = |raw: String| -> Option<PathBuf> {let path = PathBuf::from(raw);let lexical = path.has_root()@@ -184,13 +191,18 @@ fn admit_grants_under();return None;}- if stores- .iter()- .any(|store| store.starts_with(&path) || store.starts_with(&resolved))- {+ // Containing a store exposes it; lying inside a store's target is+ // reading it, whatever the path's own components are called.+ let overlaps = |store: &PathBuf| {+ store.starts_with(&path)+ || store.starts_with(&resolved)+ || path.starts_with(store)+ || resolved.starts_with(store)+ };+ if stores.iter().any(overlaps) {tracing::warn!(path = %path.display(),- "[sandbox:grants] refused module grant: it contains a credential store"+ "[sandbox:grants] refused module grant: it overlaps a credential store");return None;}diff --git a/crates/openhuman-core/src/sandbox/local_grants_tests.rs b/crates/openhuman-core/src/sandbox/local_grants_tests.rsindex b7def66c5d..eb92e6e85c 100644--- a/crates/openhuman-core/src/sandbox/local_grants_tests.rs+++ b/crates/openhuman-core/src/sandbox/local_grants_tests.rs@@ -72,6 +72,35 @@ mod with_module {assert!(grants.read_write.is_empty(), "{:?}", grants.read_write);}+ #[cfg(unix)]+ #[test]+ fn a_credential_store_symlinked_out_of_home_is_refused_at_its_target() {+ // `~/.ssh` -> `<tmp>/dotfiles/ssh`: the target holds the keys, and none+ // of its own components is called `.ssh`.+ let tmp = tempfile::tempdir().expect("tempdir");+ let home = tmp.path().join("home");+ let dotfiles = tmp.path().join("dotfiles");+ let target = dotfiles.join("ssh");+ let unrelated = tmp.path().join("work");+ for dir in [&home, &target, &unrelated] {+ std::fs::create_dir_all(dir).expect("dir");+ }+ std::os::unix::fs::symlink(&target, home.join(".ssh")).expect("symlink");+ std::fs::write(target.join("id_ed25519"), "key").expect("key file");+ let reply = LocalGrants {+ read_only: vec![+ target.display().to_string(),+ dotfiles.display().to_string(),+ target.join("id_ed25519").display().to_string(),+ unrelated.display().to_string(),+ ],+ read_write: vec![target.display().to_string()],+ };+ let grants = admit_grants_under(reply, false, Some(&home));+ assert_eq!(grants.read_only, [unrelated]);+ assert!(grants.read_write.is_empty(), "{:?}", grants.read_write);+ }+#[test]fn proc_is_admitted_only_through_allow_proc() {let reply = || LocalGrants {