Issue 555
bug: A signed-in account may be able to change its own email without confirming the new address
Back to our planDone
bugcmsauthpriority: high
Summary
A signed-in member can probably change their own account's email address without confirming the new address, and the account stays marked "verified". That would let someone take over the identity "this email belongs to this account", which the contact form (#501) and password resets rely on. Found while grooming #553; not yet reproduced, so the first step is a failing test.
Evidence
- In Payload 3.91.0, only the
createoperation sends the verification email or sets_verified(node_modules/payload/dist/collections/operations). Usershasupdate: isAdminOrSelf, and no hook guardsemail.requireCurrentPassword.tsguards onlypassword.src/payload.config.protectedFields.test.tshas no email-change case.
What to do
- Add failing cases to
src/payload.config.protectedFields.test.ts: a guest, a resident and an editor each sendingPATCH /api/users/<own id>with a newemail; a GraphQL update; a Local API update withoverrideAccess: false. - If they fail, add a
beforeChangehook insrc/modules/accounts/cms/modeled onrequireCurrentPassword.ts: refuse a change to your ownemail(fixed 403 text) unless a server-only context flag says it came from the email-change flow (#553 sub-issue 3). An admin changing someone else's account still works. - Update
accessPolicy.test.tsif needed and the users bullet indocs/guidelines/security.md. - If the tests pass without a fix, close this with the test added as a regression guard.
Acceptance criteria
- Not done: Every path above is refused with a fixed message; the admin case passes.
- Not done: Existing sign-in, sign-up and password flows are unchanged.
- Not done: Opus high-effort review (auth code).
Area
auth, cms
Priority
high
Generated by Claude Code, opens in a new tab