Skip to content
Myr

Suggest only one package, change the sourcecode block to none

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Lowell Abbott · committed by Lowell Abbott · parent c47f453 · Browse files · 1 file+14 added−54 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−54 removed

  • other:+14 added−54 removed

1 file+14 added−54 removed

modified:docs/security.rst+14 added-54 removed
103 unmodified lines
104<https://github.com/pallets/flask/issues/248#issuecomment-59934857>`_, so105this behavior was changed and :func:`~flask.jsonify` now supports serializing106arrays.107108109SSL/HTTPS110---------111112For implementing HTTPS on your server.113114Below are some packages that implement this protocol:115116* `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_117* `flask-sslify <https://github.com/kennethreitz/flask-sslify>`_118* `flask-secure-headers <https://github.com/twaldear/flask-secure-headers>`_119108Security Headers109----------------110123This section contains a list of headers supported by Flask and some packages that implements them.111This section contains a list of headers supported by Flask.112To configure HTTPS and handle the headers listed below we suggest the package `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`. 113114Content Security Policy (CSP)126-----------------------------------------------------------------------------115-----------------------------116117Enhance security and prevents common web vulnerabilities such as cross-site scripting and MITM related attacks.118119Example:120132.. sourcecode:: html121.. sourcecode:: none122 123 Content-Security-Policy: default-src https:; script-src 'nonce-{random}'; object-src 'none'124136125See also `Content Security Policy <https://csp.withgoogle.com/docs/index.html>`_.126139* `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_140* `flask-csp <https://github.com/twaldear/flask-csp>`_141* `flask-secure-headers <https://github.com/twaldear/flask-secure-headers>`_142127HTTP Strict Transport Security (HSTS)144------------------------------------------------------------------------------------------------------------------------------128-------------------------------------129130Redirects http requests to https on all urls, preventing MITM attacks.131132Example:133150.. sourcecode:: html134.. sourcecode:: none135 136 Strict-Transport-Security: max-age=<expire-time 137 Strict-Transport-Security: max-age=<expire-time>; includeSubDomains 138 Strict-Transport-Security: max-age=<expire-time>; preload 139140See also `Strict Transport Security <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security>`_. 141158* `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_159* `flask-sslify <https://github.com/kennethreitz/flask-sslify>`_160* `flask-secure-headers <https://github.com/twaldear/flask-secure-headers>`_161142X-FRAME-OPTIONS (Clickjacking protection)163-------------------------------------------------------------------------------------------------------------------------143-----------------------------------------144145Prevents the client from clicking page elements outside of the website, avoiding hijacking or UI redress attacks.146167.. sourcecode:: html147.. sourcecode:: none148 149 X-Frame-Options: DENY 150 X-Frame-Options: SAMEORIGIN151 X-Frame-Options: ALLOW-FROM https://example.com/152153See also `X-Frame-Options <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options>`_. 154175* `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_176* `flask-secure-headers <https://github.com/twaldear/flask-secure-headers>`_177155X-Content-Type-Options179-------------------------------------------------------------------------------------------------------------156----------------------157158Prevents XSS by blocking requests on clients and forcing them to read the content type instead of first opening it.159183.. sourcecode:: html160.. sourcecode:: none161 162 X-Content-Type-Options: nosniff163164See also `X-Content-Type-Options <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options>`_. 165189* `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_190* `flask-secure-headers <https://github.com/twaldear/flask-secure-headers>`_191166Cookie options193----------------------------------------------------------------------------------------------------------167--------------168169For setting cookies on client-side storage.170171Example:172199.. sourcecode:: html173.. sourcecode:: none174 175 Set-Cookie: [cookie-name]=[cookie-value] 176177See also `HTTP cookies <https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Secure_and_HttpOnly_cookies>`_ .178205* `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_206* `flask-secure-headers <https://github.com/twaldear/flask-secure-headers>`_207179HTTP Public Key Pinning (HPKP)209-------------------------------------------------------------------------------------------------------180------------------------------181182For associating clients with web servers through a certificate key and prevent MITM attacks.183184Example:185215.. sourcecode:: html186.. sourcecode:: none187188 Public-Key-Pins: pin-sha256="base64=="; max-age=expireTime [; includeSubDomains][; report-uri="reportURI"] 189190See also `Public Key Pinning <https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning>`_.220221* `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_222* `flask-secure-headers <https://github.com/twaldear/flask-secure-headers>`_223224References225-----------226227* https://docs.djangoproject.com/en/1.11/topics/security/228* https://blog.appcanary.com/2017/http-security-headers.html229* https://developer.mozilla.org230* https://csp.withgoogle.com/docs/index.html