Skip to main content

Module sanitizer

Module sanitizer 

Source
Expand description

Secret sanitization utilities for redacting sensitive information.

Provides regex-based secret redaction for:

  • OpenAI API keys (sk-...)
  • AWS Access Key IDs (AKIA...)
  • Bearer tokens (Bearer ...)
  • Generic secret assignments (api_key=..., password:..., etc.)

Use this module to sanitize text before logging, displaying in UI, or storing in session archives.

Structs§

StreamingSecretRedactor
Incrementally redact streamed output without retaining the full stream.

Constants§

PROVIDER_DIAGNOSTIC_MAX_BYTES
Maximum serialized size of a provider diagnostic after redaction.

Functions§

redact_secrets
Redact secrets and sensitive keys from a string.
sanitize_provider_diagnostic
Redact secrets and return a bounded, UTF-8-safe provider diagnostic.