Repository navigation
Give OIDC accounts a 64-character random password BCrypt accepts - #323
Merged
Merged
Conversation
Register, Profile and UserEdit gave accounts that log in through OpenID Connect a 255-character random password, which Spring Security 7's BCrypt refuses ("password cannot be more than 72 bytes"), so saving such a profile failed. They now use RollerPasswordEncoders.randomUnusedPassword(), 64 alphanumeric characters from a secure random source.
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.
Register,ProfileandUserEditgive accounts that log in through OpenID Connect a random password they never type. It was 255 characters (RandomStringUtils.randomAlphanumeric(255)), which Spring Security 7'sBCryptPasswordEncoderrefuses with "password cannot be more than 72 bytes", so saving an OIDC user's profile, or an admin's edit of one, failed with the defaultbcryptencryption.They now use the new
RollerPasswordEncoders.randomUnusedPassword(): 64 alphanumeric characters fromRandomStringUtils.secure(), so it fits every encoder and still can't be guessed. Accounts created byRollerOidcUserServicealready got a UUID and are unchanged.Found while testing #322.
RandomUnusedPasswordTestchecks the length, that BCrypt encodes and matches it, and that the three actions use it.mvn testpasses (751 tests).