Skip to content

Give OIDC accounts a 64-character random password BCrypt accepts - #323

Merged
mraible merged 1 commit into
masterfrom
oidc-placeholder-password-length
Nov 18, 2026
Merged

mraible merged 1 commit into
masterfrom
oidc-placeholder-password-length

Conversation

@mraible

@mraible mraible commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Register, Profile and UserEdit give accounts that log in through OpenID Connect a random password they never type. It was 255 characters (RandomStringUtils.randomAlphanumeric(255)), which Spring Security 7's BCryptPasswordEncoder refuses 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 default bcrypt encryption.

They now use the new RollerPasswordEncoders.randomUnusedPassword(): 64 alphanumeric characters from RandomStringUtils.secure(), so it fits every encoder and still can't be guessed. Accounts created by RollerOidcUserService already got a UUID and are unchanged.

Found while testing #322.

  • RandomUnusedPasswordTest checks the length, that BCrypt encodes and matches it, and that the three actions use it.
  • mvn test passes (751 tests).

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.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review of c154ca8e8: The 64-character password fits BCrypt, and all three 255-character call sites on master use the new generator. The CHANGES entry is in #324.

No issues found.

@mraible
mraible requested a review from snoopdave November 18, 2026 03:21

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved.

@mraible
mraible merged commit bc0216a into master Nov 18, 2026
9 checks passed
@mraible
mraible deleted the oidc-placeholder-password-length branch November 18, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants