Repository navigation
fix: stop logging plaintext new password in admin password reset - #918
SeanDuggan wants to merge 10 commits into
Conversation
log.debug(newPass = + newPassword) wrote the new plaintext password to the debug log whenever an admin reset a users password. Redact it, matching the existing pattern used for passwords elsewhere in the admin servlets (log the fact it was retrieved, not the value). Fixes OWASP#571
|
that @SeanDuggan , the fix looks good. However, we should probably have an integration test for this. I reckon put it in Create a target user with Assert that the password was really updated (the response contains “password has been updated”). Then assert that no captured message contains the password. Without the first assertion the test could pass just because the servlet failed early. |
Adds ChangeUserPasswordIT, which attaches a capturing appender to the servlet logger at DEBUG, resets a user's password, and checks that the update succeeded and the new password appears in no log message.
|
Added an integration test for this fix: src/it/java/servlets/admin/userManagement/ChangeUserPasswordIT.java. It signs in as an admin, creates a target user, and attaches a capturing log4j appender to the ChangeUserPassword logger at DEBUG. Then it resets the user's password through the servlet. It asserts that the response contains "password has been updated", so a servlet that bails out early can't pass. It also asserts that the debug output was captured. Finally it asserts that no captured log message contains the new password. I checked it both ways locally against MariaDB 12.3. With the fix it passes. With log.debug("newPass = " + newPassword) put back, it fails with "New password was written to the log: newPass = ...". spotless:check passes. |
Fixes #571