-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Verifying if the password field is null #36925
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
Conversation
Shine-neko
commented
May 23, 2020
•
edited
Loading
edited
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | Fix #36926 |
License | MIT |
Shouldn't we rather check how the credentials could end up being |
I think I agree with @xabbuh here. I think this should be fixed in |
A similar thing ? https://gist.github.com/Shine-neko/76f97ee46950a480074434fa3259f797/revisions |
Yes, seems good. Although I think the error message can be changed, so we can give the developer guidelines on how to fix it (e.g. adding the expected password parameter named - |
Any news? It looks the gist code is more in line with what we should do. |
cb5e269
to
564361e
Compare
@fabpot done |
src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php
Outdated
Show resolved
Hide resolved
564361e
to
cfc946a
Compare
@@ -95,6 +95,10 @@ protected function attemptAuthentication(Request $request) | |||
throw new BadCredentialsException('Invalid username.'); | |||
} | |||
|
|||
if (null === $password) { | |||
throw new \LogicException(sprintf('The key "%s" cannot be null.', $this->options['password_parameter'])); |
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.
Maybe try to explain the problem?
sprintf('The key password cannot be null; check that the password field name of the form matches "%s".', $this->options['password_parameter'], $this->options['password_parameter']);
cfc946a
to
d9d9cec
Compare
d9d9cec
to
e4a14ac
Compare
Thank you @Shine-neko. |
This PR was merged into the 5.2-dev branch. Discussion ---------- [Security] Fix tests | Q | A | ------------- | --- | Branch? | master <!-- see below --> | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | N/A <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | N/A Fixes https://travis-ci.org/github/symfony/symfony/jobs/719243848#L6234-L6242 (relates to #36925) Commits ------- e04386c [Security] Fix tests