~ubuntuone-pqm-team/django/stable

« back to all changes in this revision

Viewing changes to docs/topics/security.txt

  • Committer: Natalia
  • Date: 2016-05-03 13:51:18 UTC
  • Revision ID: natalia.bidart@ubuntu.com-20160503135118-5yv5ywnfpqv6onnc
- Imported Django 1.9.6 from released tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
malicious input, it is not entirely foolproof. For example, it will not
30
30
protect the following:
31
31
 
32
 
.. code-block:: html+django
 
32
.. code-block:: text
33
33
 
34
34
    <style class={{ var }}>...</style>
35
35
 
 
36
.. highlighting as html+django fails due to intentionally missing quotes.
 
37
 
36
38
If ``var`` is set to ``'class1 onmouseover=javascript:func()'``, this can result
37
39
in unauthorized JavaScript execution, depending on how the browser renders
38
40
imperfect HTML. (Quoting the attribute value would fix this case.)
120
122
SSL/HTTPS
121
123
=========
122
124
 
123
 
It is always better for security, though not always practical in all cases, to
124
 
deploy your site behind HTTPS. Without this, it is possible for malicious
125
 
network users to sniff authentication credentials or any other information
126
 
transferred between client and server, and in some cases -- **active** network
127
 
attackers -- to alter data that is sent in either direction.
 
125
It is always better for security to deploy your site behind HTTPS. Without
 
126
this, it is possible for malicious network users to sniff authentication
 
127
credentials or any other information transferred between client and server, and
 
128
in some cases -- **active** network attackers -- to alter data that is sent in
 
129
either direction.
128
130
 
129
131
If you want the protection that HTTPS provides, and have enabled it on your
130
132
server, there are some additional steps you may need:
194
196
   Django now requires that you set :setting:`ALLOWED_HOSTS` explicitly rather
195
197
   than relying on web server configuration.
196
198
 
197
 
Additionally, as of 1.3.1, Django requires you to explicitly enable support for
198
 
the ``X-Forwarded-Host`` header (via the :setting:`USE_X_FORWARDED_HOST`
199
 
setting) if your configuration requires it.
 
199
Additionally, Django requires you to explicitly enable support for the
 
200
``X-Forwarded-Host`` header (via the :setting:`USE_X_FORWARDED_HOST` setting)
 
201
if your configuration requires it.
200
202
 
201
203
Session security
202
204
================
271
273
* Keep your :setting:`SECRET_KEY` a secret.
272
274
* It is a good idea to limit the accessibility of your caching system and
273
275
  database using a firewall.
 
276
* Take a look at the Open Web Application Security Project (OWASP) `Top 10
 
277
  list`_ which identifies some common vulnerabilities in web applications. While
 
278
  Django has tools to address some of the issues, other issues must be
 
279
  accounted for in the design of your project.
274
280
 
275
281
.. _LimitRequestBody: https://httpd.apache.org/docs/2.4/mod/core.html#limitrequestbody
 
282
.. _Top 10 list: https://www.owasp.org/index.php/Top_10_2013-Top_10