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

Quiz: Command Injection and Path Traversal · Question 9 of 10

What is the strongest design for letting students download their own offer letters?

What is the strongest design for letting students download their own offer letters?

  1. A.Accept any file name but hide the download link
  2. B.Block file names longer than 20 characters
  3. C.Store files under random ids, look up the path in the database and check the owner
  4. D.Put all files in the website's public folder
Answer & explanation

Correct answer: Store files under random ids, look up the path in the database and check the owner

The user never controls a path, and the ownership check also prevents IDOR.

Can you get the rest right without peeking?

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

Start the quiz →