From 3397e27657f67ed68ae506ced5759e73e26a9188 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 29 Apr 2016 09:23:36 +0200 Subject: Remove the password from the validateUserPass() method as well --- lib/private/Log.php | 2 +- tests/lib/logger.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/private/Log.php b/lib/private/Log.php index bbdad9cf166..d82346bbcf0 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -284,7 +284,7 @@ class Log implements ILogger { 'File' => $exception->getFile(), 'Line' => $exception->getLine(), ); - $exception['Trace'] = preg_replace('!(login|checkPassword|updatePrivateKeyPassword)\(.*\)!', '$1(*** username and password replaced ***)', $exception['Trace']); + $exception['Trace'] = preg_replace('!(login|checkPassword|updatePrivateKeyPassword|validateUserPass)\(.*\)!', '$1(*** username and password replaced ***)', $exception['Trace']); $msg = isset($context['message']) ? $context['message'] : 'Exception'; $msg .= ': ' . json_encode($exception); $this->error($msg, $context); diff --git a/tests/lib/logger.php b/tests/lib/logger.php index 9c9cd9e6728..e6a0abfbf28 100644 --- a/tests/lib/logger.php +++ b/tests/lib/logger.php @@ -107,4 +107,19 @@ class Logger extends TestCase { $this->assertContains('checkPassword(*** username and password replaced ***)', $logLine); } } + + /** + * @dataProvider userAndPasswordData + */ + public function testDetectvalidateUserPass($user, $password) { + $e = new \Exception('test'); + $this->logger->logException($e); + $logLines = $this->getLogs(); + + foreach($logLines as $logLine) { + $this->assertNotContains($user, $logLine); + $this->assertNotContains($password, $logLine); + $this->assertContains('validateUserPass(*** username and password replaced ***)', $logLine); + } + } } -- cgit v1.2.3