mraible commented on code in PR #333:
URL: https://github.com/apache/roller/pull/333#discussion_r4637219410
##########
app/src/main/java/org/apache/roller/weblogger/ui/core/RollerSession.java:
##########
@@ -112,7 +139,13 @@ public static RollerSession
getRollerSession(HttpServletRequest request) {
}
// only set authenticated user if user is enabled
if (user != null && user.getEnabled()) {
+ // a login whose password changed since it was first
+ // seen ends here too, even with no Roller session left
+ if (!sameLoginPassword(session, user)) {
Review Comment:
When the lookup finds no enabled user and the session holds a recorded
login, getRollerSession() now ends the session, so an account disabled or
removed before its login opens a Roller page, or after its session was
passivated, is logged out. New tests in PasswordChangeSessionTest:
disablingAUserEndsALoginThatHasNotOpenedTheUiYet,
disablingAUserEndsASessionThatWasPassivated and
removingAUserEndsALoginThatHasNotOpenedTheUiYet.
##########
app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java:
##########
@@ -388,8 +389,14 @@ public void myValidate() {
getBean().setPasswordConfirm(randomString);
}
+ // the external-login marker is stored for users who log in elsewhere
+ // and never matches at login
+ if (!usingSSO &&
ExternalLoginAwarePasswordEncoder.isExternalLoginMarker(getBean().getPasswordText()))
{
Review Comment:
I left this out of #333 on purpose. On master the byte-length checks come
from #343, which #321 is stacked on, and they're there because Spring Security
6.3+ throws for passwords over 72 bytes, so the save would fail. 6.1.x uses
Spring Security 5.8.16, where BCrypt truncates at 72 bytes and doesn't throw (I
checked against the 5.8.16 jar), so saves succeed, a changed password still
gets a new hash, and the session ending in this PR works the same. Through the
forms, Profile and Register allow 20 UTF-16 units (60 bytes at most) and
UserEdit allows 30 (up to 90 bytes), so only an admin typing long non-Latin
passwords, or a crafted POST, gets past 72 bytes today. That truncation has
been there all along, so I'll port #343's checks to 6.1.x in a separate small
PR rather than grow this one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]