Skip to content

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

refactor(security): use tinyredact for secret scrubbing

Steven Enamakelf8a93df9373a
diff --git a/Cargo.lock b/Cargo.lock
index 6d1a94263d..db3abc39cc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4615,6 +4615,7 @@ dependencies = [
"tinymemory-api",
"tinymemory-integrations",
"tinymemory-tools",
+ "tinyredact",
"tinysearch-bus",
"tinyskills",
"tinystoragedrivers",
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index 71c9333fed..6c93138b88 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -201,6 +201,7 @@ tinytools-std = { path = "../../vendor/tinyagents/vendor/tinytools/crates/tinyto
# `memory::` is the only module that names the engine side.
tinymemory-api = { path = "../../vendor/tinymemory/crates/tinymemory-api", features = ["local-safety"] }
tinymemory-tools = { path = "../../vendor/tinymemory/crates/tinymemory-tools" }
+tinyredact = { path = "../../vendor/tinymemory/crates/tinyredact" }
tinymemory-integrations = { path = "../../vendor/tinymemory/crates/tinymemory-integrations", default-features = false, features = ["cortex", "brain", "sources-network", "safety", "legacy-import"] }
# tinyconnectors-bus — the OAuth connector wire contract
# (https://github.com/tinyhumansai/tinyconnectors). Payload types and member
diff --git a/crates/openhuman-core/src/flows/memory_tools.rs b/crates/openhuman-core/src/flows/memory_tools.rs
index 992ec27ed7..3593128a4f 100644
--- a/crates/openhuman-core/src/flows/memory_tools.rs
+++ b/crates/openhuman-core/src/flows/memory_tools.rs
@@ -460,7 +460,7 @@ impl Tool for FlowMemoryRememberTool {
if key.is_empty() {
return Ok(ToolResult::error("key cannot be empty".to_string()));
}
- if tinymemory_integrations::safety::has_likely_secret(content) {
+ if tinyredact::has_likely_secret(content) {
tracing::warn!(
target: "flows",
key_chars = key.chars().count(),
diff --git a/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs b/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs
index 8cdc12095e..fbc16b1850 100644
--- a/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs
@@ -355,7 +355,7 @@ impl MemoryProvider for OpenHumanMemory {
// up front rather than spend that approval round-trip on a write
// that was always going to be rejected (review fix — see #5227).
let content = value_to_content(&value);
- if tinymemory_integrations::safety::has_likely_secret(&content) {
+ if tinyredact::has_likely_secret(&content) {
tracing::warn!(
target: "flows",
key_chars = key.chars().count(),
diff --git a/crates/openhuman-core/src/security/scrub.rs b/crates/openhuman-core/src/security/scrub.rs
index b8a8dfc9f9..e34ba2770f 100644
--- a/crates/openhuman-core/src/security/scrub.rs
+++ b/crates/openhuman-core/src/security/scrub.rs
@@ -1,14 +1,14 @@
//! Secret and PII scrubbing under the host's policy.
//!
-//! The scrubbers are TinyMemory's (`tinymemory_integrations::safety`); this module pins the
+//! The scrubbers are TinyMemory's (`tinyredact`); this module pins the
//! policy every caller in this process applies, so a memory write, an approval
//! record and an offloaded artifact all redact the same way. The host policy
-//! is [`tinymemory_integrations::safety::Policy::corroborated`]: a bare digit run must look
+//! is [`tinyredact::Policy::corroborated`]: a bare digit run must look
//! like a card (issuer prefix or nearby keyword) before it is redacted, so
//! timestamps and ids survive.
use serde_json::Value;
-use tinymemory_integrations::safety::{Policy, Sanitized};
+use tinyredact::{Policy, Sanitized};
/// The scrubbing policy every caller in this process applies.
#[must_use]
@@ -19,13 +19,13 @@ pub const fn host_policy() -> Policy {
/// Redacts secrets and PII in `value`.
#[must_use]
pub fn sanitize_text(value: &str) -> Sanitized<String> {
- tinymemory_integrations::safety::sanitize_text_with(value, host_policy())
+ tinyredact::sanitize_text_with(value, host_policy())
}
/// Redacts secrets and PII in a JSON value, dropping sensitive keys.
#[must_use]
pub fn sanitize_json(value: &Value) -> Sanitized<Value> {
- tinymemory_integrations::safety::sanitize_json_with(value, host_policy())
+ tinyredact::sanitize_json_with(value, host_policy())
}
#[cfg(test)]
diff --git a/crates/openhuman-core/src/security/scrub_tests.rs b/crates/openhuman-core/src/security/scrub_tests.rs
index 89072618fe..eb712700f6 100644
--- a/crates/openhuman-core/src/security/scrub_tests.rs
+++ b/crates/openhuman-core/src/security/scrub_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use tinymemory_integrations::safety::has_likely_secret;
+use tinyredact::has_likely_secret;
#[test]
fn redacts_an_api_key_in_text() {