7 lessons

API Security

Authentication, object-level authorization, rate limits, replay, webhooks, mass assignment and file uploads — the boundary most systems actually expose.

Asset→Threat→Attack Surface→Trust Boundary→Vulnerability→Exploit Path→Impact→Mitigation→Defense in Depth→Residual Risk

Every lesson below identifies the asset, attacker capability and boundary before naming the vulnerability. Controls are split into prevention, detection and recovery; residual risk is explicit.

API Security as a Boundary
▶ lab

Every API operation must parse, validate, authenticate, authorize, limit and record—especially when a request names a resource.

Boundary · Network request → application capability
Parse, Validate, Authorize, Process
▶ lab

Validation answers “is this value well-formed and meaningful?”; authorization separately answers “may this principal perform this action?”

Boundary · Untrusted request → typed application data
Mass Assignment and Over-Posting
▶ lab

Binding an arbitrary request object onto a model lets the caller edit fields the UI never exposed, including roles, owners and prices.

Boundary · Request object → persistent model
Rate Limiting as a Security Control
▶ lab

Rate limits make guessing and resource abuse more expensive, but they are not authentication and can be distributed around.

Boundary · Repeated requests → finite compute or attempt budget
Replay Attacks
▶ lab

A valid request can still be harmful when captured and repeated; authenticity does not automatically imply freshness or exactly-once effect.

Boundary · Previously valid message → current state change
Secure Webhooks
▶ lab

A public webhook endpoint must verify who sent the exact body, when it was sent, and whether the event was already processed.

Boundary · External provider → privileged application event
File Upload Security
▶ lab

A file crosses several boundaries—request, parser, storage, scanner, processor and serving path—and each interprets different metadata.

Boundary · Untrusted file → parsers, storage and public serving