Changed password config regex

The password regex searches for password assignments, extracts the
password and replaces it with a dummy value to prevent it being logged.

This change adjusts the password regex to no longer accept trailing
characters behind the password string
This commit is contained in:
Lenard Hess 2023-02-26 18:54:19 +01:00 committed by Reuben Thomas
parent ae905b3baf
commit 2af841acdb

View file

@ -1614,7 +1614,7 @@ sub _read_config {
$content .= "$_\n" unless /^#/; $content .= "$_\n" unless /^#/;
## parsing passwords is special ## parsing passwords is special
if (/^([^#]*\s)?([^#]*?password\S*?)\s*=\s*('.*'|[^']\S*)(.*)/) { if (/^([^#]*\s)?([^#]*?password)\s*=\s*('.*'|[^']\S*)(.*)/) {
my ($head, $key, $value, $tail) = ($1 // '', $2, $3, $4); my ($head, $key, $value, $tail) = ($1 // '', $2, $3, $4);
$value = $1 if $value =~ /^'(.*)'$/; $value = $1 if $value =~ /^'(.*)'$/;
$passwords{$key} = $value; $passwords{$key} = $value;