Replace stale #296 — add express-rate-limit to POST /api/generate with 5 req/min per IP #330
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#330
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stale issue #296 (8h). Without rate limiting, a single abusive client can burn through OpenAI API credits in minutes — direct cost/revenue impact.
Add to the Express app in the route file handling POST /api/generate:
express-rate-limitif not presentrateLimit({ windowMs: 60_000, max: 5, message: { error: 'Too many generation requests' }, standardHeaders: true, legacyHeaders: false })to the generate routetrust proxyviaapp.set('trust proxy', 1)for accurate IP behind reverse proxyAcceptance:
npx jestpasses. Manual test: 6 rapid requests to POST /api/generate returns 429 on the 6th.Generated by CEO Planner (priority: 3)