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] 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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

santysisi
Copy link
Contributor

@santysisisantysisi commentedApr 25, 2025
edited
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#60221
LicenseMIT

🐛 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.

@santysisi
Copy link
ContributorAuthor

I think (though I could be wrong) that the test failures are due to flaky tests.

@chalasr
Copy link
Member

chalasr commentedApr 27, 2025
edited
Loading

Thanks for the PR. As said in the linked issue, I'm rather 👎 on this as the proposeddefault_authenticator option doesn't have any effect outside the context of aSecurity::login() call and its name doesn't convey this which makes it confusing to me. Even if we make it obvious in the option name, I feel like a global option is not appropriate here as the usage oflogin() is usually marginal in an app.

@santysisi
Copy link
ContributorAuthor

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?

@chalasr
Copy link
Member

If you agree to work on the suggested alternative which is to patch thelogin() method to basically make it excluderemember_me from the retrieved list of authenticators so it works seamlessly in case there's only one authenticator with rememberme configured, I'm fine with repurposing this very PR.

Spomky reacted with thumbs up emoji

@santysisi
Copy link
ContributorAuthor

Yeah, I'm fine with that alternative, so I'll go ahead and make the change next weekend.
Thank you for your suggestion.

chalasr reacted with thumbs up emoji

@santysisisantysisiforce-pushed thefeature/default-authenticator branch fromed18bb4 to9d20d21CompareApril 29, 2025 00:17
@santysisisantysisi changed the base branch from7.3 to6.4April 29, 2025 00:18
@santysisisantysisi changed the title[Security] allow configuring a default authenticator[Security] Exclude remember_me from default login authenticatorsApr 29, 2025
@santysisi
Copy link
ContributorAuthor

santysisi commentedApr 29, 2025
edited
Loading

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 conditionhere 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:
We could trigger a deprecation when an excluded authenticator (like remember_me) is passed:

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:
We can escalate this to a logic error to prevent usage entirely

if (in_array($authenticatorName,self::SECURITY_LOGIN_EXCLUSIONS)) {thrownewLogicException(sprintf('The "%s" authenticator is not allowed to be used with the "%s" method. Use a different authenticator.',$authenticatorName,__METHOD__));}
chalasr reacted with rocket emoji

@santysisisantysisiforce-pushed thefeature/default-authenticator branch 3 times, most recently from2248bb8 to4f93320CompareApril 29, 2025 01:14
@rosier
Copy link
Contributor

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 lineshttps://github.com/symfony/symfony/blob/7.3/src/Symfony/Bundle/SecurityBundle/Security.php#L179-L181)

@chalasr
Copy link
Member

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 lineshttps://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.

rosier reacted with thumbs up emoji

@chalasr
Copy link
Member

I was also thinking about adding a new conditionhere 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?

I get your point but I don't think it is worth it right now, we can rethink about it the day it happens

santysisi reacted with thumbs up emojisantysisi reacted with heart emoji

@santysisisantysisiforce-pushed thefeature/default-authenticator branch from4f93320 tofabc0e3CompareMay 9, 2025 21:01
@santysisisantysisiforce-pushed thefeature/default-authenticator branch fromfabc0e3 to6ea76caCompareMay 9, 2025 21:27
Copy link
Member

@chalasrchalasr left a comment
edited
Loading

Choose a reason for hiding this comment

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

Authenticating through theremember_me authenticator was never meant to work at it's a very special one. 👍 to remove the ambiguity as a bugfix

rosier reacted with thumbs up emojisantysisi reacted with heart emoji
@fabpotfabpot modified the milestones:7.3,6.4May 14, 2025
@fabpot
Copy link
Member

Thank you@santysisi.

@fabpotfabpot merged commite417f12 intosymfony:6.4May 14, 2025
11 checks passed
This was referencedMay 25, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@94noni94noni94noni left review comments

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

6 participants
@santysisi@chalasr@rosier@fabpot@94noni@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp