Group
  • Testing

    Test that my rate limiting actually limits

    Verify rate limits trigger at the right thresholds, return correct responses, and reset when they should.

    • Improve quality
    • Debug & fix
    • Intermediate
    • General

Free Prompt

My app has rate limiting (or should), and I want tests proving it actually engages instead of just existing in the config. First, inventory what's rate limited: login attempts, password resets, API endpoints, signup, expensive operations like exports or AI calls. Note the configured limits for each. If nothing is rate limited, flag the endpoints that most need it (login, reset, signup, anything that costs money per call) and wait for my decision before proceeding. Then write tests for each limited path: 1. Requests under the limit succeed normally. 2. Requests over the limit are rejected with the correct status (429) and a response that tells the client when to retry, without leaking internal details. 3. The limit applies per the intended key: per IP, per account, or per token, whichever my design says. Two different users shouldn't share a budget, and one user shouldn't be able to multiply their budget by rotating IPs if the limit is per account. 4. The window resets: after the limit period passes, requests succeed again. 5. Legitimate bursts on unrelated endpoints aren't affected (the limiter isn't accidentally global). Control time in the tests where possible so window-reset tests don't take real minutes. When finished, run the suite and report: which limits engage at the right threshold, which are misconfigured, and which critical endpoints have no limit at all.

What This Does / How This Helps

This tests that your rate limiting actually fires: correct thresholds, 429 responses, per-user versus per-IP behavior, window resets, and no accidental global limiting. Rate limiting is frequently configured and rarely verified. A limiter keyed wrong, scoped globally, or set to a window that never resets either does nothing or punishes legitimate users. And an unlimited login or reset endpoint is an open invitation to credential stuffing the day your app appears in any directory. Testing the behavior, not the config, is the only way to know which one you have.

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