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 = "API key is sk-abc123xyz789".to_string();
let output = redact_secrets(input);
assert_eq!(output, "API key is [REDACTED_SECRET]");