-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Add migrating encoder configuration #34139
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
Conversation
chalasr
commented
Oct 27, 2019
•
edited
Loading
edited
Q | A |
---|---|
Branch? | 4.4 |
Bug fix? | no |
New feature? | yes |
Deprecations? | no |
Tickets | - |
License | MIT |
Doc PR |
7a88b0b
to
e34b87d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the migrating_from
option is needed at all: instead, we should always wire a MigratingPasswordEncoder
when Sodium/Native encoder variants are selected.
There is one thing that is not documented correctly: when auto
is selected, hash_algorithm
is used as the digest algo too. But this should be fixed on 4.3, so it's unrelated to this PR.
Please don't take control away from the user (again)? 🙏 |
🤦♂️ which control would this take away from users? |
src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/migrating_encoder.xml
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/migrating_encoder.xml
Outdated
Show resolved
Hide resolved
That's where I disagree. Let's say one have App\User:
algorithm: bcrypt
hash_algorithm: sha1
encode_as_base64: false # also required because of the old encoder config It's really not obvious what this means to me, it just feels like hijacking existing options to achieve what a new clearly-named option would do: migrate from a specific algo. Hence I think we should rather improve the situation than documenting what currently kinda works by chance. Built-in password migrations are great to make developers able to move forward and stop relying on old algos, I think that the support for this feature should be exhaustive and obvious for anyone reading the config, which is definitely not the case right now. |
4993792
to
b14b993
Compare
PR updated, the option now accepts encoder names in addition to algo names: encoders:
foo:
id: App\FooEncoder
digest_sha256:
algorithm: sha256
encode_as_base64: false
App\User:
algorithm: argon2id
migrate_from:
- foo
- digest_sha256
- bcrypt # creates an encoder with default config options |
b14b993
to
6344ac3
Compare
6344ac3
to
c2fce3c
Compare
@nicolas-grekas as discussed, sodium and native encoders are now always migrating. |
ec235d3
to
6b2df8c
Compare
6b2df8c
to
80955be
Compare
Thank you @chalasr. |
This PR was merged into the 4.4 branch. Discussion ---------- [Security] Add migrating encoder configuration | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | Commits ------- 80955be [Security] Add migrating encoder configuration