Skip to content

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

feat(security): short-circuit policy checks when security is disabled

Steven Enamakel2f811abd386d
diff --git a/crates/openhuman-core/src/security/policy/command_checks.rs b/crates/openhuman-core/src/security/policy/command_checks.rs
index 0f0018842a..b387d848b7 100644
--- a/crates/openhuman-core/src/security/policy/command_checks.rs
+++ b/crates/openhuman-core/src/security/policy/command_checks.rs
@@ -155,6 +155,9 @@ impl SecurityPolicy {
/// prompts on every acting class; full runs `Read`/`Write` silently but
/// always prompts on `Network`/`Destructive`.
pub fn gate_decision(&self, class: CommandClass) -> GateDecision {
+ if !self.enabled {
+ return GateDecision::Allow;
+ }
match self.autonomy {
AutonomyLevel::ReadOnly => match class {
CommandClass::Read => GateDecision::Allow,
@@ -191,6 +194,9 @@ impl SecurityPolicy {
/// Returns the classified [`CommandClass`] on success.
pub fn check_gated_command(&self, command: &str) -> Result<CommandClass, String> {
let class = self.classify_command(command);
+ if !self.enabled {
+ return Ok(class);
+ }
if self.gate_decision(class) == GateDecision::Block {
return Err(format!(
"{POLICY_BLOCKED_MARKER} Security policy: read-only mode — only read commands are \
@@ -231,6 +237,9 @@ impl SecurityPolicy {
command: &str,
approved: bool,
) -> Result<CommandRiskLevel, String> {
+ if !self.enabled {
+ return Ok(self.command_risk_level(command));
+ }
if !self.is_command_allowed(command) {
// Truncate the command in BOTH the log and the Err return: the Err
// string is bubbled back to the frontend, and a full untruncated
@@ -308,6 +317,9 @@ impl SecurityPolicy {
/// - Blocks output redirections (`>`, `>>`) that could write outside workspace
/// - Blocks dangerous arguments (e.g. `find -exec`, `git config`)
pub fn is_command_allowed(&self, command: &str) -> bool {
+ if !self.enabled {
+ return true;
+ }
if self.autonomy == AutonomyLevel::ReadOnly {
return false;
}