Skip to content

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

fix(security-gate): skip credential scrubbing for non-user origins

Steven Enamakel572054657e4b
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
index c6a63c9530..c9d7550862 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
@@ -81,6 +81,15 @@ impl SecurityGate for OpenHumanSecurityGate {
match decision.action {
PromptEnforcementAction::Allow => {
+ // Tool output has already crossed OpenHuman's tool-aware
+ // credential middleware. Re-running the generic scrubber
+ // here would redact the browser's host-minted confirmation
+ // token in a NeedsConfirmation response. Keep this gate's
+ // credential rewrite on user input; other origins retain the
+ // injection screen while their owning adapter handles secrets.
+ if origin != ContentOrigin::User {
+ return Ok(ScreenOutcome::Pass);
+ }
let redacted = tinyinference_core::sanitize::scrub_credentials(text);
if redacted == text {
Ok(ScreenOutcome::Pass)
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
index ba1fd053ce..5e1db3376b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
@@ -216,6 +216,23 @@ async fn screen_input_redacts_credentials_without_changing_screening_policy() {
assert_eq!(untrusted, ScreenOutcome::Pass);
}
+#[tokio::test]
+async fn tool_screening_preserves_host_confirmation_tokens() {
+ let gate = gate(AutonomyLevel::Full);
+ let token = "00000000-0000-4000-8000-000000000123";
+ let response = format!(
+ r#"{{"status":"NeedsConfirmation","pending":{{"token":"{token}"}}}}"#
+ );
+
+ let outcome = gate
+ .screen_input(&response, ContentOrigin::Tool)
+ .await
+ .unwrap();
+
+ assert_eq!(outcome, ScreenOutcome::Pass);
+ assert_eq!(outcome.effective_text(&response), Some(response.as_str()));
+}
+
/// A refused approval must reach the model as a Deny with a reason. Returned
/// as `Prompted { approved: false }` it carried none, and the harness fell back
/// to a bare "tool call was not approved" — after which the model redid the