Skip to content

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

Open
mraible wants to merge 4 commits into
roller-6.1.xfrom
external-login-placeholder-6.1.x
Open

mraible wants to merge 4 commits into
roller-6.1.xfrom
external-login-placeholder-6.1.x

Conversation

@mraible

@mraible mraible commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

The 6.1.x version of #304.

Users who log in through LDAP or the servlet container have users.passwords.externalAuthValue (by default <externalAuth>) stored in place of a Roller password. RollerContext now wraps its password encoder in a new ExternalLoginAwarePasswordEncoder, whose matches() never accepts that placeholder, the default <externalAuth> or an empty password, wherever Roller checks a password with the encoder. Encoding and upgradeEncoding are unchanged, and stored passwords aren't touched.

As on #304, registration, the profile page and the admin user editor refuse the placeholder as a new password, and an empty users.passwords.externalAuthValue falls back to <externalAuth>.

This line builds for Java 11, so the wrapper is a class rather than the record #304 uses, and RollerContext.encoder is now typed as PasswordEncoder.

  • ExternalLoginAwarePasswordEncoderTest checks that the placeholder doesn't match, encoded or unencoded, and that other passwords (bcrypt and plaintext) still do.
  • ExternalLoginPlaceholderTest checks the placeholder encoded and unencoded, the default placeholder under another configured value, an empty configured value and an ordinary password, and ExternalLoginMarkerPasswordTest checks that registration, the profile page and the admin user editor refuse the placeholder.
  • mvn test passes.

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 97851146f: The wrapper covers the password checks that use RollerContext’s encoder. Two marker edge cases need attention, and this PR lacks the provider-level test present in #304.

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

@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.

Reviewed current head 2537a6d. The stored-marker check has a conditional authentication bypass when the configured marker uses a supported password-encoder prefix.

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