Repository navigation
fix(auth): compare passwords only through the hash verifier - #38373
freddyDOTCMS wants to merge 8 commits into
Conversation
- Stored values in the older digest format are matched only against the digest of the typed password; a stored value is never compared directly with the input. - Accounts created for SAML, LDAP and CAS sign-in get the hash of a random secret as their local password. - The initial admin password and the passwords generated for new users are stored hashed. - WebDAV sign-in requires the configured pre-authenticator to accept the login, as the portal login already does. - Remove the unused UserLocalUtil. - UserDataGen stores the hash of the password it is given. Fixes dotCMS/private-issues#901 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-ups from code review on this branch: - DotCMSInitDb and UserDataGen mark the account as holding a hash when they store one, matching the SAML and OAuth account-creation paths. - LoginFactory.passwordMatch returns false for an unset stored password instead of letting the verifier raise an unchecked exception, which surfaced as a server error rather than as failed credentials. - DotCMSInitDb logs a failure to set the initial admin password instead of discarding it; the startup flow is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The client-supplied username and the authenticator's message reached the log unchanged, so a carriage return or a terminal control sequence in them altered how the log reads. Route both through the stripLogControls helper this class already uses for folder paths and hostnames. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The helper derived the Authorization header from user.getPassword(), which now holds a hash, so the header carried a value no user can sign in with. Keep the clear text the generator was given and build the header from that. Verified: 61 tests run, 0 failures. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two conflicts, both resolved by keeping all of each side: - MainSuite2a: both sides appended to @SuiteClasses. Kept main's five entries and re-appended this branch's two at the end. - UserDataGen: both sides rewrote the persist javadoc. Merged the two descriptions; the method body had already merged cleanly, so the password hashing and main's updateRememberMeToken call are both present. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Review follow-ups on the new coverage: - SAMLHelperTest provisioned a real user through createNewUser and left it behind; remove it in a finally block. - DotWebdavHelperAuthorizePrincipalTest now extends IntegrationTestBase, like the other integration tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
For review: follow-ups identified during review are tracked as a pending list in the linked issue. Nothing on that list blocks this PR. |
One conflict: MainSuite2a. Both sides appended to @SuiteClasses, which is the end-of-list clash the suite script exists to avoid. Took main's file whole and re-registered this branch's two classes with `just add-it-test`, so they land mid-list instead of at the end. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Claude finished @freddyDOTCMS's task in 3m 8s —— View job Review
I traced the password-storage changes through New Issues
Notes (non-blocking)
The rest of the change is sound:
· |
Summary
DotCMSInitDb) and the passwords generated inUserManagerImpl.notifyNewUsersare stored hashed.auth.pipeline.pre) to accept the login, asUserManagerImpl.authenticatealready does.UserLocalUtil.UserDataGenstores the hash of the password it is given, so tests sign in the same way users do.Behaviour change
Accounts whose stored password is plain text no longer sign in with it and need a password reset.
Tests
PasswordFactoryProxyTest(1)LoginFactoryTest(5),DotWebdavHelperAuthorizePrincipalTest(3)SAMLHelperTest(+1, 13 total)EncryptPlainPasswordsJobTest,UserResourceIntegrationTest,PermissionResourceIntegrationTest,WorkflowResourceLockUnlockIntegrationTest,BinaryExporterServletTestSuite placement (
just suite-timings 6):Fixes dotCMS/private-issues#901
🤖 Generated with Claude Code