Repository navigation
Conversation
PUT /user/{id} changed a password without the current one. An editor
who is not a live admin must now send current_password, and it must
match the target user's stored password. Missing or wrong answers 400,
and the field never reaches the store.
isAdmin and checkPassword join the user store contract. isAdmin needs
the editor and their group live. checkPassword keys a legacy HMAC SHA-1
hash on the bare username, as the hash was written.
|
This is a feature I purposefully left out of NicTool 3. If the user has a login session, they already know the current password. This also presumes that passwords are the primary authentication means, but that's a short-term situation. Passkey support is more desirable. |
|
To be clear, I'd support nuking the current password field entirely, in v2 and v3. |
|
Dropping the password for passkeys, in v2 and v3, sounds good to me. I'd still re-authenticate before any change to an authenticator, and passkeys don't change that. A login session is a bearer token. The web UI keeps the JWT in a cookie that page scripts can read, so an XSS or a shared machine hands it over. With that token alone, anyone can set a new password or add their own passkey, and keep the account after the token expires. NIST SP 800-63B-4 sec. 4.1.2.1 covers binding a new authenticator. The process "requires authentication at either the maximum AAL currently available in the subscriber account or the maximum AAL at which the new authenticator will be used". OWASP ASVS 4.0.3 2.1.6 says the same for passwords: a password change requires the current and new password. So I'd keep the check and make it method-neutral. Today the proof is the current password. Once passkeys land, a fresh passkey assertion satisfies it. I can reshape #101 that way. |
That may be, but it's almost never implemented. I find it annoying to use, especially with a password manager. |
PUT /user/{id}previously changed a password without checking the current password. Now a non-admin sendingpasswordmust also sendcurrent_password, matching the target user's stored password. A missingcurrent_passwordreturns 400 with'current password is required', and a wrong value returns 400 with'current password is incorrect'. An unknown target id returns 404, as before. Admin status is read from the store on each request, not the session. An editor is an admin whenis_adminis set and neither the editor nor their group is deleted. The route dropscurrent_passwordbeforeUser.put, so the store never sees it.The user store contract adds
isAdmin(id)andcheckPassword({ id, password })on mysql, json and toml. The mongodb and elasticsearch stubs throw not yet implemented.checkPasswordusesCredentials.validPasswordand keys legacy HMAC SHA-1 hashes on the bare username, matching how they were written. It does not rewrite the hash.This depends on NicTool/validate#36, which adds
current_passwordtouser.PUT.@nictool/validate1.0.1 rejects the field with 400, so CI fails until validate releases. This PR bumps@nictool/validateto that release once it is out.