Introduce a function that redacts passwords in URIs

This commit is contained in:
Michael Klishin 2017-08-29 14:47:58 -06:00
parent 7262b5c65d
commit 140d604b0e
1 changed files with 10 additions and 0 deletions

View File

@ -567,6 +567,16 @@ function fmt_shortened_uri(uri) {
}
}
function fmt_uri_with_credentials(uri) {
if (typeof uri == 'string') {
// mask password
var mask = /^([a-zA-Z0-9]+):\/\/(.*):(.*)@/;
return uri.replace(mask, "$1://$2:[redacted]@");
} else {
return UNKNOWN_REPR;
}
}
function fmt_client_name(properties) {
var res = [];
if (properties.product != undefined) {