🎙 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 4 of 10

Why is an allowlist better than a blocklist for validating input?

Why is an allowlist better than a blocklist for validating input?

  1. A.Allowlists are faster to type
  2. B.It defines exactly what is valid, so unknown tricks and encodings are rejected automatically
  3. C.Blocklists are not allowed in Python
  4. D.Allowlists encrypt the input
Answer & explanation

Correct answer: It defines exactly what is valid, so unknown tricks and encodings are rejected automatically

A blocklist must predict every bad pattern; an allowlist only has to describe good values.

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 →