Skip to content

bug(auth-client): fix "Incorrect email case" on password checks#20906

Draft
nshirley wants to merge 1 commit into
mainfrom
FXA-14223
Draft

bug(auth-client): fix "Incorrect email case" on password checks#20906
nshirley wants to merge 1 commit into
mainfrom
FXA-14223

Conversation

@nshirley

@nshirley nshirley commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Because

  • When an account's signup email (accounts.email) differs from its current
    primary email, the current-password check derived v1 credentials from the
    signup email — but the stored verifier may be salted with the primary email
    (e.g. after a password reset that followed a primary-email change). The
    mismatch surfaced to users as an "Incorrect email case" error, blocking
    Change Password, Create Recovery Key, and Delete Account with no self-serve
    workaround.

This pull request

  • Salts the first current-password derivation attempt with the primary email
    (the address the user authenticates with) and falls back to the signup email
    on INCORRECT_EMAIL_CASE, in sessionReauth, accountDestroy, and
    passwordChangeWithJWT (packages/fxa-auth-client/lib/client.ts). Accounts
    where the two emails match are unaffected (single attempt).
  • Fixes a latent retry bug in accountDestroy where the retry spread the
    server error object into the email input, resolving the payload email to the
    signup address instead of the primary.
  • Adds unit tests in packages/fxa-auth-client/test/client.ts covering the
    primary→signup fallback, the single-request happy path, and non-email-case
    errors not retrying.

Issue that this pull request solves

Closes: FXA-14223

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on: the salt selection in sessionReauth /
    accountDestroy (conditional) and passwordChangeWithJWT (candidate loop).
  • Suggested review order: sessionReauth first (shared pattern), then
    passwordChangeWithJWT, then the tests.
  • Risky or complex parts: the salt is intentionally decoupled from each route's
    identity email — reauth identifies the account by the primary, while the
    /mfa/password/change payload keeps the signup email so the server's
    emailsMatch(email, accounts.email) check still holds.

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

…imary emails differ

Because:
 - When an account's signup email differs from its current primary, the
   current-password check derived v1 credentials from the signup email, but
   the stored verifier may be salted with the primary. This blocked password
   change, recovery-key setup, and account deletion with "Incorrect email case".

This commit:
 - Salts the first attempt with the primary email and falls back to the signup
   email on INCORRECT_EMAIL_CASE in sessionReauth, accountDestroy, and
   passwordChangeWithJWT; adds tests covering both salt cases.

Closes FXA-14223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant