$ ./guess_the_languageCybersecurity
Cybersecurity · medium · #195

What is the fix?

db.query(`SELECT * FROM users WHERE id = ${req.query.id}`)
  1. Use a parameterised query
  2. Escape the quote characters
  3. Validate the length first
  4. Cast the value to a number
Binding sends data separately from SQL, so no input can change the statement's shape.
Play Cybersecurity ▸