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
feat(security): redact credentials in screened input
Steven Enamakelc054eb7a542f
diff --git a/crates/openhuman-core/src/agent/session_host/driver.rs b/crates/openhuman-core/src/agent/session_host/driver.rsindex a3dd6383d7..7fc35dbcf1 100644--- a/crates/openhuman-core/src/agent/session_host/driver.rs+++ b/crates/openhuman-core/src/agent/session_host/driver.rs@@ -79,6 +79,14 @@ impl SessionDriver<OpenHumanRunContext> for OpenHumanSessionDriver {&self,mut request: DriverRequest<OpenHumanRunContext>,) -> Result<DriverOutcome, DriverFailure> {+ // The generic runtime has already admitted the current message by the+ // time it reaches the driver, but its durable seed is still the raw+ // request history. Scrub user text before every early snapshot/return+ // path so cancellation cannot persist a credential the provider gate+ // has already redacted.+ if !request.run_context.data.untrusted_input_turn {+ scrub_user_history(&mut request.history);+ }// Heal a head persisted before #6721 was fixed, before anything reads// the history: this turn then commits a clean generation.repair_orphaned_tool_head(&mut request.history);@@ -508,6 +516,18 @@ impl SessionDriver<OpenHumanRunContext> for OpenHumanSessionDriver {}}+fn scrub_user_history(history: &mut [Message]) {+ for message in history {+ if let Message::User(user) = message {+ for block in &mut user.content {+ if let tinyinference_llm::message::ContentBlock::Text(text) = block {+ *text = tinyinference_core::sanitize::scrub_credentials(text);+ }+ }+ }+ }+}+fn system_prefix_len(history: &[Message]) -> usize {history.iter()diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rsindex a29f37f6a5..56fc671c5b 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs@@ -47,12 +47,8 @@//! this gate must not also compose `ApprovalSecurityMiddleware`'s approval//! step** — the two are alternatives, not layers. The session-allowlist//! shortcut yields no id and needs no terminal row.-//! 3. **No `Redacted` outcome is ever produced.** OpenHuman can *detect* PII-//! ([`tinymemory_api::safety::scan`]) but exposes no verified-//! public helper that rewrites free text into a redacted copy — the one that-//! exists (`approval::redact::scrub_paths`) is private and shaped for JSON-//! argument maps. Screening therefore only ever passes or blocks. See the-//! `TODO(phase4)` in [`OpenHumanSecurityGate::screen_input`].+//! 3. Credential redaction uses TinyInference's shared credential scrubber,+//! the same implementation used by the hosted credential middleware.//! 4. **An absent approval gate allows, it does not deny.** When//! [`ApprovalGate::try_global`] is `None` (CLI, headless embed, tests) a//! `Prompt` decision cannot be resolved by a human. This adapter warnsdiff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rsindex 0875ff229d..853fba85e7 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@@ -54,12 +54,8 @@ impl SecurityGate for OpenHumanSecurityGate {/// The reason string carries the verdict and the rule codes only — never/// the screened text, which is the thing suspected of being hostile.///- /// TODO(phase4): no [`ScreenOutcome::Redacted`] is ever returned. Producing- /// one needs a free-text redactor; `tinymemory_api::safety::scan` detects spans but- /// returns no rewritten string, and `approval::redact::scrub_paths` is- /// private and shaped for JSON argument maps. Either lift a public- /// `redact_text(&str) -> String` out of `approval::redact` or add one to- /// `tinymemory_api::safety`, then map "PII found, injection clean" to `Redacted`.+ /// Credential patterns are rewritten by TinyInference's shared scrubber,+ /// which is also used by OpenHuman's credential-scrub middleware.async fn screen_input(&self, text: &str, origin: ContentOrigin) -> TaResult<ScreenOutcome> {if !self.screens_input {return Ok(ScreenOutcome::Pass);@@ -83,7 +79,14 @@ impl SecurityGate for OpenHumanSecurityGate {);match decision.action {- PromptEnforcementAction::Allow => Ok(ScreenOutcome::Pass),+ PromptEnforcementAction::Allow => {+ let redacted = tinyinference_core::sanitize::scrub_credentials(text);+ if redacted == text {+ Ok(ScreenOutcome::Pass)+ } else {+ Ok(ScreenOutcome::Redacted(redacted))+ }+ }PromptEnforcementAction::Blocked | PromptEnforcementAction::ReviewBlocked => {let codes: Vec<&str> = decision.reasons.iter().map(|r| r.code.as_str()).collect();tracing::warn!(