Defending Express Apps from SQL Injection, XSS and CSRF
Follow one small Express and SQLite site through the three classic web attacks. Run each attack against the code, fix it with the right defence (CSRF tokens and SameSite, bound query parameters, output encoding and CSP), and finish with input checks, safe coding habits, logging and incident steps.
- Intermediate level
- 5 modules
- 14 lessons
- 66 quiz questions
Syllabus
01Forged Requests (CSRF)How an attacker's page makes a signed-in member's browser act on your site, and the layers that stop it: tokens, SameSite cookies and a check of where the request came from.3 lessons
02SQL InjectionHow string-built queries hand control of the SQL to the visitor, and how to fix them: bound parameters, allow-lists for the parts that cannot be bound, least privilege and quiet error messages.3 lessons
03Cross-Site Scripting (XSS)How untrusted text turns into running script in the league's pages (reflected, stored and DOM-based), how to encode or sanitize it at output, what CSP, Helmet and cookie flags add, and what CORS does and does not do.4 lessons
04Defensive JavaScriptHabits that sit under all three attacks: check the shape of every input, cap its size, never redirect or run what a visitor names, keep prototypes clean and keep dependencies patched.2 lessons
05Logging and Incident ResponseHow to record the events that show an attack in progress without leaking secrets or letting visitors write your log, and what to do in the first hours after something gets through.2 lessons