-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Exclude remember_me from default login authenticators #60266
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
I think (though I could be wrong) that the test failures are due to flaky tests. |
src/Symfony/Bundle/SecurityBundle/Resources/config/security.php
Outdated
Show resolved
Hide resolved
Thanks for the PR. As said in the linked issue, I'm rather π on this as the proposed |
Thanks for your feedback @chalasr , and you're right, I should have consulted you before proceeding with the implementation. I understand your concerns about approach Do you think there's a different approach that might still address the underlying need, or would it make more sense to close this pull request? |
If you agree to work on the suggested alternative which is to patch the |
Yeah, I'm fine with that alternative, so I'll go ahead and make the change next weekend. |
ed18bb4
to
9d20d21
Compare
Hi @chalasr! π I've updated the branch with the patch to the login() method. Since this is a patch to the login behavior, I changed the base branch from 7.3 to 6.4, and also updated the title and description of the PR to reflect the changes. If there's anything else I need to address, please let me know! Thanks β€οΈ Edit: I was also thinking about adding a new condition here to check if the passed authenticatorName is remember_me. If so, it could trigger a deprecation notice in 7.4, and throw an error in version 8.0. What do you think about that approach? For Symfony 7.4: if (in_array($authenticatorName, self::SECURITY_LOGIN_EXCLUSIONS)) {
trigger_deprecation('symfony/security-bundle', '7.4', 'The "%s" authenticator is not allowed to be used with the "%s" method. Use a different authenticator.', $authenticatorName, __METHOD__));
} For Symfony 8.0: if (in_array($authenticatorName, self::SECURITY_LOGIN_EXCLUSIONS)) {
throw new LogicException(sprintf('The "%s" authenticator is not allowed to be used with the "%s" method. Use a different authenticator.', $authenticatorName, __METHOD__));
} |
2248bb8
to
4f93320
Compare
Would it be an option to always pick the first authenticator from the retrieved list of authenticators and not just when there is only one authenticator configured? (Basically remove these lines https://github.com/symfony/symfony/blob/7.3/src/Symfony/Bundle/SecurityBundle/Security.php#L179-L181) |
Required explicitness is desired in this domain IMHO, better get a good error message than a security hole. |
I get your point but I don't think it is worth it right now, we can rethink about it the day it happens |
4f93320
to
fabc0e3
Compare
fabc0e3
to
6ea76ca
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.
Authenticating through the remember_me
authenticator was never meant to work at it's a very special one. π to remove the ambiguity as a bugfix
Thank you @santysisi. |
π Bugfix Description:
This fix addresses an issue where the remember_me authenticator was incorrectly included in the list of authenticators used during the security login process. When only one authenticator was configured and it was remember_me, the login flow could break or behave unexpectedly, as remember_me is not intended to be used as a primary authenticator. The login() method has been updated to exclude remember_me from the list, ensuring proper handling of login attempts and avoiding unintended authentication behavior.