Merge pull request #24336 from owncloud/issue-24328-remove-password-from-exception-trace-in-dav-auth

Remove the password from the validateUserPass() method as well
This commit is contained in:
Thomas Müller 2016-05-02 14:33:07 +02:00
commit fd844f3eb3
2 changed files with 16 additions and 1 deletions

View File

@ -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);

View File

@ -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);
}
}
}