8000 [symfony/security-bundle] set encoder to "auto" for all UserInterface by default by nicolas-grekas · Pull Request #576 · symfony/recipes · GitHub
[go: up one dir, main page]

Skip to content

[symfony/security-bundle] set encoder to "auto" for all UserInterface by default #576

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

Closed
wants to merge 1 commit into from
Closed

Conversation

nicolas-grekas
Copy link
Member
Q A
License MIT

Needs symfony/symfony#31140

ping @weaverryan WDYT?

Copy link
@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request passes validation.

in_memory: { memory: ~ }
encoders:
Symfony\Component\Security\Core\User\UserInterface:
algorithm: auto
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# configure password encoding logic (if your app needs to encode passwords)
encoders:
    # Any User class will automatically use the best-available password hashing algorithm
    Symfony\Component\Security\Core\User\UserInterface:
        algorithm: auto

This requires a bit more explanation than I like. First, adding this section for everyone, even if it's pretty common not to need a hashing algo, isn't ideal. But, I think it's not too big of a deal.

The bigger thing is that the Symfony\Component\Security\Core\User\UserInterface config isn't immediately obvious... it's not terrible, but I need to explain to you that "Hey! All classes implement this interface, and because this is a class-based map that respects interfaces, all user classes will use this algorithm". Of course... the user might think "what do you mean about all user classES, should I have multiple"?

A few possible ideas:

  1. Add a special default key under encoders

and/or

  1. Let MakerBundle / the docs add this section for the user. I don't think causes a real security issue, as MakerBundle and the docs will recommend auto.

and my unrelated point (3)... rename encoders to password_encoders ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, if we do a renaming in 5.0, we should actually move away from encoder. We are hashing password hopefully, not encoding them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to leave it now, properly think about things for 4.4/5.0

@nicolas-grekas
Copy link
Member Author

Renaming encoders to something else is another story someone needs to pursue.

Thanks for the feedback: maker + doc will do the trick, no need for the recipe. I like it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0