Repository navigation
Upgrade passwords stored with an older encoding at login - #301
Merged
Merged
Conversation
passwds.encryption.lazyUpgradeFrom let passwords from older Roller versions verify, but nothing stored them again, so they stayed in the old encoding however often their owners logged in. RollerUserDetailsService now implements UserDetailsPasswordService, and RollerContext gives it to the database login provider, so Spring Security stores the password with passwds.encryption.algorithm after a successful login. Nothing is stored while passwds.encryption.enabled is off, since the re-encoding would then be plain text. The password encoder factory moves from RollerContext to RollerPasswordEncoders so the new PasswordUpgradeTest can log in with the encoder Roller uses.
snoopdave
reviewed
Nov 16, 2026
The guard only checked passwds.encryption.enabled, but passwds.encryption.algorithm=noop with encryption enabled also re-encodes as {noop}, which would have stored plain text after a login. RollerUserDetailsService now skips any re-encoded password that starts with {noop}, which covers both settings. PasswordUpgradeTest adds a case for algorithm=noop.
Contributor
Author
|
Tested at f69e6f9 on a copy of a real site whose accounts still have 40-character unprefixed SHA-1 hashes: built alone on master, MySQL 8.4,
Not covered: XML-RPC and AtomPub logins (they verify old hashes but don't re-hash them), and the |
mraible
added a commit
to mraible/roller
that referenced
this pull request
Nov 17, 2026
Rebased on apache#301, SecurityConfig gives the database login provider the user service as its UserDetailsPasswordService. SecurityConfigTest logs in through the filter chain as a user with an unsalted SHA-1 hash and checks that the stored password becomes {bcrypt}.
mraible
added a commit
to mraible/roller
that referenced
this pull request
Nov 17, 2026
Rebased on apache#301, SecurityConfig gives the database login provider the user service as its UserDetailsPasswordService. SecurityConfigTest logs in through the filter chain as a user with an unsalted SHA-1 hash and checks that the stored password becomes {bcrypt}.
mraible
added a commit
to mraible/roller
that referenced
this pull request
Nov 17, 2026
Rebased on apache#301, SecurityConfig gives the database login provider the user service as its UserDetailsPasswordService. SecurityConfigTest logs in through the filter chain as a user with an unsalted SHA-1 hash and checks that the stored password becomes {bcrypt}.
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.
passwds.encryption.lazyUpgradeFrom(SHAby default) lets passwords from older Roller versions verify, but nothing stored them again, so they stayed in the old encoding however often their owners logged in. On a 7.0.0 RC1 site withalgorithm=bcryptandlazyUpgradeFrom=SHA, all nine accounts still had their 40-character unsalted SHA-1 hashes after repeated successful logins.Spring Security re-encodes a password after a successful login only when the login provider has a
UserDetailsPasswordService, and Roller's didn't.RollerUserDetailsServicenow implementsUserDetailsPasswordServiceand saves the re-encoded password.RollerContextgives it to the database login provider, next to the password encoder.{noop}), which happens whilepasswds.encryption.enabledis off orpasswds.encryption.algorithmisnoop. Otherwise a login would turn bcrypt hashes into stored passwords.RollerContexttoRollerPasswordEncoders, so the test can use the same encoder. Configure Spring Security in Java instead of security.xml #300 makes the same move.PasswordUpgradeTestlogs in through Spring'sDaoAuthenticationProvideragainst the test database, with a user whose password is an unprefixed SHA-1 hash:{bcrypt}hash, the next login still works, and an up-to-date hash isn't rewritten;algorithm=noop, nothing is stored.The first test fails without the change.
mvn installpasses on JDK 21 (735 tests, 1 skipped).