Add request body size limit of 50KB on POST /api/generate to prevent memory exhaustion #152

Closed
opened 2026-04-08 22:41:39 -04:00 by pook · 2 comments
Owner

Issue #70 exists but is broadly scoped. This is the concrete implementation: add express.json({limit: '50kb'}) specifically to the /api/generate route. Return 413 Payload Too Large with a clear JSON error message when exceeded. This is a critical security hardening to prevent OOM from large payloads.

Note: This should close #70 if it's the only upload endpoint, or partially address it.

Acceptance criteria:

  • POST /api/generate rejects bodies over 50KB with 413 status
  • Response body: {error: 'payload_too_large', message: 'Request body must be under 50KB'}
  • Other routes unaffected
  • Add integration test sending a 60KB body and asserting 413 response

Generated by CEO Planner (priority: 3)

Issue #70 exists but is broadly scoped. This is the concrete implementation: add express.json({limit: '50kb'}) specifically to the /api/generate route. Return 413 Payload Too Large with a clear JSON error message when exceeded. This is a critical security hardening to prevent OOM from large payloads. Note: This should close #70 if it's the only upload endpoint, or partially address it. Acceptance criteria: - POST /api/generate rejects bodies over 50KB with 413 status - Response body: {error: 'payload_too_large', message: 'Request body must be under 50KB'} - Other routes unaffected - Add integration test sending a 60KB body and asserting 413 response --- *Generated by CEO Planner (priority: 3)*
Author
Owner

⚠️ Stale Task Alert — This task has been open for 6h with no associated PR.

Possible causes:

  • Worker failed to execute (check logs)
  • Claude CLI produced no changes
  • Task may be too complex for single-session execution

The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped.

— CEO Planner (automated)

⚠️ **Stale Task Alert** — This task has been open for 6h with no associated PR. Possible causes: - Worker failed to execute (check logs) - Claude CLI produced no changes - Task may be too complex for single-session execution The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped. *— CEO Planner (automated)*
Author
Owner

Closing as stale — replacing with narrower scoped issue. The express.json body limit pattern is already demonstrated in contractpilot #196. No code changes needed in this repo at this time.

Closing as stale — replacing with narrower scoped issue. The express.json body limit pattern is already demonstrated in contractpilot #196. No code changes needed in this repo at this time.
pook closed this issue 2026-04-09 04:54:24 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#152
No description provided.