Skip to main content

Module redaction

Module redaction 

Source
Expand description

Redaction logic for sensitive data in strings, errors, and logs.

This module provides functionality to redact sensitive information from text, including API keys, tokens, passwords, and other secrets. It uses a cached approach for environment variable redaction to avoid repeatedly scanning all environment variables.

§Invariants

  • Sensitive environment variable values are cached at first access using a thread-safe RwLock
  • The cache is never refreshed during runtime; environment variable changes after first redaction call will not be detected
  • All redaction functions are pure (no side effects except cache initialization)

Structs§

RedactedLogger
A log::Log implementation that wraps another logger and redacts all log messages.
RedactedString
A wrapper around String that applies redaction when displayed via Display or Debug.

Functions§

is_path_like_env_key
looks_sensitive_env_key
redact_text