DESCRIPTION
The NestJS API has no rate limiting. Any actor can send unlimited requests to any endpoint, enabling abuse, DoS, and brute-force attacks against POST /auth/login. This task adds ThrottlerModule with sensible global and per-route defaults.
GOAL
API endpoints are protected by rate limiting. Abusive callers receive 429 Too Many Requests with a Retry-After header once they exceed the configured threshold.
REQUIREMENTS
- Install
@nestjs/throttler in apps/api
- Configure
ThrottlerModule globally in AppModule: default 100 req / 60 s per IP
- Stricter limits on sensitive endpoints:
POST /auth/login (10 req/min), POST /bonds (20 req/min)
- Return standard 429 with a
Retry-After header
- Add
THROTTLE_TTL and THROTTLE_LIMIT to .env.example for configurability
ACCEPTANCE CRITERIA
NOTES
Relevant files: apps/api/src/app.module.ts, apps/api/src/auth/auth.controller.ts, apps/api/src/bonds/bonds.controller.ts, apps/api/.env.example. Good first task — no blockchain knowledge required. Reference: https://docs.nestjs.com/security/rate-limiting
Difficulty: Beginner
Priority: Medium
DESCRIPTION
The NestJS API has no rate limiting. Any actor can send unlimited requests to any endpoint, enabling abuse, DoS, and brute-force attacks against
POST /auth/login. This task addsThrottlerModulewith sensible global and per-route defaults.GOAL
API endpoints are protected by rate limiting. Abusive callers receive
429 Too Many Requestswith aRetry-Afterheader once they exceed the configured threshold.REQUIREMENTS
@nestjs/throttlerinapps/apiThrottlerModuleglobally inAppModule: default 100 req / 60 s per IPPOST /auth/login(10 req/min),POST /bonds(20 req/min)Retry-AfterheaderTHROTTLE_TTLandTHROTTLE_LIMITto.env.examplefor configurabilityACCEPTANCE CRITERIA
POST /auth/loginis blocked after 10 requests in 60sRetry-AfterheaderTHROTTLE_*vars documented in.env.exampleNOTES
Relevant files:
apps/api/src/app.module.ts,apps/api/src/auth/auth.controller.ts,apps/api/src/bonds/bonds.controller.ts,apps/api/.env.example. Good first task — no blockchain knowledge required. Reference: https://docs.nestjs.com/security/rate-limitingDifficulty: Beginner
Priority: Medium