Merged
Conversation
Implement @nestjs/throttler with Redis-backed storage for request rate limiting. Global default of 60 req/60s per IP with stricter limits on auth login (5/60s), auth refresh (10/60s), and Moodle login (5/60s). Health endpoint exempt. Custom guard fails open on Redis unavailability with warning log.
10 tasks
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
@nestjs/throttlerv6 with Redis-backed storage (@nest-lab/throttler-storage-redis) for per-IP request rate limitingThrottlerGuardsubclass with fail-open resilience — allows requests through with a warning log if Redis is unavailable@SkipThrottle()THROTTLE_TTL_SECONDS,THROTTLE_LIMIT) with Zod validation (integer, min 1)Closes #88
Test plan
CustomThrottlerGuard(extends base, 429 passthrough, fail-open on Redis error, fail-open on non-Error throws)npm run start:dev+docker compose up, rapid-fire curl requests, verify 429 responses andRetry-Afterheader