Repository navigation
Conversation
…unt is disabled RollerSession now keeps a SHA-256 digest of the user's stored password hash from when the session logged in. On each lookup it reloads the user and, if the user is gone, disabled, or has a different password hash, it invalidates the HTTP session, clears the Spring SecurityContext for the request, and continues with an empty session, so the browser has to log in again. The check runs before the session-cache check, which would otherwise rebuild the session from the existing login. Profile.save and UserEdit.save (when an administrator edits their own account) refresh the digest of the session that made the change, so that session stays logged in.
This was referenced Nov 18, 2026
snoopdave
reviewed
Nov 18, 2026
…out a sign-in change Profile.save and UserEdit.save generated a new random stored password for OIDC accounts on every save, so with the session check a profile-only edit ended the user's other sessions. They now generate one only when the account has no stored password or its OpenID URL changes. PasswordChangeSessionTest covers a profile edit and an administrator edit of an OIDC account with another session open, and switching an account to OpenID.
…s dropped When the container passivates a session, RollerSession removes itself from it, and the next request rebuilt it from the login with the user's current password, so the session survived a password change. The session now keeps the login's user name and password digest in a separate attribute that outlives the Roller session, and a rebuild for that user ends the session when the password differs. PasswordChangeSessionTest covers a passivated session after a password change and one without a change.
… of the form A password over 72 bytes in UTF-8, for example 20 emoji, made BCrypt throw when Register, Profile or UserEdit saved it, so the user got an error page. The forms now check the length first and say the password is too long. Register also put the random password it generates for OIDC users in the form's hidden password fields, so a registration that failed validation, for example on a taken user name, sent it back to the browser. It now keeps that password in the action and only uses it when saving the user.
Profile only checked a typed password's length when no OpenID URL was given, but it saves a typed password either way, so a long one with an OpenID URL still failed in BCrypt.
…hange # Conflicts: # app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java # app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java
Contributor
Author
|
A second review raised a few more points, now addressed in the latest commits:
|
# Conflicts: # app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
…hecks A user whose password is stored with an older encoding and is longer than BCrypt's 72 bytes can log in again. The encoder returns no re-encoding for such a password instead of throwing, so the login succeeds and the stored password is left as it is. Registration under db-oidc now asks for a password when neither a password nor an OpenID URL is given, instead of failing when the user is saved. The missing-password error uses error.add.user.missingPassword, which exists in the message bundle. The length check no longer runs for LDAP and container-managed sign-ups, where the form holds the configured placeholder rather than a typed password. The too-long message no longer promises 72 characters, since the limit is in bytes and the form fields are shorter than that.
A login is now recorded in its session when Spring Security accepts it, from the form login and single sign-on success handlers and from the remember-me services, instead of on the first request to the Roller UI. A login that had only visited weblog pages before the password changed no longer adopts the new password and survives, and logging in again in a browser that still had a stale session is no longer ended on its next request. A request that finds its session already invalidated by a parallel request is treated as logged out instead of failing with an IllegalStateException. Profile and user admin saves compare OpenID URLs without their trailing slash, so saving an unchanged profile no longer regenerates the stored password and ends the other sessions of the user.
The login hooks that record the password digest are set up only in security.xml, so this test loads that file and checks that the form login filter, the single sign-on filter and remember-me all use them. It fails if the success handler or the remember-me services reference is removed.
snoopdave
reviewed
Nov 20, 2026
snoopdave
left a comment
Contributor
There was a problem hiding this comment.
Review of bf2ad6453: The earlier OIDC profile-edit and passivation points are addressed. Two gaps remain in the current session behavior, so I recommend changes.
Earlier comments: 2 of 2 resolved.
…ssword re-encoding A login that recorded its password but had no Roller session yet, because it had not opened a Roller page or its session was passivated, kept going after its account was disabled or removed, since the user lookup came back empty and the check was skipped. Such a session now ends when its recorded account no longer resolves to an enabled user. When a login re-encodes a password stored with an older encoding, RollerUserDetailsService now tells RollerSession, which remembers the new hash as a re-encoding of the old one. The user's other sessions stay logged in across that re-encoding and take on the new hash, while a real password change afterwards still ends them.
mraible
added a commit
to mraible/roller
that referenced
this pull request
Nov 20, 2026
Adds bug-fix and behaviour-change entries for apache#313 to apache#319 and apache#321 to apache#323.
…sword-change # Conflicts: # app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
…ing the session Requests of the same session share one security context. Clearing only the current request's holder left the login in place for a parallel request, which could then start a new session with the user attached. The test fails without the change.
…e login page A request whose session ended because its user's password or account changed went on with no user, so a page showed Access Denied and a form post failed the salt check with a server error. The salt filters now redirect it: a page request goes back to the same page, where Spring Security asks for a login if the page needs one, and a form post goes to the login page.
Between the commit of a new password and the update of the saving session, another request of the same session saw the new password and ended the session. The saving request now tells its session which password it is storing first, and the session takes that password on as soon as it is stored. The user's other sessions still end.
…ver error A request whose session has no user, such as one whose session was just ended, made the permission check fail with a NullPointerException.
The log line said a password or account had changed even when the request was only following a session another request had ended, and it didn't say whose session it was.
The OpenID tests switched to a hashed encoder because a generated password was said not to fit the column in plain text. Generated passwords are 64 characters now, and the tests pass with the configured encoder.
A too-long password no longer stops the other checks, so the form also says when the user name is taken or the passwords don't match.
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.
Merge this after #343 and #300. Until #343 is merged, this PR's diff includes its password length commits. #300 replaces
security.xmlwith Java configuration, so once #300 is in, this branch will move the login wiring described below intoSecurityConfig.When a user's password changes, by their own profile save or an administrator's edit, or the user is disabled, their other logged-in sessions now end on their next request to
/roller-ui. The session that made the change stays logged in.RollerSessionkeeps a SHA-256 digest of the user's stored password hash, set when the user is attached to the session.getRollerSessionreloads the user (enabled users only), and if the user is gone or disabled or the digest no longer matches, it invalidates the HTTP session, clears the login and returns an emptyRollerSession. A database error leaves the session alone.RollerSession. When the container passivates a session,RollerSessionremoves itself from it, and the next request used to rebuild it from the login with the user's current password; a rebuild for that user now ends the session when the password differs.Profile.saveandUserEdit.save(when administrators edit themselves) callRollerSession.savingPasswordbefore saving andrefreshPasswordafter, so the acting session and its own parallel requests stay logged in while the user's other sessions end.Profile.saveandUserEdit.saveused to generate a new random stored password for OIDC accounts on every save, which would now end the user's other sessions on a profile-only edit. They generate one only when the account has no stored password or its OpenID URL changes (ignoring a trailing slash).RollerLoginSessionManager.invalidate, whichUserEditalready called, only cleared a cache entry, so the next request rebuilt the session from the Spring login.CommentDataServletanswers a request whose session has no user with 403 instead of a server error.This changes the Spring Security configuration. In
security.xml, form login now usesauthentication-success-handler-ref="formLoginSuccessHandler", and both that handler andoidcSuccessHandlerwrap the usual success handler inRollerLoginSuccessHandler, which records the login.RollerRememberMeServicesrecords remember-me logins the same way. Sites that run a customizedsecurity.xmlneed to add the two handlers. Without them, a login is first recorded when it opens a Roller UI page, so a password change before that doesn't end it. Remember-me cookies already stop working after a password change, since their signature includes the stored hash.Weblog page requests read the Spring login directly, so a preview in another browser keeps working until that browser next opens a
/roller-uipage.Tests:
PasswordChangeSessionTestcovers a user's own change, an administrator's reset, disabling and removing a user, administrators changing their own password, edits without a password change, OIDC profile and administrator edits, passivated sessions, logins that haven't opened the UI yet (form, remember-me and OIDC), a parallel request of a session that is ended, and the session's own request during a password save.SecurityXmlLoginWiringTestchecks the handler wiring, andLoadSaltFilterTest,ValidateSaltFilterTestandCommentDataServletTestcover the redirect and the 403. Those suites plusPasswordFormValidationTest,UserEditPasswordLengthTest,ExternalLoginMarkerPasswordTestandPasswordUpgradeTestpass locally.The CHANGES entry for this change is already on master (#324).