New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security] Fix UserNotFoundException is not thrown #45452
Conversation
damienfa
commented
Feb 17, 2022
•
edited by nicolas-grekas
edited by nicolas-grekas
Q | A |
---|---|
Branch? | 5.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | Fix #45070 |
License | MIT |
Doc PR | N/A |
Hey! I think @IonBazan has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
Can you please rebase to target 5.4, and add a test case?
@@ -66,6 +67,13 @@ public function getUser(): UserInterface | |||
} | |||
|
|||
$user = ($this->userLoader)($this->userIdentifier); | |||
|
|||
// No user has been found via the $this->userLoader callback. | |||
if (is_null($user)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (null === $user) {
Can you please add a test case, and rebase + target 5.4 also? |
don't have time to thoroughly check the pr and how does the |
@wouterj Can you have a look at this PR? |
With the suggested CS changes, this change looks good to me (for 5.4+).
This code is within the user enumeration control of the authenticator manager - so nothing to worry about concerning that.
if (is_null($user)) { | ||
($exception = new UserNotFoundException())->setUserIdentifier($this->userIdentifier); | ||
throw $exception; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (is_null($user)) { | |
($exception = new UserNotFoundException())->setUserIdentifier($this->userIdentifier); | |
throw $exception; | |
if (null === $user) { | |
$exception = new UserNotFoundException(); | |
$exception->setUserIdentifier($this->userIdentifier); | |
throw $exception; |
Thank you @damienfa. |