PrepCity

API security

Security in depth · 5 of 7Security in depth 5 / 7, see the whole branchOpen the lab

By the last page, this is the design you will have built. Drag it, or Show all, to see every part.

Branch: Security in depth · step 5 of 7 · 14 pages · about 13 min

API security

One shop API, attacked the ways APIs really are: ids that leak, a profile update that grants admin, a reply that carries password hashes, admin routes any customer can call, a loop that drains the database, bots that buy every pair, and a forgotten v1. Each is played request by request, then fixed.

What it is
API security makes sure each request may do exactly what it asks: this object, these fields, this function, this much and this often.
What it is for
APIs hand data and actions to any program with a token, and most API breaches are valid requests that no check ever refused.
Use it when
For every endpoint you design or review, and in every system design interview that has an API.
Not when
It assumes authentication, TLS and input validation are already in place; it does not replace them.

New words you’ll learn

  • BOPLA
  • Mass assignment
  • ORM
  • Elevation of privilege
  • DTO
  • Response schema
  • BFLA
  • Sensitive business flow
  • API inventory
  • Unsafe consumption

Page by page