Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:2.7fromchalasr:username-non-string
Jan 16, 2018

Conversation

@chalasr
Copy link
Member

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#25612
LicenseMIT
Doc PRn/a

That's consistent with what#22569 did for thejson_login listener.

acasademont, sospedra, and mahmoodbazdar reacted with hooray emoji
@xabbuh
Copy link
Member

I think we should do the same with the provided password.

derrabus reacted with thumbs up emoji

$password =$requestBag->get($this->options['password_parameter'],null,true);

if (!is_string($username)) {
thrownewBadRequestHttpException(sprintf('The key "%s" must be a string.',$this->options['username_parameter']));
Copy link
Member

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?

derrabus and Simperfit reacted with thumbs up emoji
Copy link
MemberAuthor

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)) {
thrownewBadRequestHttpException(sprintf('The key "%s" must be a string.',$this->options['username_parameter']));
Copy link
Contributor

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

got it :) needs work

@xabbuh
Copy link
Member

@chalasr tests are failing

@chalasr
Copy link
MemberAuthor

@xabbuh done. Objects implementing__toString() do work for both username and password before this PR, and the UsernamePasswordToken$credentials argument (password)allows formixed, should we care?

@xabbuh
Copy link
Member

@chalasr I also wonder if not passing credentials at all must be supported here.

@chalasrchalasrforce-pushed theusername-non-string branch 5 times, most recently frome9e6818 tod7e615fCompareJanuary 12, 2018 14:46
@acasademont
Copy link
Contributor

Thanks for the patch! I was going to submit the same issue ;)

@chalasr
Copy link
MemberAuthor

@xabbuh I think so, password part reverted and__toString handling added for username.

array('require_previous_session' =>false)
);

$event =$this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock();
Copy link
Member

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

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

fixed

@chalasr
Copy link
MemberAuthor

Ready

@fabpot
Copy link
Member

Thank you@chalasr.

@fabpotfabpot merged commit8f09568 intosymfony:2.7Jan 16, 2018
fabpot added a commit that referenced this pull requestJan 16, 2018
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/aThat's consistent with what#22569 did for the `json_login` listener.Commits-------8f09568 [Security] Fix fatal error on non string username
@chalasrchalasr deleted the username-non-string branchJanuary 16, 2018 07:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@fabpotfabpotfabpot approved these changes

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@SimperfitSimperfitSimperfit approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

8 participants

@chalasr@xabbuh@acasademont@fabpot@javiereguiluz@Simperfit@alexandre-le-borgne@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp