From 97851146f09f55ef6259180ec6b4e366063e7d9f Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Mon, 16 Nov 2026 22:04:10 -0700 Subject: [PATCH 01/11] Don't match the external-login placeholder as a password Users who log in through LDAP or the servlet container have users.passwords.externalAuthValue stored in place of a Roller password. Roller's password encoder no longer matches that placeholder, so it isn't treated as a password anywhere the encoder checks one. --- .../weblogger/ui/core/RollerContext.java | 5 +- .../ExternalLoginAwarePasswordEncoder.java | 54 +++++++++++++++++ ...ExternalLoginAwarePasswordEncoderTest.java | 59 +++++++++++++++++++ 3 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java create mode 100644 app/src/test/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoderTest.java diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java index 0955747bc9..7fee33870e 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/RollerContext.java @@ -44,6 +44,7 @@ import org.apache.roller.weblogger.business.startup.WebloggerStartup; import org.apache.roller.weblogger.ui.core.plugins.UIPluginManager; import org.apache.roller.weblogger.ui.core.plugins.UIPluginManagerImpl; +import org.apache.roller.weblogger.ui.core.security.ExternalLoginAwarePasswordEncoder; import org.apache.roller.weblogger.ui.core.security.AutoProvision; import org.apache.roller.weblogger.ui.core.security.BootstrapSecurity; import org.apache.roller.weblogger.util.Reflection; @@ -70,7 +71,7 @@ public class RollerContext extends ContextLoaderListener private static final Log log = LogFactory.getLog(RollerContext.class); private static ServletContext servletContext = null; - private static DelegatingPasswordEncoder encoder; + private static PasswordEncoder encoder; public RollerContext() { @@ -278,7 +279,7 @@ protected void initializeSecurityFeatures(ServletContext context) { } } - encoder = createPasswordEncoder(); + encoder = new ExternalLoginAwarePasswordEncoder(createPasswordEncoder()); String daoBeanName = "org.springframework.security.authentication.dao.DaoAuthenticationProvider#0"; diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java new file mode 100644 index 0000000000..afe5949bd0 --- /dev/null +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.roller.weblogger.ui.core.security; + +import org.apache.roller.weblogger.config.WebloggerConfig; +import org.springframework.security.crypto.password.PasswordEncoder; + +/** + * Users who log in through LDAP or the servlet container have no Roller + * password; Roller stores users.passwords.externalAuthValue in its place. + * That placeholder is not a password, so this encoder never matches it. + */ +public class ExternalLoginAwarePasswordEncoder implements PasswordEncoder { + + private final PasswordEncoder delegate; + + public ExternalLoginAwarePasswordEncoder(PasswordEncoder delegate) { + this.delegate = delegate; + } + + @Override + public String encode(CharSequence rawPassword) { + return delegate.encode(rawPassword); + } + + @Override + public boolean matches(CharSequence rawPassword, String encodedPassword) { + String marker = WebloggerConfig.getProperty("users.passwords.externalAuthValue", ""); + if (rawPassword != null && marker != null && !marker.isEmpty() && marker.contentEquals(rawPassword)) { + return false; + } + return delegate.matches(rawPassword, encodedPassword); + } + + @Override + public boolean upgradeEncoding(String encodedPassword) { + return delegate.upgradeEncoding(encodedPassword); + } +} diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoderTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoderTest.java new file mode 100644 index 0000000000..8bad9ab639 --- /dev/null +++ b/app/src/test/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoderTest.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.roller.weblogger.ui.core.security; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.Test; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.DelegatingPasswordEncoder; +import org.springframework.security.crypto.password.NoOpPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class ExternalLoginAwarePasswordEncoderTest { + + @SuppressWarnings("deprecation") + private static PasswordEncoder encoder() { + Map encoders = new HashMap<>(); + // as with passwds.encryption.lazyUpgradeFrom=plaintext + encoders.put(null, NoOpPasswordEncoder.getInstance()); + encoders.put("bcrypt", new BCryptPasswordEncoder()); + return new ExternalLoginAwarePasswordEncoder(new DelegatingPasswordEncoder("bcrypt", encoders)); + } + + @Test + void thePlaceholderIsNotAPassword() { + PasswordEncoder encoder = encoder(); + // as Register stores it for container-managed and LDAP sign-ups + assertFalse(encoder.matches("", encoder.encode(""))); + // as CustomUserRegistry stores it for directory users + assertFalse(encoder.matches("", "")); + } + + @Test + void otherPasswordsStillWork() { + PasswordEncoder encoder = encoder(); + assertTrue(encoder.matches("secret", encoder.encode("secret"))); + assertTrue(encoder.matches("old-plain", "old-plain")); + assertFalse(encoder.matches("wrong", encoder.encode("secret"))); + } +} From f59b841a2f454df1edee8ab12a5eaf31af8b4cc9 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Tue, 17 Nov 2026 19:52:19 -0700 Subject: [PATCH 02/11] Reject the external-login placeholder as a chosen password and never match an empty one Registration, the profile page and the admin user editor now reject users.passwords.externalAuthValue, and the default , as a new password with a validation message, since that value never matches at login. An account that already has it can be given a new password by an administrator. An empty configured value now falls back to for what Roller stores, and the password encoder never matches an empty password or the default placeholder. --- .../ui/core/security/CustomUserRegistry.java | 2 +- .../ExternalLoginAwarePasswordEncoder.java | 30 ++- .../weblogger/ui/struts2/admin/UserEdit.java | 5 + .../weblogger/ui/struts2/core/Profile.java | 5 + .../weblogger/ui/struts2/core/Register.java | 9 +- .../resources/ApplicationResources.properties | 1 + .../ui/core/ExternalLoginPlaceholderTest.java | 208 ++++++++++++++++++ .../core/ExternalLoginMarkerPasswordTest.java | 203 +++++++++++++++++ 8 files changed, 458 insertions(+), 5 deletions(-) create mode 100644 app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java create mode 100644 app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/CustomUserRegistry.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/CustomUserRegistry.java index 14d184f870..157e4fdd18 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/CustomUserRegistry.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/CustomUserRegistry.java @@ -153,7 +153,7 @@ else if(userDetails instanceof LdapUserDetails) { // for LDAP we don't store its password in the roller_users table, // just an string indicating external auth method being used. - unusedPassword = WebloggerConfig.getProperty("users.passwords.externalAuthValue",""); + unusedPassword = ExternalLoginAwarePasswordEncoder.externalLoginMarker(); ud.setPassword(unusedPassword); ud.setEnabled(enabled ? Boolean.TRUE : Boolean.FALSE); diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java index afe5949bd0..dad777028b 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java @@ -23,16 +23,41 @@ /** * Users who log in through LDAP or the servlet container have no Roller * password; Roller stores users.passwords.externalAuthValue in its place. - * That placeholder is not a password, so this encoder never matches it. + * That placeholder is not a password, so this encoder never matches it, nor + * the default placeholder, nor an empty password. */ public class ExternalLoginAwarePasswordEncoder implements PasswordEncoder { + /** Stored in place of a password when no other value is configured. */ + public static final String DEFAULT_EXTERNAL_LOGIN_MARKER = ""; + private final PasswordEncoder delegate; public ExternalLoginAwarePasswordEncoder(PasswordEncoder delegate) { this.delegate = delegate; } + /** + * The value stored in place of a Roller password for users who log in + * through LDAP or the servlet container: users.passwords.externalAuthValue, + * or the default when that setting is empty. + */ + public static String externalLoginMarker() { + String marker = WebloggerConfig.getProperty("users.passwords.externalAuthValue"); + return marker == null || marker.isEmpty() ? DEFAULT_EXTERNAL_LOGIN_MARKER : marker; + } + + /** + * Whether a password is the configured external-login marker or the + * default one, which accounts may still have stored from before the + * setting changed. Neither matches at login, so neither can be chosen as a + * Roller password. + */ + public static boolean isExternalLoginMarker(CharSequence password) { + return password != null && (externalLoginMarker().contentEquals(password) + || DEFAULT_EXTERNAL_LOGIN_MARKER.contentEquals(password)); + } + @Override public String encode(CharSequence rawPassword) { return delegate.encode(rawPassword); @@ -40,8 +65,7 @@ public String encode(CharSequence rawPassword) { @Override public boolean matches(CharSequence rawPassword, String encodedPassword) { - String marker = WebloggerConfig.getProperty("users.passwords.externalAuthValue", ""); - if (rawPassword != null && marker != null && !marker.isEmpty() && marker.contentEquals(rawPassword)) { + if (rawPassword == null || rawPassword.length() == 0 || isExternalLoginMarker(rawPassword)) { return false; } return delegate.matches(rawPassword, encodedPassword); diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java index 70878ecf82..90a2ef63d4 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java @@ -40,6 +40,7 @@ import org.apache.roller.weblogger.ui.core.RollerLoginSessionManager; import org.apache.roller.weblogger.ui.struts2.core.Register; import org.apache.roller.weblogger.ui.struts2.util.UIAction; +import org.apache.roller.weblogger.ui.core.security.ExternalLoginAwarePasswordEncoder; import org.apache.struts2.interceptor.validation.SkipValidation; @@ -230,6 +231,10 @@ private boolean isAdd() { } private void myValidate() { + // the external-login marker never matches at login + if (ExternalLoginAwarePasswordEncoder.isExternalLoginMarker(getBean().getPassword())) { + addError("error.add.user.reservedPassword"); + } if (isAdd()) { String allowed = WebloggerConfig.getProperty("username.allowedChars"); if(allowed == null || allowed.isBlank()) { diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java index 6f83a0ddb6..055cc5bef0 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Profile.java @@ -28,6 +28,7 @@ import org.apache.roller.weblogger.config.WebloggerConfig; import org.apache.roller.weblogger.pojos.User; import org.apache.roller.weblogger.ui.struts2.util.UIAction; +import org.apache.roller.weblogger.ui.core.security.ExternalLoginAwarePasswordEncoder; import org.apache.struts2.interceptor.validation.SkipValidation; import java.util.Arrays; @@ -133,6 +134,10 @@ public String save() { } public void myValidate() { + // the external-login marker never matches at login + if (ExternalLoginAwarePasswordEncoder.isExternalLoginMarker(getBean().getPasswordText())) { + addError("error.add.user.reservedPassword"); + } if (StringUtils.isEmpty(getBean().getOpenIdUrl())) { // check that passwords match if they were specified (w/StringUtils.equals, null == null) if (!StringUtils.equals(getBean().getPasswordText(), getBean().getPasswordConfirm())) { diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java index 8d9c85050c..4fbcae0e50 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java @@ -39,6 +39,7 @@ import org.apache.roller.weblogger.ui.core.security.BootstrapSecurity; import org.apache.roller.weblogger.ui.struts2.util.UIAction; import org.apache.roller.weblogger.util.MailUtil; +import org.apache.roller.weblogger.ui.core.security.ExternalLoginAwarePasswordEncoder; import org.apache.struts2.convention.annotation.AllowedMethods; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.validation.SkipValidation; @@ -356,7 +357,7 @@ public void myValidate() { if (usingSSO) { // store an unused marker in the Roller DB for the passphrase in // the LDAP or CMA cases, as actual passwords are stored externally - String unusedPassword = WebloggerConfig.getProperty("users.passwords.externalAuthValue", ""); + String unusedPassword = ExternalLoginAwarePasswordEncoder.externalLoginMarker(); // Preserve username and password, Spring Security case preserveUsernameAndPassword(unusedPassword); @@ -388,6 +389,12 @@ 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())) { + addError("error.add.user.reservedPassword"); + } + // check that passwords match if (!getBean().getPasswordText().equals(getBean().getPasswordConfirm())) { addError("userRegister.error.mismatchedPasswords"); diff --git a/app/src/main/resources/ApplicationResources.properties b/app/src/main/resources/ApplicationResources.properties index eb6a304856..8863ee0c79 100644 --- a/app/src/main/resources/ApplicationResources.properties +++ b/app/src/main/resources/ApplicationResources.properties @@ -452,6 +452,7 @@ error.add.user.openIdInUse=Open ID already in use with another account. error.add.user.missingUserName=You must specify a username. error.add.user.badUserName=Invalid user name (must be alpha-numerics only). error.add.user.missingPassword=You must specify a password. +error.add.user.reservedPassword=That password is reserved for accounts that log in elsewhere. Please choose a different password. error.add.user.invalid.timezone=Invalid timezone. error.add.user.invalid.locale=Invalid locale. error.upload.dirmax=You cannot exceed the maximum directory size of {0} MB. diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java new file mode 100644 index 0000000000..b9b3154ef6 --- /dev/null +++ b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java @@ -0,0 +1,208 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.roller.weblogger.ui.core; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.servlet.ServletContext; + +import org.apache.roller.weblogger.TestUtils; +import org.apache.roller.weblogger.business.WebloggerFactory; +import org.apache.roller.weblogger.config.WebloggerConfig; +import org.apache.roller.weblogger.pojos.User; +import org.apache.roller.weblogger.ui.core.security.CustomUserRegistry; +import org.apache.roller.weblogger.ui.core.security.RollerUserDetailsService; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.authentication.dao.DaoAuthenticationProvider; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.web.context.WebApplicationContext; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * Users who log in through LDAP or the servlet container have a placeholder + * stored instead of a Roller password. The placeholder is not a password at + * the login form, whose provider RollerContext gives its password encoder. + */ +class ExternalLoginPlaceholderTest { + + private static final String DAO_PROVIDER = + "org.springframework.security.authentication.dao.DaoAuthenticationProvider#0"; + + private final Map savedProperties = new HashMap<>(); + private String userName; + + @BeforeEach + void setUp() throws Exception { + TestUtils.setupWeblogger(); + setProperty("passwds.encryption.enabled", "true"); + setProperty("passwds.encryption.algorithm", "bcrypt"); + setProperty("rememberme.enabled", "true"); + setProperty("securelogin.enabled", "false"); + } + + @AfterEach + void tearDown() throws Exception { + if (userName != null) { + TestUtils.teardownUser(userName); + TestUtils.endSession(true); + } + Properties config = config(); + savedProperties.forEach((k, v) -> { + if (v == null) { + config.remove(k); + } else { + config.setProperty(k, v); + } + }); + SecurityContextHolder.clearContext(); + } + + @Test + void anEncodedPlaceholderIsNotAPassword() throws Exception { + setProperty("authentication.method", "cma"); + DaoAuthenticationProvider provider = provider(); + // as Register stores it for container-managed sign-ups + User user = TestUtils.setupUser("cmauser"); + userName = user.getUserName(); + user.resetPassword(""); + WebloggerFactory.getWeblogger().getUserManager().saveUser(user); + TestUtils.endSession(true); + + assertThrows(AuthenticationException.class, () -> provider.authenticate( + new UsernamePasswordAuthenticationToken(userName, ""))); + } + + @Test + void anUnencodedPlaceholderIsNotAPassword() throws Exception { + setProperty("authentication.method", "db"); + setProperty("passwds.encryption.lazyUpgradeFrom", "plaintext"); + DaoAuthenticationProvider provider = provider(); + // as CustomUserRegistry stores it for directory users + User user = TestUtils.setupUser("ldapuser"); + userName = user.getUserName(); + user.setPassword(""); + WebloggerFactory.getWeblogger().getUserManager().saveUser(user); + TestUtils.endSession(true); + + assertThrows(AuthenticationException.class, () -> provider.authenticate( + new UsernamePasswordAuthenticationToken(userName, ""))); + } + + @Test + void theDefaultPlaceholderIsNotAPasswordUnderAnotherConfiguredValue() throws Exception { + setProperty("authentication.method", "db"); + setProperty("passwds.encryption.lazyUpgradeFrom", "plaintext"); + setProperty("users.passwords.externalAuthValue", ""); + DaoAuthenticationProvider provider = provider(); + // stored before the setting was changed + User user = TestUtils.setupUser("olduser"); + userName = user.getUserName(); + user.setPassword(""); + WebloggerFactory.getWeblogger().getUserManager().saveUser(user); + TestUtils.endSession(true); + + assertThrows(AuthenticationException.class, () -> provider.authenticate( + new UsernamePasswordAuthenticationToken(userName, ""))); + } + + @Test + void anEmptyConfiguredPlaceholderIsNotAPassword() throws Exception { + setProperty("authentication.method", "db"); + setProperty("passwds.encryption.lazyUpgradeFrom", "plaintext"); + setProperty("users.passwords.externalAuthValue", ""); + DaoAuthenticationProvider provider = provider(); + // as CustomUserRegistry stored an empty placeholder before + User user = TestUtils.setupUser("emptyuser"); + userName = user.getUserName(); + user.setPassword(""); + WebloggerFactory.getWeblogger().getUserManager().saveUser(user); + TestUtils.endSession(true); + + assertThrows(AuthenticationException.class, () -> provider.authenticate( + new UsernamePasswordAuthenticationToken(userName, ""))); + } + + @Test + void anOrdinaryPlaintextPasswordStillMatches() throws Exception { + setProperty("authentication.method", "db"); + setProperty("passwds.encryption.lazyUpgradeFrom", "plaintext"); + DaoAuthenticationProvider provider = provider(); + User user = TestUtils.setupUser("plainuser"); + userName = user.getUserName(); + user.setPassword("an ordinary password"); + WebloggerFactory.getWeblogger().getUserManager().saveUser(user); + TestUtils.endSession(true); + + assertTrue(provider.authenticate(new UsernamePasswordAuthenticationToken( + userName, "an ordinary password")).isAuthenticated()); + } + + @Test + void anEmptyConfiguredPlaceholderIsStoredAsTheDefault() throws Exception { + setProperty("authentication.method", "ldap"); + setProperty("users.passwords.externalAuthValue", ""); + SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken( + new org.springframework.security.core.userdetails.User("ldapuser", "unused", + List.of(new SimpleGrantedAuthority("editor"))), + null, List.of())); + + User user = CustomUserRegistry.getUserDetailsFromAuthentication(null); + + assertEquals("", user.getPassword()); + } + + /** The login form's provider, given its encoder the way RollerContext does at startup. */ + private static DaoAuthenticationProvider provider() { + DaoAuthenticationProvider provider = new DaoAuthenticationProvider(); + provider.setUserDetailsService(new RollerUserDetailsService()); + WebApplicationContext ctx = mock(WebApplicationContext.class); + when(ctx.containsBean(DAO_PROVIDER)).thenReturn(true); + when(ctx.getBean(DAO_PROVIDER)).thenReturn(provider); + ServletContext servletContext = mock(ServletContext.class); + when(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)) + .thenReturn(ctx); + new RollerContext().initializeSecurityFeatures(servletContext); + return provider; + } + + private void setProperty(String key, String value) throws ReflectiveOperationException { + Properties config = config(); + savedProperties.putIfAbsent(key, config.getProperty(key)); + config.setProperty(key, value); + } + + private static Properties config() throws ReflectiveOperationException { + Field field = WebloggerConfig.class.getDeclaredField("config"); + field.setAccessible(true); + return (Properties) field.get(null); + } +} diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java new file mode 100644 index 0000000000..3ef37becb1 --- /dev/null +++ b/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java @@ -0,0 +1,203 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.roller.weblogger.ui.struts2.core; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.apache.roller.weblogger.business.UserManager; +import org.apache.roller.weblogger.business.Weblogger; +import org.apache.roller.weblogger.business.WebloggerFactory; +import org.apache.roller.weblogger.config.WebloggerConfig; +import org.apache.roller.weblogger.pojos.User; +import org.apache.roller.weblogger.ui.struts2.admin.UserEdit; +import org.apache.roller.weblogger.ui.struts2.util.UIAction; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.MockedStatic; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +/** + * Accounts that log in through LDAP or the servlet container store + * users.passwords.externalAuthValue instead of a password, and that value never + * matches at login. So nobody can choose it as a Roller password. + */ +class ExternalLoginMarkerPasswordTest { + + private static final String RESERVED = "error.add.user.reservedPassword"; + + private final Map savedProperties = new HashMap<>(); + private MockedStatic factory; + private UserManager users; + + @BeforeEach + void setUp() throws Exception { + setProperty("authentication.method", "db"); + setProperty("users.passwords.externalAuthValue", ""); + factory = mockStatic(WebloggerFactory.class); + users = mock(UserManager.class); + Weblogger weblogger = mock(Weblogger.class); + when(weblogger.getUserManager()).thenReturn(users); + factory.when(WebloggerFactory::getWeblogger).thenReturn(weblogger); + } + + @AfterEach + void tearDown() throws Exception { + factory.close(); + Properties config = config(); + savedProperties.forEach((k, v) -> { + if (v == null) { + config.remove(k); + } else { + config.setProperty(k, v); + } + }); + } + + @Test + void registrationRejectsTheMarker() { + Register action = withText(new Register()); + action.getBean().setUserName("newuser"); + action.getBean().setPasswordText(""); + action.getBean().setPasswordConfirm(""); + + action.myValidate(); + + assertTrue(action.getActionErrors().contains(RESERVED)); + } + + @Test + void registrationRejectsTheDefaultMarkerUnderAnotherConfiguredValue() throws Exception { + setProperty("users.passwords.externalAuthValue", ""); + for (String reserved : new String[] {"", ""}) { + Register action = withText(new Register()); + action.getBean().setUserName("newuser"); + action.getBean().setPasswordText(reserved); + action.getBean().setPasswordConfirm(reserved); + + action.myValidate(); + + assertTrue(action.getActionErrors().contains(RESERVED), reserved); + } + } + + @Test + void registrationAcceptsAnOrdinaryPassword() { + Register action = withText(new Register()); + action.getBean().setUserName("newuser"); + action.getBean().setPasswordText("an ordinary password"); + action.getBean().setPasswordConfirm("an ordinary password"); + + action.myValidate(); + + assertFalse(action.hasActionErrors()); + } + + @Test + void theProfileRejectsTheMarker() throws Exception { + User user = new User(); + user.setUserName("dbuser"); + user.setPassword("{bcrypt}existing"); + Profile action = withText(new Profile()); + action.setAuthenticatedUser(user); + action.getBean().setPasswordText(""); + action.getBean().setPasswordConfirm(""); + + assertEquals(UIAction.INPUT, action.save()); + + assertTrue(action.getActionErrors().contains(RESERVED)); + assertEquals("{bcrypt}existing", user.getPassword()); + verify(users, never()).saveUser(any()); + } + + @Test + void anAdministratorCannotGiveAUserTheMarker() throws Exception { + User admin = new User(); + admin.setUserName("admin"); + User user = new User(); + user.setId("user-1"); + user.setUserName("dbuser"); + user.setPassword("{bcrypt}existing"); + when(users.getUser("user-1")).thenReturn(user); + UserEdit action = withText(new UserEdit()); + action.setActionName("modifyUser"); + action.setAuthenticatedUser(admin); + action.getBean().setId("user-1"); + action.myPrepare(); + action.getBean().setPassword(""); + + assertEquals(UIAction.INPUT, action.save()); + + assertTrue(action.getActionErrors().contains(RESERVED)); + assertEquals("{bcrypt}existing", user.getPassword()); + verify(users, never()).saveUser(any()); + } + + @Test + void anAdministratorCannotCreateAUserWithTheMarker() throws Exception { + UserEdit action = withText(new UserEdit()); + User admin = new User(); + admin.setUserName("admin"); + action.setActionName("createUser"); + action.setAuthenticatedUser(admin); + action.myPrepare(); + action.getBean().setUserName("newuser"); + action.getBean().setPassword(""); + + assertEquals(UIAction.INPUT, action.save()); + + assertTrue(action.getActionErrors().contains(RESERVED)); + verify(users, never()).addUser(any()); + } + + private static T withText(T action) { + T spied = spy(action); + doAnswer(call -> call.getArgument(0)).when(spied).getText(anyString()); + doAnswer(call -> call.getArgument(0)).when(spied).getText(anyString(), anyList()); + doAnswer(call -> call.getArgument(0)).when(spied).getText(anyString(), anyString(), anyString()); + return spied; + } + + private void setProperty(String key, String value) throws ReflectiveOperationException { + Properties config = config(); + savedProperties.putIfAbsent(key, config.getProperty(key)); + config.setProperty(key, value); + } + + private static Properties config() throws ReflectiveOperationException { + Field field = WebloggerConfig.class.getDeclaredField("config"); + field.setAccessible(true); + return (Properties) field.get(null); + } +} From 09ff2d2fd333182982f5fd34d05147229bac353f Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Tue, 17 Nov 2026 21:46:38 -0700 Subject: [PATCH 03/11] Don't let a stored external-login marker reach the delegate encoder --- .../ExternalLoginAwarePasswordEncoder.java | 5 ++++- .../ui/core/ExternalLoginPlaceholderTest.java | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java index dad777028b..55681f44a1 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java @@ -65,7 +65,10 @@ public String encode(CharSequence rawPassword) { @Override public boolean matches(CharSequence rawPassword, String encodedPassword) { - if (rawPassword == null || rawPassword.length() == 0 || isExternalLoginMarker(rawPassword)) { + // a stored marker is checked before the delegate sees it, since a + // marker such as {noop}secret would otherwise match its own suffix + if (rawPassword == null || rawPassword.length() == 0 || isExternalLoginMarker(rawPassword) + || isExternalLoginMarker(encodedPassword)) { return false; } return delegate.matches(rawPassword, encodedPassword); diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java index b9b3154ef6..a4a01bb291 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java @@ -151,6 +151,22 @@ void anEmptyConfiguredPlaceholderIsNotAPassword() throws Exception { new UsernamePasswordAuthenticationToken(userName, ""))); } + @Test + void aStoredPlaceholderWithAnEncoderPrefixIsNotAPassword() throws Exception { + setProperty("authentication.method", "ldap"); + setProperty("users.passwords.externalAuthValue", "{noop}secret"); + DaoAuthenticationProvider provider = provider(); + // as CustomUserRegistry stores the configured placeholder + User user = TestUtils.setupUser("prefixuser"); + userName = user.getUserName(); + user.setPassword("{noop}secret"); + WebloggerFactory.getWeblogger().getUserManager().saveUser(user); + TestUtils.endSession(true); + + assertThrows(AuthenticationException.class, () -> provider.authenticate( + new UsernamePasswordAuthenticationToken(userName, "secret"))); + } + @Test void anOrdinaryPlaintextPasswordStillMatches() throws Exception { setProperty("authentication.method", "db"); From d984431e6c19748c4ea0c855897169ebb6c9161b Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Wed, 18 Nov 2026 21:18:50 -0700 Subject: [PATCH 04/11] Make registration null-safe and use one external-login marker for remember-me Registering without a password outside db mode no longer throws a NullPointerException when the passwords are compared. The remember-me signature for LDAP users now takes its placeholder from ExternalLoginAwarePasswordEncoder.externalLoginMarker(), so an empty users.passwords.externalAuthValue means the default there as it does everywhere else. With the default configuration the value is unchanged, so existing remember-me cookies stay valid. The tests now restore WebloggerConfig properties even when user teardown fails or the original value was not set, and put back the password encoder that RollerContext shares. --- .../security/RollerRememberMeServices.java | 2 +- .../weblogger/ui/struts2/core/Register.java | 2 +- .../ui/core/ExternalLoginPlaceholderTest.java | 68 +++++++++++++++---- .../core/ExternalLoginMarkerPasswordTest.java | 16 ++++- 4 files changed, 72 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerRememberMeServices.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerRememberMeServices.java index 2566a4308d..81042651fc 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerRememberMeServices.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/RollerRememberMeServices.java @@ -64,7 +64,7 @@ protected String makeTokenSignature(long tokenExpiryTime, String username, Strin // for LDAP we don't store its password in the roller_users table, // just an string indicating external auth method being used. - password = WebloggerConfig.getProperty("users.passwords.externalAuthValue",""); + password = ExternalLoginAwarePasswordEncoder.externalLoginMarker(); } String data = username + ":" + tokenExpiryTime + ":" + password + ":" + getKey(); diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java index 4fbcae0e50..15172bdbdc 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java @@ -396,7 +396,7 @@ public void myValidate() { } // check that passwords match - if (!getBean().getPasswordText().equals(getBean().getPasswordConfirm())) { + if (!StringUtils.equals(getBean().getPasswordText(), getBean().getPasswordConfirm())) { addError("userRegister.error.mismatchedPasswords"); } diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java index a4a01bb291..226feb0598 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java @@ -30,6 +30,7 @@ import org.apache.roller.weblogger.config.WebloggerConfig; import org.apache.roller.weblogger.pojos.User; import org.apache.roller.weblogger.ui.core.security.CustomUserRegistry; +import org.apache.roller.weblogger.ui.core.security.RollerRememberMeServices; import org.apache.roller.weblogger.ui.core.security.RollerUserDetailsService; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -59,9 +60,11 @@ class ExternalLoginPlaceholderTest { private final Map savedProperties = new HashMap<>(); private String userName; + private Object savedEncoder; @BeforeEach void setUp() throws Exception { + savedEncoder = encoderField().get(null); TestUtils.setupWeblogger(); setProperty("passwds.encryption.enabled", "true"); setProperty("passwds.encryption.algorithm", "bcrypt"); @@ -71,19 +74,24 @@ void setUp() throws Exception { @AfterEach void tearDown() throws Exception { - if (userName != null) { - TestUtils.teardownUser(userName); - TestUtils.endSession(true); - } - Properties config = config(); - savedProperties.forEach((k, v) -> { - if (v == null) { - config.remove(k); - } else { - config.setProperty(k, v); + try { + if (userName != null) { + TestUtils.teardownUser(userName); + TestUtils.endSession(true); } - }); - SecurityContextHolder.clearContext(); + } finally { + Properties config = config(); + savedProperties.forEach((k, v) -> { + if (v == null) { + config.remove(k); + } else { + config.setProperty(k, v); + } + }); + SecurityContextHolder.clearContext(); + // provider() replaces the encoder RollerContext shares + encoderField().set(null, savedEncoder); + } } @Test @@ -196,6 +204,31 @@ void anEmptyConfiguredPlaceholderIsStoredAsTheDefault() throws Exception { assertEquals("", user.getPassword()); } + @Test + void theRememberMeSignatureUsesTheDefaultForAnEmptyConfiguredPlaceholder() throws Exception { + setProperty("authentication.method", "ldap"); + setProperty("rememberme.enabled", "false"); + SigningRememberMeServices services = new SigningRememberMeServices(); + setProperty("users.passwords.externalAuthValue", ""); + String signedWithTheDefault = services.sign(); + + // CustomUserRegistry stores the default for an empty setting + setProperty("users.passwords.externalAuthValue", ""); + + assertEquals(signedWithTheDefault, services.sign()); + } + + private static class SigningRememberMeServices extends RollerRememberMeServices { + + SigningRememberMeServices() { + super(new RollerUserDetailsService()); + } + + String sign() { + return makeTokenSignature(1L, "ldapuser", "unused"); + } + } + /** The login form's provider, given its encoder the way RollerContext does at startup. */ private static DaoAuthenticationProvider provider() { DaoAuthenticationProvider provider = new DaoAuthenticationProvider(); @@ -212,10 +245,19 @@ private static DaoAuthenticationProvider provider() { private void setProperty(String key, String value) throws ReflectiveOperationException { Properties config = config(); - savedProperties.putIfAbsent(key, config.getProperty(key)); + // keep the first value seen, even when it is null (not set) + if (!savedProperties.containsKey(key)) { + savedProperties.put(key, config.getProperty(key)); + } config.setProperty(key, value); } + private static Field encoderField() throws ReflectiveOperationException { + Field field = RollerContext.class.getDeclaredField("encoder"); + field.setAccessible(true); + return field; + } + private static Properties config() throws ReflectiveOperationException { Field field = WebloggerConfig.class.getDeclaredField("config"); field.setAccessible(true); diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java index 3ef37becb1..3d9389e6f5 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java @@ -34,6 +34,7 @@ import org.junit.jupiter.api.Test; import org.mockito.MockedStatic; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -124,6 +125,16 @@ void registrationAcceptsAnOrdinaryPassword() { assertFalse(action.hasActionErrors()); } + @Test + void registrationWithoutAPasswordDoesNotFail() throws Exception { + // db-openid does not require a password when the form is validated + setProperty("authentication.method", "db-openid"); + Register action = withText(new Register()); + action.getBean().setUserName("newuser"); + + assertDoesNotThrow(action::myValidate); + } + @Test void theProfileRejectsTheMarker() throws Exception { User user = new User(); @@ -191,7 +202,10 @@ private static T withText(T action) { private void setProperty(String key, String value) throws ReflectiveOperationException { Properties config = config(); - savedProperties.putIfAbsent(key, config.getProperty(key)); + // keep the first value seen, even when it is null (not set) + if (!savedProperties.containsKey(key)) { + savedProperties.put(key, config.getProperty(key)); + } config.setProperty(key, value); } From 8c48ca3b8faaf4f1cebeb416c084ad56f5fd2417 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Thu, 19 Nov 2026 17:28:24 -0700 Subject: [PATCH 05/11] Recognize previously configured external-login markers Accounts created before users.passwords.externalAuthValue changed still have the old marker stored, encoded or not, and the encoder only recognized the current marker and the default, so the old marker matched at login. The new users.passwords.externalAuthValue.previous setting lists earlier markers, which are refused at login and can't be chosen as passwords, the same as the current one. Empty entries are ignored so an empty password never counts as a marker. --- .../ExternalLoginAwarePasswordEncoder.java | 29 +++++++++--- .../roller/weblogger/config/roller.properties | 5 ++ .../ui/core/ExternalLoginPlaceholderTest.java | 47 +++++++++++++++++++ 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java index 55681f44a1..1c0e0bf7bc 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java @@ -17,6 +17,7 @@ package org.apache.roller.weblogger.ui.core.security; +import org.apache.commons.lang3.StringUtils; import org.apache.roller.weblogger.config.WebloggerConfig; import org.springframework.security.crypto.password.PasswordEncoder; @@ -24,7 +25,7 @@ * Users who log in through LDAP or the servlet container have no Roller * password; Roller stores users.passwords.externalAuthValue in its place. * That placeholder is not a password, so this encoder never matches it, nor - * the default placeholder, nor an empty password. + * the default or a previous placeholder, nor an empty password. */ public class ExternalLoginAwarePasswordEncoder implements PasswordEncoder { @@ -48,14 +49,28 @@ public static String externalLoginMarker() { } /** - * Whether a password is the configured external-login marker or the - * default one, which accounts may still have stored from before the - * setting changed. Neither matches at login, so neither can be chosen as a - * Roller password. + * Whether a password is the configured external-login marker, the default + * one, or one listed in users.passwords.externalAuthValue.previous, which + * accounts may still have stored from before the setting changed. None of + * them matches at login, so none can be chosen as a Roller password. */ public static boolean isExternalLoginMarker(CharSequence password) { - return password != null && (externalLoginMarker().contentEquals(password) - || DEFAULT_EXTERNAL_LOGIN_MARKER.contentEquals(password)); + if (password == null) { + return false; + } + if (externalLoginMarker().contentEquals(password) + || DEFAULT_EXTERNAL_LOGIN_MARKER.contentEquals(password)) { + return true; + } + String previous = WebloggerConfig.getProperty("users.passwords.externalAuthValue.previous"); + for (String marker : StringUtils.split(StringUtils.defaultString(previous), ',')) { + // an empty entry is never a marker, so an empty password isn't one + String trimmed = marker.trim(); + if (!trimmed.isEmpty() && trimmed.contentEquals(password)) { + return true; + } + } + return false; } @Override diff --git a/app/src/main/resources/org/apache/roller/weblogger/config/roller.properties b/app/src/main/resources/org/apache/roller/weblogger/config/roller.properties index 91979b2b2b..074a930cc6 100644 --- a/app/src/main/resources/org/apache/roller/weblogger/config/roller.properties +++ b/app/src/main/resources/org/apache/roller/weblogger/config/roller.properties @@ -364,6 +364,11 @@ weblog.inlineImages.maxFieldBytes=60000 # openid presently generates a random (long) password string instead. users.passwords.externalAuthValue= +# Comma-separated values that users.passwords.externalAuthValue had before. +# Accounts created then still have them stored, so list them here when changing +# that setting; none of them is accepted as a password. +users.passwords.externalAuthValue.previous= + # Password security settings passwds.encryption.enabled=true passwds.encryption.algorithm=bcrypt diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java index 226feb0598..6443498bc6 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java @@ -30,6 +30,7 @@ import org.apache.roller.weblogger.config.WebloggerConfig; import org.apache.roller.weblogger.pojos.User; import org.apache.roller.weblogger.ui.core.security.CustomUserRegistry; +import org.apache.roller.weblogger.ui.core.security.ExternalLoginAwarePasswordEncoder; import org.apache.roller.weblogger.ui.core.security.RollerRememberMeServices; import org.apache.roller.weblogger.ui.core.security.RollerUserDetailsService; import org.junit.jupiter.api.AfterEach; @@ -43,6 +44,7 @@ import org.springframework.web.context.WebApplicationContext; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; @@ -142,6 +144,51 @@ void theDefaultPlaceholderIsNotAPasswordUnderAnotherConfiguredValue() throws Exc new UsernamePasswordAuthenticationToken(userName, ""))); } + @Test + void aPreviousEncodedPlaceholderIsNotAPasswordAfterTheSettingChanges() throws Exception { + setProperty("authentication.method", "cma"); + setProperty("users.passwords.externalAuthValue", ""); + DaoAuthenticationProvider provider = provider(); + // as Register stored it for container-managed sign-ups + User user = TestUtils.setupUser("oldcmauser"); + userName = user.getUserName(); + user.resetPassword(""); + WebloggerFactory.getWeblogger().getUserManager().saveUser(user); + TestUtils.endSession(true); + + setProperty("users.passwords.externalAuthValue", ""); + setProperty("users.passwords.externalAuthValue.previous", ","); + + assertThrows(AuthenticationException.class, () -> provider.authenticate( + new UsernamePasswordAuthenticationToken(userName, ""))); + } + + @Test + void aPreviousUnencodedPlaceholderIsNotAPasswordAfterTheSettingChanges() throws Exception { + setProperty("authentication.method", "ldap"); + setProperty("users.passwords.externalAuthValue", ""); + setProperty("users.passwords.externalAuthValue.previous", "{noop}secret"); + DaoAuthenticationProvider provider = provider(); + // as CustomUserRegistry stored it before the setting changed + User user = TestUtils.setupUser("oldldapuser"); + userName = user.getUserName(); + user.setPassword("{noop}secret"); + WebloggerFactory.getWeblogger().getUserManager().saveUser(user); + TestUtils.endSession(true); + + assertThrows(AuthenticationException.class, () -> provider.authenticate( + new UsernamePasswordAuthenticationToken(userName, "secret"))); + } + + @Test + void emptyEntriesInThePreviousPlaceholdersAreIgnored() throws Exception { + setProperty("users.passwords.externalAuthValue.previous", ",, ,"); + + assertTrue(ExternalLoginAwarePasswordEncoder.isExternalLoginMarker("")); + assertFalse(ExternalLoginAwarePasswordEncoder.isExternalLoginMarker("")); + assertFalse(ExternalLoginAwarePasswordEncoder.isExternalLoginMarker(" ")); + } + @Test void anEmptyConfiguredPlaceholderIsNotAPassword() throws Exception { setProperty("authentication.method", "db"); From 1b0bd5edfd5aaafe86a5cf6e50a88590278f8d1e Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Fri, 20 Nov 2026 14:01:51 -0700 Subject: [PATCH 06/11] Refuse a password that BCrypt treats as equal to an external-login marker BCrypt gives some passwords other than a marker the same hash as the marker, so an exact comparison with the marker isn't enough to keep it from matching. After the delegate matches, the encoder now also checks whether the current, default or a previous marker matches the stored value, and refuses the password if one does. The marker list is read once per check. --- .../ExternalLoginAwarePasswordEncoder.java | 50 +++++++++++++------ .../ui/core/ExternalLoginPlaceholderTest.java | 20 ++++++++ 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java index 1c0e0bf7bc..aa87e3ce9c 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java @@ -17,6 +17,9 @@ package org.apache.roller.weblogger.ui.core.security; +import java.util.LinkedHashSet; +import java.util.Set; + import org.apache.commons.lang3.StringUtils; import org.apache.roller.weblogger.config.WebloggerConfig; import org.springframework.security.crypto.password.PasswordEncoder; @@ -25,7 +28,8 @@ * Users who log in through LDAP or the servlet container have no Roller * password; Roller stores users.passwords.externalAuthValue in its place. * That placeholder is not a password, so this encoder never matches it, nor - * the default or a previous placeholder, nor an empty password. + * the default or a previous placeholder, nor a password the delegate treats + * as equal to one of them, nor an empty password. */ public class ExternalLoginAwarePasswordEncoder implements PasswordEncoder { @@ -55,22 +59,27 @@ public static String externalLoginMarker() { * them matches at login, so none can be chosen as a Roller password. */ public static boolean isExternalLoginMarker(CharSequence password) { - if (password == null) { - return false; - } - if (externalLoginMarker().contentEquals(password) - || DEFAULT_EXTERNAL_LOGIN_MARKER.contentEquals(password)) { - return true; - } + return password != null && externalLoginMarkers().contains(password.toString()); + } + + /** + * The configured marker, the default one and the previous ones. The + * previous ones are a comma-separated list, so a marker that contains a + * comma can't be listed there. + */ + private static Set externalLoginMarkers() { + Set markers = new LinkedHashSet<>(); + markers.add(externalLoginMarker()); + markers.add(DEFAULT_EXTERNAL_LOGIN_MARKER); String previous = WebloggerConfig.getProperty("users.passwords.externalAuthValue.previous"); for (String marker : StringUtils.split(StringUtils.defaultString(previous), ',')) { // an empty entry is never a marker, so an empty password isn't one String trimmed = marker.trim(); - if (!trimmed.isEmpty() && trimmed.contentEquals(password)) { - return true; + if (!trimmed.isEmpty()) { + markers.add(trimmed); } } - return false; + return markers; } @Override @@ -80,13 +89,26 @@ public String encode(CharSequence rawPassword) { @Override public boolean matches(CharSequence rawPassword, String encodedPassword) { + if (rawPassword == null || rawPassword.length() == 0) { + return false; + } + Set markers = externalLoginMarkers(); // a stored marker is checked before the delegate sees it, since a // marker such as {noop}secret would otherwise match its own suffix - if (rawPassword == null || rawPassword.length() == 0 || isExternalLoginMarker(rawPassword) - || isExternalLoginMarker(encodedPassword)) { + if (markers.contains(encodedPassword) || markers.contains(rawPassword.toString())) { return false; } - return delegate.matches(rawPassword, encodedPassword); + if (!delegate.matches(rawPassword, encodedPassword)) { + return false; + } + // BCrypt, for one, treats some other passwords as equal to a marker, + // so refuse any password whose stored value a marker matches too + for (String marker : markers) { + if (delegate.matches(marker, encodedPassword)) { + return false; + } + } + return true; } @Override diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java index 6443498bc6..970cf8dda8 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java @@ -41,6 +41,8 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.web.context.WebApplicationContext; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -276,6 +278,24 @@ String sign() { } } + @Test + void aPasswordThatBcryptTreatsAsEqualToThePlaceholderNeverMatches() throws Exception { + setProperty("users.passwords.externalAuthValue", ""); + setProperty("users.passwords.externalAuthValue.previous", ""); + provider(); + PasswordEncoder encoder = RollerContext.getPasswordEncoder(); + for (String marker : new String[] {"", "", ""}) { + String stored = encoder.encode(marker); + // BCrypt repeats its key, a NUL byte after each copy, so this + // password gives the same hash as the placeholder + String sameKey = marker + '\0' + marker; + assertTrue(new BCryptPasswordEncoder().matches(sameKey, stored.substring("{bcrypt}".length()))); + assertFalse(encoder.matches(sameKey, stored), marker); + } + // a password that only starts like a placeholder still matches + assertTrue(encoder.matches("x", encoder.encode("x"))); + } + /** The login form's provider, given its encoder the way RollerContext does at startup. */ private static DaoAuthenticationProvider provider() { DaoAuthenticationProvider provider = new DaoAuthenticationProvider(); From d2beeaf4438f982e8d366adcf55cdd82c0ccc7e2 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Fri, 20 Nov 2026 14:02:53 -0700 Subject: [PATCH 07/11] Don't pass a missing or empty stored password to the delegate encoder DelegatingPasswordEncoder throws for a stored value without an encoder prefix when no lazy-upgrade encoder is configured, and for a null value, so such an account ended the login with an exception instead of bad credentials. The encoder now answers false for them. --- .../core/security/ExternalLoginAwarePasswordEncoder.java | 4 +++- .../weblogger/ui/core/ExternalLoginPlaceholderTest.java | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java index aa87e3ce9c..c25b94146e 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java @@ -89,7 +89,9 @@ public String encode(CharSequence rawPassword) { @Override public boolean matches(CharSequence rawPassword, String encodedPassword) { - if (rawPassword == null || rawPassword.length() == 0) { + // the delegate can throw for a missing or empty stored value + if (rawPassword == null || rawPassword.length() == 0 + || encodedPassword == null || encodedPassword.isEmpty()) { return false; } Set markers = externalLoginMarkers(); diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java index 970cf8dda8..fbdae348fd 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java @@ -296,6 +296,15 @@ void aPasswordThatBcryptTreatsAsEqualToThePlaceholderNeverMatches() throws Excep assertTrue(encoder.matches("x", encoder.encode("x"))); } + @Test + void anEmptyOrMissingStoredPasswordDoesNotMatch() throws Exception { + setProperty("passwds.encryption.lazyUpgradeFrom", ""); + provider(); + PasswordEncoder encoder = RollerContext.getPasswordEncoder(); + assertFalse(encoder.matches("secret", "")); + assertFalse(encoder.matches("secret", null)); + } + /** The login form's provider, given its encoder the way RollerContext does at startup. */ private static DaoAuthenticationProvider provider() { DaoAuthenticationProvider provider = new DaoAuthenticationProvider(); From ab7676515e3b01fecbf7c0db3d9220a40108eee3 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Fri, 20 Nov 2026 14:03:14 -0700 Subject: [PATCH 08/11] Log when a password is refused as an external-login marker An account whose real password equals the current, default or a previous marker can't log in, and until now the log didn't say why. The encoder now logs an info line for that refusal, without the password, so an administrator can tell it from a wrong password and set a new one. --- .../ExternalLoginAwarePasswordEncoder.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java index c25b94146e..965b79e019 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java @@ -21,6 +21,8 @@ import java.util.Set; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.roller.weblogger.config.WebloggerConfig; import org.springframework.security.crypto.password.PasswordEncoder; @@ -33,6 +35,8 @@ */ public class ExternalLoginAwarePasswordEncoder implements PasswordEncoder { + private static final Log log = LogFactory.getLog(ExternalLoginAwarePasswordEncoder.class); + /** Stored in place of a password when no other value is configured. */ public static final String DEFAULT_EXTERNAL_LOGIN_MARKER = ""; @@ -97,7 +101,11 @@ public boolean matches(CharSequence rawPassword, String encodedPassword) { Set markers = externalLoginMarkers(); // a stored marker is checked before the delegate sees it, since a // marker such as {noop}secret would otherwise match its own suffix - if (markers.contains(encodedPassword) || markers.contains(rawPassword.toString())) { + if (markers.contains(encodedPassword)) { + return false; + } + if (markers.contains(rawPassword.toString())) { + logRefusal(); return false; } if (!delegate.matches(rawPassword, encodedPassword)) { @@ -107,12 +115,20 @@ public boolean matches(CharSequence rawPassword, String encodedPassword) { // so refuse any password whose stored value a marker matches too for (String marker : markers) { if (delegate.matches(marker, encodedPassword)) { + logRefusal(); return false; } } return true; } + private static void logRefusal() { + // the password itself is never logged + log.info("Refused a password that Roller treats as an external-login marker" + + " (users.passwords.externalAuthValue or its .previous list). An" + + " administrator can set a new password for an account that uses one."); + } + @Override public boolean upgradeEncoding(String encodedPassword) { return delegate.upgradeEncoding(encodedPassword); From c8347ce5d0e902be305db23c4cda0600604c7946 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Fri, 20 Nov 2026 14:03:14 -0700 Subject: [PATCH 09/11] Document the limits of users.passwords.externalAuthValue.previous The list is comma-separated, so a marker that contains a comma can't be listed there. roller.properties now says so, along with the accounts that need an administrator to set a new password. Roller also logs a warning at startup when the configured marker contains a comma. --- .../ui/core/security/ExternalLoginAwarePasswordEncoder.java | 4 ++++ .../org/apache/roller/weblogger/config/roller.properties | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java index 965b79e019..6bf9cc9dd4 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/core/security/ExternalLoginAwarePasswordEncoder.java @@ -44,6 +44,10 @@ public class ExternalLoginAwarePasswordEncoder implements PasswordEncoder { public ExternalLoginAwarePasswordEncoder(PasswordEncoder delegate) { this.delegate = delegate; + if (externalLoginMarker().contains(",")) { + log.warn("users.passwords.externalAuthValue contains a comma, so it can't be listed in" + + " users.passwords.externalAuthValue.previous if the setting changes later."); + } } /** diff --git a/app/src/main/resources/org/apache/roller/weblogger/config/roller.properties b/app/src/main/resources/org/apache/roller/weblogger/config/roller.properties index 074a930cc6..f165134ae6 100644 --- a/app/src/main/resources/org/apache/roller/weblogger/config/roller.properties +++ b/app/src/main/resources/org/apache/roller/weblogger/config/roller.properties @@ -366,7 +366,9 @@ users.passwords.externalAuthValue= # Comma-separated values that users.passwords.externalAuthValue had before. # Accounts created then still have them stored, so list them here when changing -# that setting; none of them is accepted as a password. +# that setting; none of them is accepted as a password. A value that contains +# a comma can't be listed, and an account whose own password is one of them +# needs an administrator to set a new password. users.passwords.externalAuthValue.previous= # Password security settings From bfb437148aa2ff550501678fb4887763471c0364 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Fri, 20 Nov 2026 14:05:08 -0700 Subject: [PATCH 10/11] Test previous external-login markers in the password forms and the encoder ExternalLoginMarkerPasswordTest now checks that registration, the profile page and user administration refuse a marker listed in users.passwords.externalAuthValue.previous, and its tearDown restores the configuration in a finally block. The provider tests for previous markers also check the encoder directly, and the list test covers spaces around an entry. --- .../ui/core/ExternalLoginPlaceholderTest.java | 5 +- .../core/ExternalLoginMarkerPasswordTest.java | 57 ++++++++++++++++--- 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java index fbdae348fd..e93592900c 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/core/ExternalLoginPlaceholderTest.java @@ -163,6 +163,7 @@ void aPreviousEncodedPlaceholderIsNotAPasswordAfterTheSettingChanges() throws Ex assertThrows(AuthenticationException.class, () -> provider.authenticate( new UsernamePasswordAuthenticationToken(userName, ""))); + assertFalse(RollerContext.getPasswordEncoder().matches("", user.getPassword())); } @Test @@ -180,12 +181,14 @@ void aPreviousUnencodedPlaceholderIsNotAPasswordAfterTheSettingChanges() throws assertThrows(AuthenticationException.class, () -> provider.authenticate( new UsernamePasswordAuthenticationToken(userName, "secret"))); + assertFalse(RollerContext.getPasswordEncoder().matches("secret", "{noop}secret")); } @Test void emptyEntriesInThePreviousPlaceholdersAreIgnored() throws Exception { - setProperty("users.passwords.externalAuthValue.previous", ",, ,"); + setProperty("users.passwords.externalAuthValue.previous", ", ,, ,"); + assertTrue(ExternalLoginAwarePasswordEncoder.isExternalLoginMarker("")); assertTrue(ExternalLoginAwarePasswordEncoder.isExternalLoginMarker("")); assertFalse(ExternalLoginAwarePasswordEncoder.isExternalLoginMarker("")); assertFalse(ExternalLoginAwarePasswordEncoder.isExternalLoginMarker(" ")); diff --git a/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java b/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java index 3d9389e6f5..f7b436232d 100644 --- a/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java +++ b/app/src/test/java/org/apache/roller/weblogger/ui/struts2/core/ExternalLoginMarkerPasswordTest.java @@ -75,15 +75,20 @@ void setUp() throws Exception { @AfterEach void tearDown() throws Exception { - factory.close(); - Properties config = config(); - savedProperties.forEach((k, v) -> { - if (v == null) { - config.remove(k); - } else { - config.setProperty(k, v); + try { + if (factory != null) { + factory.close(); } - }); + } finally { + Properties config = config(); + savedProperties.forEach((k, v) -> { + if (v == null) { + config.remove(k); + } else { + config.setProperty(k, v); + } + }); + } } @Test @@ -192,6 +197,42 @@ void anAdministratorCannotCreateAUserWithTheMarker() throws Exception { verify(users, never()).addUser(any()); } + @Test + void theFormsRejectAPreviousMarker() throws Exception { + setProperty("users.passwords.externalAuthValue.previous", ", "); + + Register register = withText(new Register()); + register.getBean().setUserName("newuser"); + register.getBean().setPasswordText(""); + register.getBean().setPasswordConfirm(""); + register.myValidate(); + assertTrue(register.getActionErrors().contains(RESERVED)); + + User user = new User(); + user.setUserName("dbuser"); + user.setPassword("{bcrypt}existing"); + Profile profile = withText(new Profile()); + profile.setAuthenticatedUser(user); + profile.getBean().setPasswordText(""); + profile.getBean().setPasswordConfirm(""); + assertEquals(UIAction.INPUT, profile.save()); + assertTrue(profile.getActionErrors().contains(RESERVED)); + + User admin = new User(); + admin.setUserName("admin"); + UserEdit userEdit = withText(new UserEdit()); + userEdit.setActionName("createUser"); + userEdit.setAuthenticatedUser(admin); + userEdit.myPrepare(); + userEdit.getBean().setUserName("newuser"); + userEdit.getBean().setPassword(""); + assertEquals(UIAction.INPUT, userEdit.save()); + assertTrue(userEdit.getActionErrors().contains(RESERVED)); + + verify(users, never()).saveUser(any()); + verify(users, never()).addUser(any()); + } + private static T withText(T action) { T spied = spy(action); doAnswer(call -> call.getArgument(0)).when(spied).getText(anyString()); From b396cb55d08f6306d4f7a13963e3f69932ab0986 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Fri, 20 Nov 2026 14:05:08 -0700 Subject: [PATCH 11/11] Mention users.passwords.externalAuthValue.previous in CHANGES --- CHANGES.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 549a1ff55c..adaa2d4b91 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -84,8 +84,11 @@ - **New passwords can't be the external-login placeholder.** Registration, the profile page and user administration refuse `users.passwords.externalAuthValue` (by default ``) as a - password, and it never works as one. An administrator can set a new password - for an account that used it (#306). + password, and it never works as one. When you change that setting, list its + earlier values in the new `users.passwords.externalAuthValue.previous` + (comma-separated) so they're treated the same. A login refused for this + reason is logged, and an administrator can set a new password for an + account that used one (#306). - **The LDAP comment authenticator escapes the commenter's user name** when it builds the bind name (#334). - **Roller UI stylesheets, scripts and images don't start a session** (#332).