Skip to main content

redact_secrets

Function redact_secrets 

Source
pub fn redact_secrets(input: String) -> String
Expand description

Redact secrets and sensitive keys from a string.

This is a best-effort operation using well-known regex patterns. Redacted values are replaced with [REDACTED_SECRET].

ยงExamples

use vtcode_commons::sanitizer::redact_secrets;

let input = format!("Found key: {}", concat!("sk-", "test1234567890abcdef"));
let output = redact_secrets(input);
assert_eq!(output, "Found key: [REDACTED_SECRET]");