Skip to content

verification attempts limit OTP - #817

Merged
Nabeelahh merged 1 commit into
Akazajan:mainfrom
Archive-000:feat/Rate-limit-OTP-verification-attempts
Oct 17, 2026
Merged

Nabeelahh merged 1 commit into
Akazajan:mainfrom
Archive-000:feat/Rate-limit-OTP-verification-attempts

Conversation

@Archive-000

Copy link
Copy Markdown
Contributor

PR Summary closes #618

Implemented rate-limiting and bounded repeated guesses against the email-verification and password-reset OTP endpoints to prevent brute-force attacks and abuse.

Changes & Implementation closes #616

  • Attempt Window & Throttling (auth.service.ts, auth.controller.ts):
  • Defined a per-identity attempt window and tracking mechanism for OTP verifications.
  • Configured a consistent throttling response (e.g., standard HTTP status and error message) when attempt limits are exceeded.

Scope closes #615

  • backend/src/auth/auth.controller.ts
  • backend/src/auth/auth.service.ts
  • backend/src/auth/auth.service.spec.ts

Testing Instructions closes #617

  1. Trigger multiple failed OTP attempts for a specific email/identity on the password-reset or email-verification endpoints.
  2. Verify that subsequent attempts within the window return the expected consistent throttling response.
  3. Verify that attempt counters successfully reset or expire after the defined time window elapses.
  4. Run unit tests locally:
npm test -- backend/src/auth/auth.service.spec.ts

@Nabeelahh
Nabeelahh merged commit 782ecb0 into Akazajan:main Oct 17, 2026
0 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant