Skip to main content

mask_sensitive_value

Function mask_sensitive_value 

Source
pub fn mask_sensitive_value(key: &str, value: &str) -> String
Expand description

Return a display-safe representation of a configuration value.

If key (case-insensitive) contains any of the sensitive markers (api_key, token, secret), the value is replaced with a masked form:

  • Values of 4 characters or fewer are fully masked as ****.
  • Longer values keep their last 4 characters prefixed by **** to help users identify which key is configured without leaking it.

Non-sensitive keys return the value unchanged.