Skip to the guide

Protecting against abuse: DDoS, bots and bad input

IntermediateConcept3 pages

Any public system gets traffic that's trying to hurt it. Floods try to knock it over (distributed denial of service, DDoS), bots do at scale what a person does once, and crafted input makes your code misbehave. Interviewers want layered defences, each matched to the traffic it actually stops.

A stadium on derby day

On the day of a big local match, police close the roads a mile out, so a crowd without tickets never reaches the gates. At the turnstiles, each ticket lets one person in, once. Stewards watch for the same faces going round again and take a closer look at anyone suspicious, not every family. And at the gate, bags are searched for things that aren't allowed inside, however polite their owner.

  • road closures a mile out → the edge: a CDN absorbs floods far from your servers
  • one person per ticket → rate limits per account, API key and IP address
  • stewards and a closer look → bot detection and challenges for suspicious clients only
  • the bag search → input validation: a request that looks valid can still be an attack