Skip to content
SprecherEast
Issue 555

bug: A signed-in account may be able to change its own email without confirming the new address

Back to our plan
Done
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 create operation sends the verification email or sets _verified (node_modules/payload/dist/collections/operations).
  • Users has update: isAdminOrSelf, and no hook guards email. requireCurrentPassword.ts guards only password.
  • src/payload.config.protectedFields.test.ts has no email-change case.

What to do

  1. Add failing cases to src/payload.config.protectedFields.test.ts: a guest, a resident and an editor each sending PATCH /api/users/<own id> with a new email; a GraphQL update; a Local API update with overrideAccess: false.
  2. If they fail, add a beforeChange hook in src/modules/accounts/cms/ modeled on requireCurrentPassword.ts: refuse a change to your own email (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.
  3. Update accessPolicy.test.ts if needed and the users bullet in docs/guidelines/security.md.
  4. 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

See it on GitHub, opens in a new tab