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

[PasswordHasher] Use sodium as "best" hasher if with algorithm=auto#41646

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
pableu wants to merge1 commit intosymfony:5.3frompableu:sodium-default-auto
Closed

[PasswordHasher] Use sodium as "best" hasher if with algorithm=auto#41646

pableu wants to merge1 commit intosymfony:5.3frompableu:sodium-default-auto

Conversation

@pableu
Copy link
Contributor

@pableupableu commentedJun 9, 2021
edited
Loading

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

According tothe docs, settingpassword_hashers.xxx.algorithm=auto should prefer Sodium to native (bcrypt) if available:

it tries to use Sodium by default and falls back to the bcrypt password hashing function if not possible.

But this is not what's actually happening. New passwords are hashed with bcrypt ($2y$) instead of Argon2ID ($argon2id$). TheMigratingPasswordHasher gets an instance ofNativePasswordHasher instead ofSodiumPasswordHasher as first parameter ($bestHasher).

I think this is a simple mixup and the fix seems easy enough.

But I haven't found a good way to write a test for it:

  • I can't get the "best hasher" out of theMigratingPasswordHasherto run an assertion on it
  • PasswordHasherFactory::getHasherConfigFromAlgorithm is private, otherwise I could simply test its output

I'm open for ideas. Or can we merge the fix without a test?

@chalasr
Copy link
Member

Thank you for the PR.

New passwords are hashed with bcrypt ($2y$) instead of Argon2ID ($argon2id$).

I'm sorry but this is intended, we switched back to bcrypt as default algorithm in 5.3 (see rationale in#40176) so I'm going to close this PR.

The bug seems to be in the docs, which is weird as it was changed insymfony/symfony-docs#14992. That's probably a merge that went wrong.

Fixing the docs again would be great if you can.
Thanks for your understanding.

@chalasrchalasr closed thisJun 9, 2021
@pableupableu deleted the sodium-default-auto branchJune 9, 2021 19:36
@pableu
Copy link
ContributorAuthor

Oh, thedocs are wrong. Okay, I didn't realize that, thanks for the explanation.#40176 sent me down an interesting rabbit hole ;-)

I'll try to create a PR for the docs in the next few days. I'll basically just have to re-applysymfony/symfony-docs#14992, seems easy enough.

xabbuh reacted with heart emoji

@chalasr
Copy link
Member

Thanks! In case you struggle with something, just ping me on the symfony-devs slack :)

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestJun 11, 2021
…(pableu)This PR was merged into the 5.3 branch.Discussion----------[Security] Update description of password hasher configThe description of the password hashers in the reference isn't up to date for Symfony 5.3."Auto" now always uses bcrypt (see#14980 and#14992), but it  wasn't reflected here. I initially thought this was a bug in the password hasher component itself and created asymfony/symfony#41646, but I've since learned that the switch to bcrypt was intentional :-)I updated all the hasher descriptions a bit and removed the part about sodium before PHP 7.2 because Symfony 5.3 requires PHP >= 7.2. I also added an extra paragraph for the bcrypt hasher because it was a bit mixed into the description of the "auto" hasher.Commits-------d404d19 [Security] update description of password hasher config
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.

3 participants

@pableu@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp