-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Fix fatal error on non string username #25657
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
9da049f
to
6894e56
Compare
I think we should do the same with the provided password. |
$password = $requestBag->get($this->options['password_parameter'], null, true); | ||
|
||
if (!is_string($username)) { | ||
throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['username_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.
This kind of messages in Symfony are usually like:
sprintf('The XXX must be a string, "%s" given.', gettype($XXX))
Is it necessary to do the same here?
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.
done
$password = $requestBag->get($this->options['password_parameter'], null, true); | ||
|
||
if (!is_string($username)) { | ||
throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['username_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.
as javiere said I think we should change both message too.
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.
got it :) needs work
6894e56
to
4205e5e
Compare
4205e5e
to
a3e17da
Compare
@chalasr tests are failing |
@xabbuh done. Objects implementing |
a3e17da
to
15ecf24
Compare
@chalasr I also wonder if not passing credentials at all must be supported here. |
e9e6818
to
d7e615f
Compare
Thanks for the patch! I was going to submit the same issue ;) |
@xabbuh I think so, password part reverted and |
array('require_previous_session' => false) | ||
); | ||
|
||
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); |
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.
I would not mock the event
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.
fixed
d7e615f
to
8f09568
Compare
Ready |
Thank you @chalasr. |
This PR was merged into the 2.7 branch. Discussion ---------- [Security] Fix fatal error on non string username | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25612 | License | MIT | Doc PR | n/a That's consistent with what #22569 did for the `json_login` listener. Commits ------- 8f09568 [Security] Fix fatal error on non string username
That's consistent with what #22569 did for the
json_login
listener.