OTWO-7704 Rate-limiting on password reset request - #1933
Open
bd-vaibhav wants to merge 1 commit into
Open
Conversation
bd-vaibhav
requested review from
Niharika1117 and
Priya5
and
a lite review from Copilot
August 5, 2026 07:13
There was a problem hiding this comment.
Pull request overview
Adds account-level rate limiting for password reset requests to reduce abuse, including persistence for rate-limit state, controller enforcement, user-facing messaging, and controller test coverage.
Changes:
- Adds
password_reset_countandpassword_reset_requested_atcolumns toaccountsto persist rate-limit state. - Introduces cooldown + rolling-window enforcement around
PasswordResetsController#create, and records reset-request attempts. - Expands controller tests and adds i18n strings for rate-limit error messaging.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| test/controllers/password_resets_controller_test.rb | Adds boundary/behavior tests for cooldown and rolling-window limits. |
| db/migrate/20260804172050_add_password_reset_rate_limit_to_accounts.rb | Adds persistent counters/timestamps needed for per-account rate limiting. |
| config/locales/en.yml | Adds i18n strings for password reset rate-limit messages and template-relative keys. |
| app/controllers/password_resets_controller.rb | Implements rate-limit checks and request recording around password reset creation. |
Suppressed comments (1)
test/controllers/password_resets_controller_test.rb:66
- The example says it resets the counter "at exactly 10 minute boundary" but the time travel uses
10.minutes + 1.second. This misses the exact boundary condition your controller logic depends on (last > RESET_WINDOW.ago).
travel_to base_time + 10.minutes + 1.second do
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bd-vaibhav
force-pushed
the
OTWO-7704
branch
2 times, most recently
from
August 5, 2026 10:15
b9b9620 to
d197f0a
Compare
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.
No description provided.