Skip to content

[Security] Fix RememberMe with null password #35335

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

Merged
merged 1 commit into from
Jan 20, 2020

Conversation

jderusse
Copy link
Member

@jderusse jderusse commented Jan 14, 2020

Q A
Branch? 5.0
Bug fix? yes
New feature? no
Deprecations? yes
Tickets NA
License MIT
Doc PR NA

From UserInterface the method getPassword may return null, while generateCookieHash requires a string.
This PR changes the signature of the methods to allows null password

@jderusse jderusse changed the title Fix RememberMe with null password [Security] Fix RememberMe with null password Jan 14, 2020
@nicolas-grekas nicolas-grekas added this to the 5.0 milestone Jan 14, 2020
@nicolas-grekas
Copy link
Member

Does this cause any issue? We're not using string mode, so it shouldn't, isn't it? Beside this, IF there is an issue, the same code exists on 3.4 :)

@nicolas-grekas nicolas-grekas modified the milestones: 5.0, 3.4 Jan 14, 2020
@jderusse
Copy link
Member Author

jderusse commented Jan 14, 2020

Yes it triggers:

TypeError: Argument 4 passed to 
Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices::generateCookieHash() 
must be of the type string, null given

It's not an issue before 5.0 because method generateCookieHash were not typehinted with string.
Another way to fix it is to replace typehint by ?string

@nicolas-grekas
Copy link
Member

Oh, ok. Then we need to change the docblock on 3.4+, and make this nullable on 5.0. That's the most sensible option to me, from an historical perspective, don't you think?

chalasr added a commit that referenced this pull request Jan 16, 2020
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Fix RememberMe with null password

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | yes
| Tickets       | NA
| License       | MIT
| Doc PR        | NA

From `UserInterface` the method getPassword may return null, while generateCookieHash requires a string.
This PR changes the signature of the methods to allows null password

Similar to #35335 for branch 3.4

Commits
-------

820eb35 Fix RememberMe with null password
@nicolas-grekas nicolas-grekas modified the milestones: 3.4, 5.0 Jan 20, 2020
@nicolas-grekas
Copy link
Member

Thank you @jderusse.

nicolas-grekas added a commit that referenced this pull request Jan 20, 2020
This PR was merged into the 5.0 branch.

Discussion
----------

[Security] Fix RememberMe with null password

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | yes
| Tickets       | NA
| License       | MIT
| Doc PR        | NA

From `UserInterface` the method getPassword may return null, while generateCookieHash requires a string.
This PR changes the signature of the methods to allows null password

Commits
-------

a7d0d82 Fix RememberMe with null password
@nicolas-grekas nicolas-grekas merged commit a7d0d82 into symfony:5.0 Jan 20, 2020
@fabpot fabpot mentioned this pull request Jan 21, 2020
@jderusse jderusse deleted the remember-pass-null branch March 5, 2020 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants