sanitize_connection_string

Function sanitize_connection_string 

Source
pub fn sanitize_connection_string(connection_string: &str) -> String
Expand description

Sanitizes a connection string by replacing the password with asterisks.

This prevents passwords from leaking in error messages, logs, or stack traces.

§Arguments

  • connection_string - The connection string to sanitize

§Returns

A sanitized connection string with the password replaced by “****”

§Example

use json_register::sanitize_connection_string;
let sanitized = sanitize_connection_string("postgres://user:secret@localhost:5432/db");
assert_eq!(sanitized, "postgres://user:****@localhost:5432/db");