Skip to content

Commit

Permalink
fix: username sanitized twice in UserAuth::authUser()
Browse files Browse the repository at this point in the history
Remove usage of filter_var on username in UserAuth::authUser() as
it's already done before.
  • Loading branch information
dfranco committed Dec 29, 2023
1 parent e81b25e commit 61c8330
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions core/App/UserAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,7 @@ public function checkSchema(): void
*/
public function authUser(string $username, string $password): string
{
// TODO: FILTER_SANITIZE_STRING is deprecated as of PHP 8.1, replace by htmlspecialchars() instead

// Sanitize username
$username = filter_var($username, FILTER_SANITIZE_STRING, array( 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
$username = trim($username, ' ');

$user = $this->userTable->findByName($username);

if ($user) {
Expand Down

0 comments on commit 61c8330

Please sign in to comment.