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][SecurityBundle] Show user account status errors#58300

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
chalasr merged 1 commit intosymfony:7.3fromcore23:fix-auth-exception-handling-72
Jan 31, 2025

Conversation

core23
Copy link
Contributor

@core23core23 commentedSep 18, 2024
edited by OskarStark
Loading

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
IssuesFix#50028
LicenseMIT

According to thehideUserNotFoundExceptions flag, onlyUserNotFoundException should be hidden, but the implementation was also silencing account specific errors.

To fix the issue in a BC way, a newhide_account_status_exceptions config key was introduced to show account exceptions.

This key should be changed tofalse with an upcoming version (7.3 or 7.4?), so that the existinghide_user_not_found config key works as intended with the upcoming symfony 8 release.

@carsonbotcarsonbot added this to the7.2 milestoneSep 18, 2024
@core23core23force-pushed thefix-auth-exception-handling-72 branch 3 times, most recently from80060ea to71408c1CompareSeptember 18, 2024 06:12
@chalasr
Copy link
Member

From#56830 (review)

This should target 7.2 as this is a new feature.
@chalasr can you please have another look?
I don't like adding new options so if there's a way without, suggestions welcome :)

@nicolas-grekas unless we decide to revert a security fix we cannot avoid the option I think

Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

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

We need an entry in both SecurityBundle and Security\Http's CHANGELOG files

return true;
}

if ($this->showAccountStatusExceptions) {
Copy link
Member

Choose a reason for hiding this comment

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

I would expectCustomAuthenticationMessageExceptions to show up even ifshowAccountStatusExceptions is false, as it's the case today withhideUserNotFoundExceptions

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Not sure how to deal with theCustomAuthenticationMessageExceptions as this is no account specific exception (extendsAccountStatusException), but a general authentication exception (extendsAuthenticationException).

The new key is namedhide_account_status_exceptions, so this might be confusing.

@wouterj
Copy link
Member

wouterj commentedSep 18, 2024
edited
Loading

I don't like adding new options so if there's a way without, suggestions welcome :)

Maybe an unpopular opinion: I'm not sure if I would implement this feature in Symfony at all.

This is part of code that was released with theuser enumeration CVE. With the new option set to true, you'll reintroduce the possibility of user enumeration based on error messages as you now get "Invalid credentials" (user does not exists) or "This account is locked" (account status error).

Thehide_user_not_found option name might be a bit of a vague name, but it determines whether you want some default user enumeration prevention or not. If a business decides it wants partial user enumeration (by hiding only user not found exceptions), you can already achieve this by settinghide_user_not_found: false and implementing your own authentication failure handler that hides onlyUserNotFoundException.

I'm not convinced we need to provide an extra option to achieve this (especially because we consider the new feature less secure).

@core23
Copy link
ContributorAuthor

This is part of code that was released with theuser enumeration CVE. With the new option set to true, you'll reintroduce the possibility of user enumeration based on error messages as you now get "Invalid credentials" (user does not exists) or "This account is locked" (account status error).

I agree, in theory you could use this to enumerate all users that have anaccount status error, butuser does not exist errors are still silenced with solution. But you may also enumerate users by the time it takes to generate the response at all, if you want to use all possible ways ;)

The current solution looks broken to me. You either expose ALL user information or no user feedback at all. There is no way to inform the user, that it is currently not possible to login with the user. The current solution resulted in several service desk tickets that I need to check every time.

What about creating a new enum config key with three different states like:expose_security_errors: none|account|all?

@chalasr
Copy link
Member

Renaming/changing the existing option looks sensible to me as account status errors means that a user is actually found.

@carsonbotcarsonbot changed the titleShow user account status errors[Security][SecurityBundle] Show user account status errorsSep 19, 2024
@core23core23force-pushed thefix-auth-exception-handling-72 branch 2 times, most recently fromc16c852 tob5b742dCompareSeptember 20, 2024 19:17
@core23
Copy link
ContributorAuthor

Changed the config key tohide_account_status_exceptions and applied the proposed changes.

@core23core23force-pushed thefix-auth-exception-handling-72 branch 2 times, most recently from6792899 to6347ad7CompareSeptember 20, 2024 19:27
@core23
Copy link
ContributorAuthor

Anything left to do@chalasr ?

@chalasr
Copy link
Member

Sorry for the back and forths but I think there is confusion about my last comment:

Renaming/changing the existing option looks sensible to me as account status errors means that a user is actually found.

I agree with Wouter this is not worth a dedicated option, but I do think it's worth renaming the existinghide_user_not_found_exceptions option for clarity to make it take an enum as you proposed in#58300 (comment). It should still handle true/false and behave the same as today for BC until 8.0.

@core23
Copy link
ContributorAuthor

So you're fine with deprecating the existinghide_user_not_found_exceptions option in favor of something likeexpose_security_errors with the statesnone,account,all?

And if you are using the newoption, it should override thehide_user_not_found_exceptions setting?

@chalasr
Copy link
Member

Yes. The new option should win over the to-be-deprecated one when it's explicitly set (to not change the behavior of apps explicitly setting the old option to false). The new option should default toall to keep the same default behavior as today.

@wouterj are you ok with the proposed plan?

@wouterj
Copy link
Member

wouterj commentedOct 25, 2024
edited
Loading

Ok, let's go with an enum option with these conditions (maybe worth calling the middle oneaccount_status to be super clear on what errors are exposed).

I guess the easiest BC way would be removing the default value from the current option adding adding the new option with an'all' default value. Then, in the extension use the old option if it's defined (which means the user has configured it explicitly) + a deprecation notice. Otherwise - if the old option was not configured - use the new option.
When the old option is used, the extension can then transform true to'all' and false to'none'.

@chalasr
Copy link
Member

Sounds good 👍

@core23core23force-pushed thefix-auth-exception-handling-72 branch from6347ad7 toac57b42CompareOctober 29, 2024 16:12
@core23core23force-pushed thefix-auth-exception-handling-72 branch from5222ad3 to6baf154CompareDecember 15, 2024 14:18
@core23
Copy link
ContributorAuthor

Thanks for the review@stof :)

Applied your suggestions and the build is passing

@chalasr
Copy link
Member

@core23 Can you please update the UPGRADE-7.3 file about the deprecated option? And add a line about that deprecation in the already updated CHANGELOG file also?

@core23core23force-pushed thefix-auth-exception-handling-72 branch fromf9b8d7e to011efe1CompareJanuary 6, 2025 16:59
@core23
Copy link
ContributorAuthor

Done :)

@core23core23force-pushed thefix-auth-exception-handling-72 branch from011efe1 toa565f64CompareJanuary 7, 2025 07:13
@core23
Copy link
ContributorAuthor

core23 commentedJan 30, 2025
edited
Loading

Any chance to get this merge soon-ish?@chalasr

Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

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

Can you please rebase?

@core23
Copy link
ContributorAuthor

Done. The failing tests look unrelated to the changes

@chalasrchalasrforce-pushed thefix-auth-exception-handling-72 branch from7538e44 to5a11de5CompareJanuary 31, 2025 13:26
@chalasr
Copy link
Member

Thank you@core23.

core23 reacted with heart emoji

@chalasrchalasr merged commita7a32f7 intosymfony:7.3Jan 31, 2025
8 of 11 checks passed
@core23core23 deleted the fix-auth-exception-handling-72 branchJanuary 31, 2025 14:13
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofAwaiting requested review from stof

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

Locked account produces "Invalid credentials" message
7 participants
@core23@chalasr@wouterj@stof@fabpot@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp