Sanitize()
Detects and masks sensitive information (such as passwords, API keys, tokens, etc.) from a given string. The function identifies patterns commonly used for sensitive data and replaces them with a mask.
Sanitize( text=string, replacement=string );
Returns: String
| Argument | Description | Default |
|---|---|---|
|
text
string,
required
|
edit
The input string to be sanitized. Alias: string |
|
|
replacement
string,
optional
|
edit
The replacement string to use as a mask for sensitive data. If not specified, defaults to "****". Alias: mask |
|
Examples
edit input = "User login with password:secretPass123";
//Default replacement
writeDump(sanitize(input));
//With the replacement mask
writeDump(sanitize(input,"-----"));
See also
- Encode/Decode
- string.second()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)