Abuse Controls and Security Vectors
Limit costly or harmful actions with rules your server enforces: caps on what people can send, shared and per-person limits, light monitoring, and a clear way back for honest users.
Content date: October 15, 2026.
Plain English
A feature you allow can still be abused. Someone can send thousands of messages, tie up your export worker, or run up your AI bill. Abuse controls look at the action and what it costs you, not just whether the person is logged in. Find the scarce resource (money, server time, email reputation, storage) and set limits before it gets used. A public information page needs different controls than an upload form or an AI endpoint.
Use this when
Do it before you open a contact form, login, upload, invitation, URL fetch, paid API action, or anything else that could cause harm or cost if misused.
If you are just starting
Use the supplied quota exercise. It keeps counts in memory, uses made-up users, and fixes the clock so results repeat. Watch the per-user limit and the shared limit, see oversized input rejected, and see what happens when the time window resets. The server must enforce every limit, because a disabled Submit button is only a hint. Decide what an honest person sees when blocked and how they get back in, without a design that makes their browser retry over and over.
When your project grows
Mix controls to fit the surface: verified identity, caps on request size and workload, quotas per account and across everyone, limits on simultaneous work and time, safe input handling, and light monitoring. Decide what happens if the limit store goes down: block everyone or let everyone through. Several copies of your app must share one limit with atomic updates, meaning updates that cannot interleave. A counter inside one process is not a limit for the whole system. Return 429 Too Many Requests when a caller goes too fast, as OWASP's REST guidance suggests. Limits by IP address alone can punish many people on one shared network. Input checks do not replace parameterized queries, output encoding, upload rules, CSRF protection, or limits on which URLs your server may fetch.
Worked example
A bakery's order site lets each customer export two sales reports an hour. It runs on two servers, each with its own count, so one customer gets two exports from each, four in all. A single-process practice run passes and still says nothing about the real cap. The lab shows this on purpose. A real deployment needs a shared atomic counter and a decision about what to do when it is unreachable.
Practice
Measure a bounded abuse policy
- Read the local quota lab and write down its per-person and shared limits.
- Run its fixed cases: exactly at the limit, a different person, a full shared budget, oversized input, and a window reset.
- For each rejected call, note whether the quota count and protected-work count stayed the same.
- Compare two separate limiter instances and explain why their combined allowance is not a deployment-wide cap.
- Fill in the worksheet's table for your app, adding shared limit state, recovery, and checks for forgery, injection, URL fetching, and uploads.
Deliverable: A table of quota results you observed, a note on how an honest user recovers, and a table of controls and gaps for each part of your app.
Common mistakes to watch for
- The app checks the limit after the expensive AI call has run, so the bill still arrives.
- The quota key comes from a caller-supplied field, so one user charges usage to someone else.
- A restart resets an in-memory counter, or a second server doubles the allowance.
- A new block stops honest customers during a sale with no way to recover.
- A team says one rate limit has fixed injection, request forgery, and file-upload risks.
Prompting
A weak prompt
Add a CAPTCHA and rate limit everywhere so abuse is solved.
A better prompt
For [workflow], list where an abuser could cause cost or harm and the scarce resource at each. Propose server-side limits on input size, rate, simultaneous work, and spend. Say where the limit key comes from, how app copies share state, what happens if the limiter fails, and how an honest user recovers. Test with made-up data and a small fixed number of requests, and show rejected requests never trigger the protected action. Keep injection, request forgery, URL fetching, and uploads separate.
It ties each defense to a real cost and keeps other kinds of attack on the list instead of letting one rate limit stand in for all of them.
Check before you move on
- You named the costly action.
- The limit is checked before the work starts.
- The server decides whose quota is used.
- You tested personal and shared limits.
- You know what happens on failure or reset.
- Other attack types are listed separately.
You are done when
- The results you saw match the policy you wrote, and rejected requests never trigger the protected action.
- Your report does not claim that an in-memory quota or a CAPTCHA protects every part of a deployed app.
Questions to think about
Your page disables Submit after two clicks. Is the server's limit enforced?
No. Anyone can send requests without your page. The server must count and refuse on its own.
Two app copies each keep their own in-memory counter allowing 5 uses. How many can one user get?
Up to 10, because each copy approves its own 5 without knowing about the other. A real shared limit needs one store with atomic updates.
You cap a "fetch this URL" feature at two requests a minute. Does that stop server-side request forgery?
No. One request to a forbidden internal address can still do damage. You need rules on allowed destinations and redirects, not just volume.