Skip to content

Don't match the external-login placeholder as a password - #304

Merged
mraible merged 5 commits into
masterfrom
external-login-placeholder
Nov 20, 2026
Merged

mraible merged 5 commits into
masterfrom
external-login-placeholder

Conversation

@mraible

@mraible mraible commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Users who log in through LDAP or the servlet container have users.passwords.externalAuthValue (by default <externalAuth>) stored in place of a Roller password. RollerPasswordEncoders now wraps the encoder so that matches() never accepts that placeholder, the default <externalAuth> or an empty password, wherever Roller checks a password with it. Registration, the profile page and the admin user editor refuse the placeholder as a new password, and an empty setting falls back to <externalAuth>. Encoding and upgradeEncoding are unchanged, and stored passwords aren't touched.

create() now returns PasswordEncoder instead of DelegatingPasswordEncoder; its callers already use it as a PasswordEncoder, including #300's SecurityConfig.

  • ExternalLoginPlaceholderTest checks a login through DaoAuthenticationProvider and RollerUserDetailsService for a user whose stored password is the placeholder, encoded and unencoded, and the encoder directly. The login cases fail without the change.
  • ExternalLoginMarkerPasswordTest checks that the three forms refuse the placeholder.
  • mvn test passes.

A further review pass added these fixes:

  • Registering without a password outside db mode shows a validation result instead of an error page.
  • Remember-me uses the same placeholder as everything else, with no change under the default configuration.

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.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review of cfb28cc49: The wrapper covers the password checks used by DAO login, AtomPub, and XML-RPC, and the login tests exercise the changed path. The twin’s different wrapper location is explained by the older branch’s encoder factory.

…match an empty one

Registration, the profile page and the admin user editor now reject users.passwords.externalAuthValue, and the default <externalAuth>, 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 <externalAuth> for what Roller stores, and the password encoder never matches an empty password or the default placeholder.
@mraible

mraible commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

A second review raised a few more points, now addressed in the latest commits:

  • The encoder and the forms now also refuse the default "" whatever value is configured, so accounts stored before the setting changed can't use it either; a list of earlier values could be added if anyone needs it. create() returning PasswordEncoder rather than DelegatingPasswordEncoder only affects Roller itself: the class is new since the last release and RollerContext is its only caller.

…ember-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 RollerPasswordEncoders.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.

Also removes the duplicate RollerPasswordEncoders imports, and makes the tests restore WebloggerConfig properties even when user teardown fails or the original value was not set.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review of 2e66914e5: The current fix covers the password checks and password-setting forms reviewed. The twin PR has the same behavior; its separate wrapper and startup change reflect the older branch’s encoder setup. Tests were reviewed but not run.

Earlier comments: 3 of 3 resolved.

No new issues found.

@mraible
mraible merged commit 67ddae8 into master Nov 20, 2026
9 checks passed
@mraible
mraible deleted the external-login-placeholder branch November 20, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants