Resources

Rate Limiting and Compliance: Staying on the Right Side of Data Privacy Laws

Rate Limiting and Compliance: Staying on the Right Side of Data Privacy Laws

Rate limiting will not stop a determined botnet, and it is not a compliance control by itself. Imperva says plainly that attacks spread over many sources, sometimes millions of IP addresses, can each stay under the limit. What it does well is narrow and cheap: it keeps one source from exhausting a login form, an API or a checkout, which protects both the data and its availability.

What rate limiting stops and what it lets through

Imperva describes rate limiting as a technique that limits network traffic so users cannot exhaust system resources. It tracks the IP addresses requests come from and the time between them, and a source that goes over the limit is throttled, with its requests left unfulfilled for the next timeframe.

Fixed window and sliding window rate limiting compared with a limit of 200 requests per minute, plus where each limit falls short

Attacks it helps against

  • Credential stuffing, where bots replay stolen username and password pairs against a login form. The attempts only work if enough of them get through.
  • Brute force guessing of passwords.
  • Inventory denial on a shop, where bots start checkouts they never finish and pin stock.
  • Scraping of large amounts of data, which can be spotted by request volume.
  • DDoS. The help here is partial, because the traffic arrives from many places at once.

Choosing an algorithm

The choice changes who gets blocked.

AlgorithmHow it countsWeak spot
Fixed windowA set number of requests per timeframe, such as 200 per minute, reset at fixed timesCounters reset on the clock, so bursts can straddle two windows
Sliding windowThe same count, but the window starts at the user’s first requestMore state to track per user
Leaky bucketA fixed-length queue served first come, first served, ignoring timeImperva mentions a starvation issue

I’d skip the fixed window for login endpoints. Actually, it depends on how strict the limit is: at 200 requests a minute the straddling burst is annoying, but at five login attempts a minute it hands an attacker double the allowance.

A limit tied to the IP address also misses what Imperva calls distributed attacks, so the security tooling should treat requests from different places as one attack. False positives are the other cost. A whole office behind one address can look like a single noisy user.

Tie the limits to the data you must protect

Compliance never names rate limiting, only the outcomes it helps reach.

GDPR sets two fine tiers that matter here. Article 32 asks for the ongoing confidentiality, integrity, availability and resilience of processing systems, and for the ability to restore access to personal data in a timely manner after an incident. Article 15 gives people a right of access to their own data. California’s CCPA gives residents a comparable right to request what a business holds about them.

ProvisionWhat it asks of youMaximum fine
GDPR Article 32Security of processing, including availability and resilience10 million euros or 2% of worldwide annual turnover, whichever is higher
GDPR Article 15Right of access to personal data20 million euros or 4% of worldwide annual turnover, whichever is higher

Downtime alone is not automatically a violation of either article. But a bot attack that takes over accounts is a security failure, and a login endpoint with no limits is hard to defend afterwards.

  • Limit login attempts per account and per source address, not only per address
  • Return HTTP 429 when the limit is hit, so clients and monitoring can tell throttling from an outage
  • Log every limit hit with the account involved, since an auditor will ask

Put a firewall in front and application protection behind

A web application firewall catches unusual traffic before it reaches the application, which leaves the limiter fewer requests to count. Web application and API protection adds the same coverage for APIs. Runtime application self-protection works from the inside by watching application behavior, so a bot that slips past the firewall can still be caught there. DDoS protection sits outside both and can absorb some of the flood. If the capacity side worries you, our note on infrastructure for high-volume traffic is the place to start.

Throttle or block

Slow a suspicious source first and block it only once it keeps going, because blocking a shared address locks out innocent users. Start with the login endpoint.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.