Bird
0
0

Why is it important to avoid using 'unsafe-inline' in your Django Content Security Policy?

hard📝 Conceptual Q10 of 15
Django - Security Best Practices
Why is it important to avoid using 'unsafe-inline' in your Django Content Security Policy?
ABecause it prevents loading external images
BBecause it causes the website to load slower
CBecause it disables the protection against cross-site scripting attacks
DBecause it breaks user authentication
Step-by-Step Solution
Solution:
  1. Step 1: Understand 'unsafe-inline' effect

    Using 'unsafe-inline' allows any inline scripts, removing CSP's protection against malicious scripts.
  2. Step 2: Recognize security risk

    This makes the site vulnerable to cross-site scripting (XSS) attacks.
  3. Final Answer:

    Because it disables the protection against cross-site scripting attacks -> Option C
  4. Quick Check:

    'unsafe-inline' disables XSS protection = Because it disables the protection against cross-site scripting attacks [OK]
Quick Trick: Avoid 'unsafe-inline' to keep XSS protection active [OK]
Common Mistakes:
MISTAKES
  • Thinking it affects performance
  • Confusing with image loading
  • Assuming it breaks authentication

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes