← 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?
- A.Allowlists are faster to type
- B.It defines exactly what is valid, so unknown tricks and encodings are rejected automatically
- C.Blocklists are not allowed in Python
- 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 →