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

Quiz: Broken Access Control · Question 9 of 10

What is the safest way to load an order so that IDOR cannot happen?

What is the safest way to load an order so that IDOR cannot happen?

  1. A.SELECT * FROM orders WHERE id = ?
  2. B.SELECT * FROM orders WHERE id = ? AND user_id = ?
  3. C.SELECT * FROM orders
  4. D.Check ownership in the browser
Answer & explanation

Correct answer: SELECT * FROM orders WHERE id = ? AND user_id = ?

Putting the owner in the query makes the database filter out other users' records.

Can you get the rest right without peeking?

Take the timed Quiz: Broken Access Control quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →