Learn to Prevent SQL Injections with Node.js
Learn what SQL is and how a Node app talks to a database, then see how string-built queries hand control of the SQL to a visitor. Fix them with bound parameters, allow-lists for the parts that cannot be bound, least privilege and quiet error messages, and finish by auditing a small Express and SQLite route set.
- Intermediate level
- 3 modules
- 5 lessons
- 25 quiz questions
Syllabus
01SQL and NodeWhat SQL and a database table are, and how an Express route running on Node sends queries to SQLite through a driver, with the two ways a value can get into a query.1 lesson
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
03Project: Audit the RoutesRun a small Express and SQLite route set that builds its queries from strings, probe each route, then compare with a fixed version that binds values and limits what the database connection can do.1 lesson