You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
help wantedOpen for all. You do not need permission to work on these.platform: apiServer application that needs familiarity with Express, Fastify, MongoDB etc.
PUT /update-my-email writes the requested address to user.newEmail before checking whether an email confirmation was sent within the rate-limit window. If a user requests a change to address A and then requests address B within five minutes, the second request returns 429, but newEmail has already changed to B.
The confirmation link sent to A then fails because /confirm-email requires the link's email to equal the current targetUser.newEmail.
Affected Page
/update-my-email and /confirm-email endpoints (defined in settings.ts).
Steps to Reproduce
Request an email change to address A (e.g., via PUT /update-my-email with { "email": "[email protected]" }).
Before five minutes have passed, request an email change to address B (e.g., via PUT /update-my-email with { "email": "[email protected]" }).
Observe that the second request returns 429 (Too Many Requests) and no message is sent to B.
Open the confirmation link previously sent to A (which contains address A in the encoded email query param).
The link is rejected because the stored newEmail in the database has already been updated to B.
Expected behavior
A rate-limited request should not modify the pending email address. The confirmation link already sent to A should remain valid.
System
Device: N/A (API Bug)
OS: Linux
Browser: N/A
Version: N/A
Additional context
Suggested Fix:
Check emailAuthLinkTTL before updating newEmail, emailVerified, or emailVerifyTTL in settings.ts. Ensure that if the rate-limit check fails, the request returns 429 without making any database changes to the user's pending email configuration.
Hi! I investigated this issue and was able to identify the problematic flow in the "/update-my-email" handler. I'd like to work on fixing it. Could you please assign it to me? Thanks!
The current /update-my-email flow updates newEmail, emailVerified, and emailVerifyTTL before checking emailAuthLinkTTL for the general resend rate limit. So a second request to a different address within the five-minute window returns 429, but still changes user.newEmail. That then causes the original /confirm-email link to fail because it no longer matches the stored pending email.
A fix should move the emailAuthLinkTTL rate-limit check ahead of the user update, so a rate-limited request exits without mutating the pending email state. Please include a regression test for the "request A, immediately request B, B returns 429 and newEmail remains A" case.
help wantedOpen for all. You do not need permission to work on these.platform: apiServer application that needs familiarity with Express, Fastify, MongoDB etc.
Activity
ManyaB2005 commentedon Jul 12, 2026
Hi! I investigated this issue and was able to identify the problematic flow in the "/update-my-email" handler. I'd like to work on fixing it. Could you please assign it to me? Thanks!
Sembauke commentedon Jul 14, 2026
Confirmed, thanks for the clear report.
The current
/update-my-emailflow updatesnewEmail,emailVerified, andemailVerifyTTLbefore checkingemailAuthLinkTTLfor the general resend rate limit. So a second request to a different address within the five-minute window returns429, but still changesuser.newEmail. That then causes the original/confirm-emaillink to fail because it no longer matches the stored pending email.A fix should move the
emailAuthLinkTTLrate-limit check ahead of the user update, so a rate-limited request exits without mutating the pending email state. Please include a regression test for the "request A, immediately request B, B returns 429 andnewEmailremains A" case.saikiranrayabarapu commentedon Jul 14, 2026
I'm looking into this