What You Get, and How It Gets Undone
Four classic vulnerabilities, handled by default.
SQL injection: the ORM parameterises every query.
Cross-site scripting: templates escape values.
Cross-site request forgery: the token on every POST form.
Clickjacking: middleware sends the right header.
You get all four for free. What follows is how each one gets turned off.
The other three, undone.
|safe on user content turns off escaping for exactly the value most likely to be hostile.
@csrf_exempt removes CSRF protection from a view. Almost nobody needs it, and it is usually applied to silence an error rather than to solve one.
mark_safe() on anything a person typed is the same mistake as |safe, in Python.
Mark this lesson complete
Signed in, your progress follows you to every device.