Repository navigation
fix(auth): allow two email codes per address per minute - #3553
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow two verification emails per address in a rolling 60-second window. A user can request a code on their phone and then immediately request another on desktop; a third request within the window still returns
email_rate_limit.Type and Areas
Type: bug fix
Areas: shared identity service, email authentication, service documentation
Motivation / Impact
The previous one-code-per-minute quota was shared across devices and remained charged after successful sign-in. Signing in on a phone could therefore block the following desktop sign-in until the minute elapsed.
The atomic database admission now permits two sends per address per rolling minute. The rolling 24-hour address limit of 20, global limit of 300 sends per minute, code expiration and verification-attempt limits remain unchanged. Tests cover concurrent requests, rolling-window recovery, persistence across service reopen, immediate sign-in through a second flow, and the existing daily/global limits.
Verification
pnpm run fmt:rsandgit diff --checkpassed.cargo test --locked -p openbitfun-miniapp-market-service --lib email_auth::testspassed: 16 tests.cargo check --locked -p openbitfun-miniapp-market-serverpassed.8777e9a022d9770d5b501bf979f705e7ffcb55b4; deployed container reports that revision and is healthy. Public health, auth configuration and sign-in page checks passed.Reviewer Notes
No schema, payload or client protocol changes. Existing persisted send records continue to count toward the quota. The fix is already deployed; this PR records it in main for subsequent releases.
AI-assisted implementation. Testing level: service regression tests and production deployment smoke checks; physical device end-to-end testing was not performed.
Checklist