Skip to content

[Security] Check account isn't locked before user authentication #9622

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

Conversation

craigmarvelley
Copy link

Q A
Bug fix? [no]
New feature? [no]
BC breaks? [no]
Deprecations? [no]
Tests pass? [yes]
Fixed tickets #8510
License MIT
Doc PR N/A

I agreed with the point raised in #8510 that if the user's account is locked we should no longer attempt to authenticate them, assuming that account locking in this case is a response to too many failed login attempts. A malicious user should be prevented from authenticating if they are attempting a brute force attack.

This PR implements the change suggested by @mmucklo in that issue, and updates the UserChecker class' tests appropriately.

@aderuwe
Copy link
Contributor

aderuwe commented Nov 26, 2013

👍

@fabpot
Copy link
Member

fabpot commented Dec 30, 2013

Looking at the code again, things are indeed totally messed up. The real fix would be to actually move everything in checkPreAuth to checkPostAuth and the other way around. See #9902

@fabpot fabpot closed this Dec 30, 2013
fabpot added a commit that referenced this pull request Dec 31, 2013
This PR was merged into the 2.3 branch.

Discussion
----------

[Security] fixed pre/post authentication checks

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8510, #9622
| License       | MIT
| Doc PR        | N/A

After further investigation of #8510, I found that all checks in the `checkPreAuth` actually belongs to `checkPostAuth` and the same goes for checks in `CheckPostAuth` (I checked the original source from Spring and indeed, that's how it is implemented there: see https://github.com/spring-projects/spring-security/blob/master/core/src/main/java/org/springframework/security/authentication/dao/AbstractUserDetailsAuthenticationProvider.java#L305
).

So, this PR fixes that issue. I think that we can do this change safely in 2.3 as the error message is the same for all causes by default (`$hideUserNotFoundExceptions` is `true` by default in `UserAuthenticationProvider`).

The only "real" change is whether the authentication is checked or not.

Commits
-------

ada82a2 [Security] fixed pre/post authentication checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants