REST API Security
Secure REST APIs end to end: boundaries, headers, rate limits, idempotency, and token handling.
Learning path
Secure REST APIs end to end: boundaries, headers, rate limits, idempotency, and token handling.
Read "Security Boundaries in Modern Web Applications" for the "Subresource Integrity, Trusted Types, and Cookie Hardening" argument, then name the decision in rest api security work it would change.
Next step: Add a Content Security Policy with Nonces
⏱ 1h
Apply "Add a Content Security Policy with Nonces" to a rest api security task, checking that "Generate a cryptographically random nonce per response and expose it to the template" appears after the "Each response has a unique nonce available to templates." step.
Next step: Add Idempotency Keys to a Write Endpoint
⏱ 0.5h
Execute "Add Idempotency Keys to a Write Endpoint" end to end, then repeat the last step with one parameter changed and compare "Requests without a valid key are rejected before any side effect.".
Prerequisites: Add a Content Security Policy with Nonces
Next step: Add Rate Limiting Middleware
⏱ 0.5h
Run "req.ip reflects the client address appended by the trusted proxy." from "Add Rate Limiting Middleware" and confirm the documented result "Configure the proxy trust setting so req.ip is derived from a trusted forwarding header,".
Prerequisites: Add Idempotency Keys to a Write Endpoint
Next step: Add API Deprecation Headers
⏱ 0.5h
Apply "Add API Deprecation Headers" to a rest api security task, checking that "Remove the endpoint only after the sunset date and after confirming that the remaining" appears after the "The headers are visible until the endpoint is retired." step.
Prerequisites: Add Rate Limiting Middleware
Next step: JWT Token Decoder
⏱ 0.5h
Use "JWT Token Decoder" on a rest api security sample, then check "jwt, security, decode" against your manual result.
Prerequisites: Add API Deprecation Headers
Next step: HMAC Generator
⏱ 0.25h
Feed a representative input into "HMAC Generator" and verify "text to hash" by hand.
Prerequisites: JWT Token Decoder
Next step: Helmet
⏱ 0.25h
Wire "Helmet" into a scratch rest api security project, invoke helmet() helmet(options?: HelmetOptions): RequestHandler, and record the error path.
Prerequisites: HMAC Generator
Next step: How to Build a Rate Limiter in Node.js
⏱ 1h
Reconstruct the reasoning behind "How to Build a Rate Limiter in Node.js" by tracing "Design the key" to the failure it prevents in rest api security systems.
Prerequisites: Helmet
Next step: Run an Authorization Matrix as a Test
⏱ 1h
Build "Run an Authorization Matrix as a Test" for rest api security code and verify {passed:false,failed:[admin]} against both samples.
Prerequisites: How to Build a Rate Limiter in Node.js
Next step: Capstone: REST API Security
⏱ 0.42h
Ship "Limit headers on every proxied response expose remaining quota and reset time" from "Build a Rate Limiting Reverse Proxy in Node.js", then prove it with the project's test suite and an acceptance note.
Prerequisites: How to Build a Rate Limiter in Node.js, Run an Authorization Matrix as a Test
Next step: Run the capstone's tests, publish the repository, and demo it to a reviewer.
⏱ 4h