You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current state: Basic rate limiting exists in middleware (5 req/15 min).
Remaining issues:
No deduplication - PaperRequest.create() blindly inserts duplicates for same subject + exam + slot + year
No enum validation on exam field before DB insert - invalid values throw a 500 instead of 400
/api/request is already rate limited and src/middleware.ts matches /api/request and allows 5 requests per 15 minutes (paperRequestRatelimit in src/lib/utils/ratelimit.ts), the same as /api/upload. So I think this can be closed
Thanks for checking them out !!
The basic rate limiting is already in place via paperRequestRatelimit in src/middleware.ts (5 requests per 15 minutes). However, keeping this open to address a few remaining gaps:
Duplicate requests - no deduplication on subject + exam + slot + year, so the same paper can flood the DB with identical requests from different users
Missing input validation - exam has an enum in the schema but the route doesn't validate it before the DB call, causing a 500 instead of a clean 400
So we would check if we could work on these and ill update the issue
changed the title [-]Missing Rate Limiting on Paper Requests (/api/request)[/-][+]Improve /api/request: deduplicate requests, add input validation[/+]on Nov 12, 2026
Activity
Dx-Alz-xD commentedon Nov 11, 2026
/api/request is already rate limited and src/middleware.ts matches /api/request and allows 5 requests per 15 minutes (paperRequestRatelimit in src/lib/utils/ratelimit.ts), the same as /api/upload. So I think this can be closed
Rithish-2914 commentedon Nov 12, 2026
Thanks for checking them out !!
The basic rate limiting is already in place via paperRequestRatelimit in src/middleware.ts (5 requests per 15 minutes). However, keeping this open to address a few remaining gaps:
Duplicate requests - no deduplication on subject + exam + slot + year, so the same paper can flood the DB with identical requests from different users
Missing input validation - exam has an enum in the schema but the route doesn't validate it before the DB call, causing a 500 instead of a clean 400
So we would check if we could work on these and ill update the issue
[-]Missing Rate Limiting on Paper Requests (/api/request)[/-][+]Improve /api/request: deduplicate requests, add input validation[/+]Dx-Alz-xD commentedon Nov 12, 2026
go thru this once