API & authorization security
IDOR/BOLA, mass assignment, rate limiting, JWT pitfalls (alg=none, weak secrets). Broken object-level authorization dominates modern API breaches.
The mental model
An API is a set of doors with no receptionist. A traditional web app renders pages a server controls; an API just answers structured requests, and the client — which the attacker fully controls — decides what to ask for. So the entire security burden shifts to one question asked at every single endpoint: is this caller allowed to do this, to this specific object, right now? API security is almost entirely an authorization problem, and the single most common — and most expensive — failure is answering "yes" when the honest answer is "not to that object."
The analogy that sticks: a hotel key card. Authentication is proving you are a guest — the front desk gave you a card. Object-level authorization (BOLA/IDOR) is that your card opens *room 412 and only 412*. The breach that dominates modern APIs is a key card that opens *every* room because the lock only checks "is this a valid guest card?" and never "is this the card for *this* room?" Function-level authorization (BFLA) is that your guest card must not open the manager's office — the admin function. Mass assignment is filling out the check-in form and secretly adding "role: manager" in a field the clerk copies without reading. Rate limiting is the guard noticing someone trying 10,000 key cards a minute.
Why this dominates interviews and breaches: APIs expose object identifiers directly (/orders/1043), the client is untrusted, and the authorization check is an *absence* — there is no dangerous function to spot, only a missing "does this belong to you?" The OWASP API Security Top 10 puts BOLA (Broken Object-Level Authorization) at #1 precisely because it is easy to build without and impossible to see in a green scan. If you internalise one thing: authentication tells you who is calling; authorization is a separate, per-object, server-side decision you must make every time.
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision