Repository navigation
fix: record the password credential on successful password logins (ovcs) - #4226
Merged
Merged
Conversation
Keycloak 26.7 clears a user's brute-force failures after a login only when the login recorded a counted credential type (password, OTP, recovery codes): AuthenticationManager.logSuccess passes the credentials the flow recorded through context.success(type), and DefaultBruteForceProtector .successfulLogin returns without clearing when there are none. 26.6.1 cleared them for an untyped success too. MultiAttributePasswordAuthenticator, its direct-grant variant and UsernamePasswordFormWithExpiry check the password and then called context.success(), so a correct login through them no longer reset the voter's failure count: found on a 26.7.5 env, where a voter who had mistyped a PIN stayed at one failure after logging in. They now call context.success(PasswordCredentialModel.TYPE), as Keycloak's own UsernamePasswordForm and ValidatePassword do. success(String) exists on 26.6.1 as well. MessageOTPAuthenticator is left as is: it checks a code sent by message against its own credential model, not Keycloak's OTP credential, and records no brute-force failures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 2
Please check the settings in the CodeRabbit UI or the
|
UsernamePasswordFormWithExpiry skips the password check when its disablePassword option is on, but still reported a password login through context.success(PasswordCredentialModel.TYPE). Conditional-credential steps and brute-force accounting read the credential type a login recorded, so that login looked like one that had checked a password. The form now records the password only when it checked one, and calls context.success() otherwise. The Direct Grant tests' failure and lockout paths check again that the no-argument success() isn't called either, besides success(any()). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keycloak 26.7 clears a user's brute-force failures after a successful login only when the login recorded a counted credential type. The multi-attribute password authenticators (browser form and direct grant) and
UsernamePasswordFormWithExpirycalledcontext.success()without one, so onovcs(Keycloak 26.7.0) a correct login through them no longer resets the user's failure count. They now callcontext.success(PasswordCredentialModel.TYPE), as Keycloak's ownUsernamePasswordFormdoes;UsernamePasswordFormWithExpiryrecords none when itsdisablePasswordoption skips the password check.MessageOTPAuthenticatoris unchanged: it checks its own message code, not a Keycloak credential.Same change as C28's release PRs (#3577 for 10.0, #3739 for 10.1). Found on a 10.1 env with Keycloak 26.7.5: after one wrong PIN on a shared date of birth, a correct login left the voter at one failure.
Validation: the browser and direct-grant test classes check the typed success on a correct login, and a new
UsernamePasswordFormWithExpiryTestcovers the form; CI runs the Java tests. Merges cleanly with C26's openovcsPR (#4110) in either order, and no test expects the untyped call after that merge.Related: https://github.com/sequentech/meta/issues/13862
🤖 Generated with Claude Code