Systems & architecture
Web application security
Start with threat modeling, then work through XSS and CSP, CORS and cross-origin isolation, OAuth/OIDC, JWT, the OWASP API Top 10, SSRF and file uploads, secrets management and the npm supply chain — each layer of defense for a real app.
9 parts168 min readUpdated Oct 31, 2026
Parts
Part 1
Threat Modeling for Product Teams: STRIDE, Data Flow Diagrams and Trust Boundaries, from a 60-Minute Session to TicketsHow I run practical threat modeling with a product team: the four questions, a data flow diagram with trust boundaries, STRIDE per element on a real system with an SPA, API, Postgres, S3 uploads, a payment webhook and an admin panel, simple risk rating, threats turned into tickets, and a threat model that lives in the repo.
23 min
Part 2
Practical Frontend Security: XSS in React, Nonce-Based CSP, Trusted Types, CSRF and ClickjackingReact's escaping does a lot for you, but not everything. This post walks through the XSS holes React doesn't cover, building a strict nonce-based CSP in Next.js, Trusted Types, CSRF in the SameSite era, where to store tokens, and how to stop clickjacking.
15 min
Part 3
CORS and cross-origin isolation in depth: origin vs site, preflights, credentials, CORP, COEP, COOP and Fetch MetadataThe browser's cross-origin model from the ground up: what the Same-Origin Policy blocks, what CORS relaxes and what it never protects, preflights and credentials, Vary: Origin caching bugs, dangerous allowlists, then CORP, COEP, COOP, Fetch Metadata and SameSite — with NestJS and Next.js configs done right.
18 min
Part 4
OAuth 2.0 and OpenID Connect for Web Apps in 2026: Authorization Code + PKCE, BFF and the Real VulnerabilitiesEvery HTTP request of the authorization code + PKCE flow, what state, nonce, ID tokens and access tokens each protect, why the implicit flow is dead, and how to build a Backend-for-Frontend in Next.js so tokens never reach the browser — plus refresh rotation, logout and the bugs I've actually seen.
21 min
Part 5
JWT in Depth: Verification Pitfalls, the Classic Attacks, and Key Rotation with JWKSHow JWS differs from JWE, the claims you must check, alg: none, RS256/HS256 confusion, kid injection, jku abuse — and how to pin algorithms with jose, rotate JWKS keys without logging anyone out, revoke tokens, and test your verifier with the malicious tokens attackers will actually send.
18 min
Part 6
The OWASP API Security Top 10 in NestJS: vulnerable code, fixed code, and the tests that keep it fixedAll ten risks of the OWASP API Security Top 10 (2023) worked through in NestJS: ownership checks in scoped repositories, whitelisted DTOs, response shaping, CASL policies, cost-based rate limits, idempotent business flows, SSRF-safe fetch, and an authorization matrix in e2e tests.
17 min
Part 7
SSRF and File Upload Security: URL Fetching and Uploads That Don't Hand Over Your NetworkLink previews, webhooks, image import and file uploads look like boring features, yet they keep showing up in incident reports. Why SSRF blocklists fail, a safe fetch in Node with undici and pinned IPs, IMDSv2, and an upload pipeline: presigned S3, magic bytes, sharp, a separate domain and async scanning.
18 min
Part 8
Secrets Management for Small Teams: From .env Files to GitHub Actions OIDC and Short-Lived CredentialsWhat counts as a secret, how .env files and long-lived CI tokens actually leak, what to do in the first hour after a leak, secret stores compared, GitHub Actions OIDC to AWS and GCP instead of static keys, rotation without downtime, and typed env validation in a Turborepo monorepo.
19 min
Part 9
npm supply chain attacks after Shai-Hulud: what changed and how to harden a JavaScript monorepoFrom Nx s1ngularity and chalk/debug to Shai-Hulud, TanStack and ChainDrop: what the npm attacks actually did, what npm and GitHub changed, and a layered defense — install, CI, publish — applied directly to a Bun + Turborepo monorepo.
19 min
Series review
0/18 answered · 0 correct
18 questions drawn from the parts of this series. Answers here count toward each post's own quiz.
Other series
Series- AI engineering for web developers4 parts · 86 min read0/4 read
- NestJS in production3 parts · 67 min read0/3 read
- Web performance from the ground up8 parts · 74 min read0/8 read
- Modern CSS and the web platform5 parts · 46 min read0/5 read
- Frontend architecture that lasts5 parts · 30 min read0/5 read
- The engineering craft4 parts · 21 min read0/4 read
- Frontend in depth7 parts · 129 min read0/7 read
- Business analysis for product teams6 parts · 147 min read0/6 read