Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Security] Make it possible to inherit MessageDigestPasswordHasher#41696
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
stof commentedJun 14, 2021
What do you mean by "it breaks them" ? This private method is in a new class, not in an existing class. |
ampaze commentedJun 14, 2021
Well if your application usesMessageDigestPasswordEncoder then an overwrittenmergePasswordAndSalt method will never be used, as the code was copied toMessageDigestPasswordHasher andMessageDigestPasswordEncoder now usesMessageDigestPasswordHasher viaLegacyEncoderTrait
So then the next step is, like the deprecation message suggest, to useMessageDigestPasswordHasher directly. But asmergePasswordAndSalt is private, mergePasswordAndSalt cannot also not be overwritten. Both cases break current apps that need to overwrite mergePasswordAndSalt. |
stof commentedJun 14, 2021
If MessageDigestPasswordEncoder broke its extension point, then this is indeed a bug that should be fixed. However, I'm not sure we should make |
ampaze commentedJun 14, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I am not sure what the advantage of using private methods or All it does is to force me to duplicate code. Making the method |
stof commentedJun 14, 2021
Making the method protected has a maintenance cost, as it forces us to preserve BC on it, forbidding us to refactor things in some ways (for instance, here, we will have to revert the usage of the LegacyEncoderTrait in that class). |
ampaze commentedJun 14, 2021
I see. Well I tried 😉 Should I close this PR? |
derrabus commentedJun 14, 2021
As explained by@stof, this PR is not a bugfix. And I agree with his suggestion to implement the new interface directly. |
stof commentedJun 14, 2021
@derrabus we should still fix the regression in MessageDigestPasswordEncoder which was refactored to use the LegacyEncoderTrait without accounting for the fact that it was extendable with a protected method though. |
derrabus commentedJun 14, 2021
…dEncoder (derrabus)This PR was merged into the 5.3 branch.Discussion----------[Security] Restore extension point in MessageDigestPasswordEncoder| Q | A| ------------- | ---| Branch? | 5.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |#41696 (comment)| License | MIT| Doc PR | N/AUntil Symfony 5.2, it was possible to extend `MessageDigestPasswordEncoder` and override the way password and salt are merged. This broke with#39802. I've restored the old logic and added a test case to cover that scenario.Commits-------4568876 [Security] Restore extension point in MessageDigestPasswordEncoder
Uh oh!
There was an error while loading.Please reload this page.
Symfony 5.3 breaks existing installations that inherit MessageDigestPasswordEncoder (MessageDigestPasswordHasher) because the mergePasswordAndSalt method is private and thus cannot be overwritten.