Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the rate limiting configuration for authentication routes by consolidating limiters and increasing rate limits. The changes remove the separate authentication-specific rate limiter and make the default limiter more permissive.
- Renamed
oneMinuteLimitertodefaultLimiterand increased its limit from 1 to 10 requests per minute - Increased
twentyFourHourLimiterfrom 10 to 20 requests per day - Removed the separate
authLimiterand updated authentication routes to use the newdefaultLimiter
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/utils/constants.ts | Updated magic numbers by removing THREE and adding TWENTY constant |
| src/routes/auth.routes.ts | Replaced authLimiter import and usage with defaultLimiter |
| src/middlewares/limiters.middleware.ts | Renamed and reconfigured rate limiters, removed authLimiter |
…into refactor/auth-rate-limit
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.
This PR updates the rate-limiting logic for authentication routes to allow more requests per minute and per day, and removes the separate limiter for authentication. The main changes involve renaming and adjusting the rate limiter configuration, as well as updating references to utilize the new limiter.
Rate limiter configuration changes:
oneMinuteLimitertodefaultLimiterand increased its request allowance from 1 to 10 per minute.twentyFourHourLimiterfrom 10 to 20 requests per day.authLimiter(which previously allowed 3 requests per minute).MAGIC_NUMBERS.MAX_NUMBER_OF_ALLOWED_REQUESTSconstants to removeTHREEand addTWENTY.Route middleware updates:
defaultLimiterinstead ofauthLimiter.