Enforce object-level authorization in a web API

8 steps · about 2 h 13 min · Intermediate

  1. Why broken access control tops the risk list (reference, OWASP, 12 min)

    Get the overall picture of how access control fails in real applications before narrowing to API-specific cases.

  2. Broken object-level authorization (reference, OWASP API Security, 12 min)

    The most common API flaw: changing an ID in a request returns someone else's record. Learn the attack and the per-object check that stops it.

  3. Exploit an insecure direct object reference (interactive, PortSwigger Web Security Academy, 30 min)

    Reproduce the flaw in a free lab so you recognise it from the attacker's side when you review your own endpoints.

  4. Prevent direct object reference flaws (guide, OWASP Cheat Sheet Series, 15 min)

    Turn the lab into a fix: scope every lookup to the current user and stop relying on hard-to-guess IDs as protection.

  5. Field-level exposure and changes (reference, OWASP API Security, 12 min)

    Even with the right object, a response can leak private fields or accept edits to fields like role or balance; see how both happen.

  6. Stop mass assignment with explicit allow-lists (guide, OWASP Cheat Sheet Series, 15 min)

    Bind request bodies to explicit input types so clients can only set the fields you meant them to set.

  7. Function-level authorization for admin actions (reference, OWASP API Security, 12 min)

    Check whole operations too: admin and bulk endpoints must verify role, not just hide the button in the interface.

  8. Design deny-by-default authorization and test it (guide, OWASP Cheat Sheet Series, 25 min)

    Pull the fixes into one design: central checks, deny by default, least privilege and automated tests that call each endpoint as two different users.