🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: SQL Injection: all 10 questions

Quiz: SQL Injection · Question 3 of 10

A sort column comes from the URL (?sort=price). Placeholders can't be used for column names. What should you do?

A sort column comes from the URL (?sort=price). Placeholders can't be used for column names. What should you do?

  1. A.Concatenate it directly
  2. B.Check it against an allow-list of known columns
  3. C.Remove quotes from it
  4. D.Encode it in Base64
Answer & explanation

Correct answer: Check it against an allow-list of known columns

Identifiers can't be parameterised, so only accept values from a fixed allow-list.

Can you get the rest right without peeking?

Take the timed Quiz: SQL Injection quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →