Security
========
JavaScript and HTML code is subject to `XSS
attacks `__ if user input
is not correctly sanitized.
Python
------
Read the `Django docs on
XSS `__
We occasionally use the ``safe`` filter within templates and the
``mark_safe`` function in views.
Read the docs on Django’s
`html `__
and
`safestring `__
utils.
JavaScript templates
--------------------
HQ uses `Underscore templates `__
templates in some areas. Default to using ``<%- ... %>`` syntax to
interpolate values, which properly escapes.
Any value interpolated with ``<%= ... %>`` must be previously escaped.
JavaScript code
---------------
In Knockout, be sure to escape any value passed to an `html
binding `__.
The `DOMPurify `__ library is
available to sanitize user input. DOMPurify works by stripping
potentially malicious markup. It does not escape input.