Group
  • Security

    Add request body size limits

    Caps payload sizes on every endpoint so huge requests can't exhaust memory or disk.

    • Improve quality
    • Beginner
    • General

Free Prompt

Add request size limits to my app. Check the body parser configuration (JSON, urlencoded, text, multipart) and any raw body handling. Apply a sensible default cap for JSON and form bodies (1MB or less is right for most apps; smaller for simple APIs), and larger explicit limits only on the specific endpoints that need them, like file uploads. Make sure exceeding the limit returns a clean 413 response instead of crashing or hanging. If my framework's defaults are unlimited or very large (Express's json parser defaults, for example, are often left wide open in generated code), tighten them explicitly. Do not break legitimate large requests: if the app imports CSVs or accepts rich text documents, set those endpoints' limits to fit their real maximum with headroom, not unlimited. Do not change response formats. Show me the limits per endpoint type and the reasoning. Give me a verification step: send an oversized payload to a JSON endpoint and confirm it gets a 413 rather than a timeout or a 500.

What This Does / How This Helps

Caps how big a request body can be on every endpoint, with bigger allowances only where uploads genuinely need them. Without limits, a single request carrying a multi-gigabyte JSON body can pin your server's memory while it parses, and a handful of those at once takes the app down. It's one of the cheapest denial-of-service attacks to run and one of the cheapest to prevent. You get per-endpoint limits sized to real usage, plus a test that sends an oversized payload and watches it get refused cleanly.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts