Skip to content

Commit 15edfd3

Browse files
bug #36223 [Security][Http][SwitchUserListener] Ignore all non existent username protection errors (fancyweb)
This PR was merged into the 4.4 branch. Discussion ---------- [Security][Http][SwitchUserListener] Ignore all non existent username protection errors | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #36174 | License | MIT | Doc PR | - Since we generate the non existent username blindly, it can lead to Doctrine exceptions or any other exception. We can catch all exceptions here but I guess it reduces the protection since the SQL query was not executed? Alternative: we can only catch Doctrine DriverException (in addition to the existing AuthenticationException) and only silent the reported error codes? Commits ------- 42311d5 [Security][Http][SwitchUserListener] Ignore all non existent username protection errors
2 parents be0515f + 42311d5 commit 15edfd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private function attemptSwitchUser(Request $request, string $username): ?TokenIn
168168

169169
try {
170170
$this->provider->loadUserByUsername($nonExistentUsername);
171-
} catch (AuthenticationException $e) {
171+
} catch (\Exception $e) {
172172
}
173173
} catch (AuthenticationException $e) {
174174
$this->provider->loadUserByUsername($currentUsername);

0 commit comments

Comments
 (0)