Skip to content

Commit 48d31a3

Browse files
committed
project update version 63493
1 parent 70064ff commit 48d31a3

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

lib/common/classes/TlMainFileLogWriter.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,39 @@ protected function getContextMessage()
1414
$s .= "$key: $info\n";
1515
}
1616
}
17-
return $s . parent::getContextMessage();
17+
18+
$msg = parent::getContextMessage();
19+
$msg = preg_replace_callback(
20+
"/'email_address' => '(.*)'/",
21+
function ($matches) {
22+
$email = $matches[1];
23+
$start = substr($email, 0, 2);
24+
$end = substr($email, -2);
25+
$maskedEmail = $start . str_repeat('*', 5) . $end;
26+
return "'email_address' => '" . $maskedEmail . "'";
27+
},
28+
$msg
29+
);
30+
$msg = preg_replace(
31+
"/'password' => '(.*)'/",
32+
sprintf("'password' => '%s'", str_repeat('*', 5)),
33+
$msg
34+
);
35+
// remove any other emails
36+
$msg = preg_replace_callback(
37+
"/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/",
38+
function ($matches) {
39+
$email = $matches[0];
40+
$start = substr($email, 0, 2);
41+
$end = substr($email, -2);
42+
$maskedEmail = $start . str_repeat('*', 5) . $end;
43+
return $maskedEmail;
44+
},
45+
$msg
46+
);
47+
48+
49+
return $s . $msg;
1850
}
1951

2052
}

0 commit comments

Comments
 (0)