Skip to content

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

fix(security): enforce policy checks on untracked paths

Steven Enamakel175fa882d0f3
diff --git a/crates/openhuman-core/src/security/policy/enforcement.rs b/crates/openhuman-core/src/security/policy/enforcement.rs
index 37b1901d69..650a2a5398 100644
--- a/crates/openhuman-core/src/security/policy/enforcement.rs
+++ b/crates/openhuman-core/src/security/policy/enforcement.rs
@@ -102,6 +102,23 @@ impl SecurityPolicy {
autonomy_config: &crate::config::AutonomyConfig,
workspace_dir: &Path,
action_dir: &Path,
+ ) -> Self {
+ Self::from_config_with(
+ crate::core::runtime::is_saas(),
+ autonomy_config,
+ workspace_dir,
+ action_dir,
+ )
+ }
+
+ /// [`from_config`](Self::from_config) with the process mode passed in, so
+ /// the SaaS grants (no shared projects home, no shared `/tmp/openhuman`)
+ /// are testable without the process-wide mode lock.
+ pub(crate) fn from_config_with(
+ saas: bool,
+ autonomy_config: &crate::config::AutonomyConfig,
+ workspace_dir: &Path,
+ action_dir: &Path,
) -> Self {
log::info!(
"[openhuman:policy] SecurityPolicy created: autonomy={:?}, workspace_only={}, allowed_cmds={}, max_actions/hr={}, auto_approve_all={}",
@@ -133,7 +150,6 @@ impl SecurityPolicy {
// carry an in-memory edit anyway. A user-granted entry is left as-is.
// SaaS: the projects home and `/tmp/openhuman` are shared by every user
// of the process, so neither is granted there.
- let saas = crate::core::runtime::is_saas();
let mut trusted_roots = autonomy_config.trusted_roots.clone();
let projects_path = crate::config::default_projects_dir()
.to_string_lossy()