-
Notifications
You must be signed in to change notification settings - Fork 4
PRD-15: Production-Grade Rate Limiting with Redis #11
Copy link
Copy link
Open
Labels
P0Production blocker priorityProduction blocker priorityphase-1Production blockersProduction blockersprdProduct requirement documentProduct requirement documentsecuritySecurity hardeningSecurity hardening
Description
Replace in-memory fixed-window rate limiting with Redis-backed sliding window, tiered endpoint limits, per-signer limits, and temporary banning.
Acceptance Criteria
- Redis added to
docker-compose.ymlwith health check - Rate limiting uses Redis when available, falls back to in-memory when Redis is down
- Sliding window algorithm (no fixed-window burst vulnerability)
- Per-IP limits enforced for all endpoints
- Per-signer limits enforced for API key-authenticated requests
- Signing endpoints: 20 req/min, Auth: 10 req/min, General: 100 req/min
-
X-RateLimit-LimitandX-RateLimit-Remainingheaders in all responses -
Retry-Afterheader in 429 responses - Temporary ban after 10 consecutive violations
- All limits configurable via environment variables
- Redis password support enabled
Tasks
- Add
redisservice todocker-compose.yml - Create
redis.module.ts - Create
rate-limiter.service.tswith sliding window + Redis - Rewrite
rate-limit.guard.tswith tiers - Apply
@RateLimit()decorators to signing, auth, DKG controllers - Write tests: sliding window, Redis fallback, 429 headers, temporary ban
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P0Production blocker priorityProduction blocker priorityphase-1Production blockersProduction blockersprdProduct requirement documentProduct requirement documentsecuritySecurity hardeningSecurity hardening