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] 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

Closed
ampaze wants to merge1 commit intosymfony:5.3fromampaze:patch-1
Closed

Conversation

@ampaze
Copy link
Contributor

@ampazeampaze commentedJun 14, 2021
edited
Loading

QA
Branch?5.3
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

Symfony 5.3 breaks existing installations that inherit MessageDigestPasswordEncoder (MessageDigestPasswordHasher) because the mergePasswordAndSalt method is private and thus cannot be overwritten.

@stof
Copy link
Member

What do you mean by "it breaks them" ? This private method is in a new class, not in an existing class.

@carsonbotcarsonbot changed the titleMake it possible to inherit MessageDigestPasswordHasher[Security] Make it possible to inherit MessageDigestPasswordHasherJun 14, 2021
@ampaze
Copy link
ContributorAuthor

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
Copy link
Member

If MessageDigestPasswordEncoder broke its extension point, then this is indeed a bug that should be fixed.

However, I'm not sure we should makemergePasswordAndSalt an extension point in the new component. I'd rather tagMessageDigestPasswordHasher as@final. If a project wants to roll its own crypto, making it implement the full interface seems better to me (as that should not be encouraged anyway)

@ampaze
Copy link
ContributorAuthor

ampaze commentedJun 14, 2021
edited
Loading

I am not sure what the advantage of using private methods or@final is?

All it does is to force me to duplicate code. Making the methodprotected solves this and brings no disadvantages that I can see.

@stof
Copy link
Member

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).
And inheritance-based extension points are actually the more costly ones in term of backward compatibility maintenance.

sstok reacted with thumbs up emoji

@ampaze
Copy link
ContributorAuthor

I see. Well I tried 😉

Should I close this PR?

@derrabus
Copy link
Member

As explained by@stof, this PR is not a bugfix. And I agree with his suggestion to implement the new interface directly.

@stof
Copy link
Member

@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 reacted with thumbs up emoji

@derrabus
Copy link
Member

@stof#41703

@ampazeampaze deleted the patch-1 branchJune 14, 2021 17:12
nicolas-grekas added a commit that referenced this pull requestJun 17, 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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

5.3

Development

Successfully merging this pull request may close these issues.

5 participants

@ampaze@stof@derrabus@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp