Skip to content

Commit

Permalink
Merge pull request #26346 from J0WI/clean-auth-regex
Browse files Browse the repository at this point in the history
Cleaner removePassword regex
  • Loading branch information
blizzz authored Jun 23, 2021
2 parents c6d5653 + 5f468c0 commit ee7a484
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/private/Log/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ErrorHandler {
* @return string
*/
protected static function removePassword($msg) {
return preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $msg);
return preg_replace('#//(.*):(.*)@#', '//xxx:xxx@', $msg);
}

public static function register($debug = false) {
Expand Down
10 changes: 7 additions & 3 deletions tests/lib/ErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ class ErrorHandlerTest extends \Test\TestCase {
*/
public function passwordProvider() {
return [
['user', 'password'],
['user@owncloud.org', 'password'],
['user', 'pass@word'],
['us:er', 'pass@word'],
['us:er', 'password'],
['user', '-C:R,w)@6*}'],
['user', 'pass:word'],
['user', 'pass@word'],
['user', 'password'],
['user:test@cloud', 'password'],
['user@owncloud.org', 'password'],
['user@test@owncloud.org', 'password'],
];
}

Expand Down

0 comments on commit ee7a484

Please sign in to comment.