Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/private/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class Log implements ILogger {
'loginWithPassword',
'updatePrivateKeyPassword',
'validateUserPass',
'loginWithToken',
'\{closure\}',

// TokenProvider
'getToken',
Expand All @@ -90,6 +92,10 @@ class Log implements ILogger {
//LoginController
'tryLogin',
'confirmPassword',

// Encryption
'storeKeyPair',
'setupUser',
];

/**
Expand Down
26 changes: 26 additions & 0 deletions tests/lib/LoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,32 @@ public function testDetecttryLogin($user, $password) {
}
}

/**
* @dataProvider userAndPasswordData
*/
public function testDetectclosure($user, $password) {
$a = function($user, $password) {
throw new \Exception('test');
};

try {
$a($user, $password);
} catch (\Exception $e) {
$this->logger->logException($e);
}
$logLines = $this->getLogs();

foreach($logLines as $logLine) {
$log = explode('\n', $logLine);
unset($log[1]); // Remove `testDetectclosure(` because we are not testing this here, but the closure on stack trace 0
$logLine = implode('\n', $log);

$this->assertNotContains($user, $logLine);
$this->assertNotContains($password, $logLine);
$this->assertContains('{closure}(*** sensitive parameters replaced ***)', $logLine);
}
}

public function dataGetLogClass() {
return [
['file', \OC\Log\File::class],
Expand Down