← 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?
- A.SELECT * FROM orders WHERE id = ?
- B.SELECT * FROM orders WHERE id = ? AND user_id = ?
- C.SELECT * FROM orders
- 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 →