Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(audit): redact cookie, credential, and private-key audit keys
DeryFerd03e19e0f01d3
diff --git a/crates/host-core/src/audit.rs b/crates/host-core/src/audit.rsindex 69baf4be8..80393ea1d 100644--- a/crates/host-core/src/audit.rs+++ b/crates/host-core/src/audit.rs@@ -65,6 +65,10 @@ fn redact_value_internal(value: Value, depth: usize) -> Value {|| key_l.contains("authorization")|| key_l.contains("token")|| key_l.contains("password")+ || key_l.contains("cookie")+ || key_l.contains("credential")+ || key_l.contains("private_key")+ || key_l.contains("privatekey"){out.insert(k, Value::String("***REDACTED***".into()));} else if is_path_key(&key_l) {@@ -249,6 +253,21 @@ mod tests {assert_eq!(value["apiKey"], "***REDACTED***");}+ #[test]+ fn redacts_spec_named_credential_keys() {+ let value = redact_value(json!({+ "cookie": "session=abc123",+ "credentials": "user:pass",+ "privateKey": "-----BEGIN PRIVATE KEY-----",+ "private_key": "-----BEGIN PRIVATE KEY-----",+ "sessionId": "keep-me",+ }));+ for key in ["cookie", "credentials", "privateKey", "private_key"] {+ assert_eq!(value[key], "***REDACTED***", "{key} must be redacted");+ }+ assert_eq!(value["sessionId"], "keep-me");+ }+#[test]fn truncates_long_audit_strings() {let value = redact_value(json!({"detail": "x".repeat(3_000)}));