Re-order by semantic. Fix link on flask-talismand and re-word many concepts
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 ee7cb9d · Browse files · 1 file·+33 added−26 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+33 added−26 removed
- other:+33 added−26 removed
Provenance
- Commit
09a0d2e- Tree
3bd57dd- Author
Lowell Abbott <lowell.abbott@gmail.com>- Committer
Lowell Abbott <lowell.abbott@gmail.com>- Parent
ee7cb9d
1 file changed+33 added−26 removed
modified:docs/security.rst+33 added-26 removed
107 unmodified lines108 Security Headers109 ----------------110 111 This section contains a list of headers supported by Flask.112-To configure HTTPS and handle the headers listed below we suggest the package `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`. 112+To configure HTTPS and handle the headers listed below we suggest the package `flask-talisman <https://github.com/GoogleCloudPlatform/flask-talisman>`_. 113 114-Content Security Policy (CSP)115------------------------------114+HTTP Strict Transport Security (HSTS)115+-------------------------------------116 117-Enhance security and prevents common web vulnerabilities such as cross-site scripting and MITM related attacks.117+Redirects http requests to https on all urls, preventing Man-in-the-middle (MITM) attacks.118 119 Example:120 121 .. sourcecode:: none122 123- Content-Security-Policy: default-src https:; script-src 'nonce-{random}'; object-src 'none'123+ Strict-Transport-Security: max-age=<expire-time 124+ Strict-Transport-Security: max-age=<expire-time>; includeSubDomains 125+ Strict-Transport-Security: max-age=<expire-time>; preload 126 125-See also `Content Security Policy <https://csp.withgoogle.com/docs/index.html>`_.127+See also `Strict Transport Security <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security>`_. 128 127-HTTP Strict Transport Security (HSTS)128--------------------------------------129+HTTP Public Key Pinning (HPKP)130+------------------------------131 130-Redirects http requests to https on all urls, preventing MITM attacks.132+This enables your web server to authenticate with a client browser using a specific certificate key to prevent Man-in-the-middle (MITM) attacks.133 134 Example:135 136 .. 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 137 140-See also `Strict Transport Security <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security>`_. 138+ Public-Key-Pins: pin-sha256="base64=="; max-age=expireTime [; includeSubDomains][; report-uri="reportURI"] 139 140+See also `Public Key Pinning <https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning>`_.141+142-X-FRAME-OPTIONS (Clickjacking protection)142+X-Frame-Options (Clickjacking protection)143 -----------------------------------------144 145 Prevents the client from clicking page elements outside of the website, avoiding hijacking or UI redress attacks.146 7 unmodified lines154 155 X-Content-Type-Options156 ----------------------157 158-Prevents XSS by blocking requests on clients and forcing them to read the content type instead of first opening it.158+This header prevents Cross-site scripting (XSS) by blocking requests on clients and forcing them to first read and validate the content-type before reading any of the contents of the request.159 160 .. sourcecode:: none161 162 X-Content-Type-Options: nosniff163 164 See also `X-Content-Type-Options <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options>`_. 165 166-Cookie options167---------------166+Content Security Policy (CSP)167+-----------------------------168 169-For setting cookies on client-side storage.169+Enhances security and prevents common web vulnerabilities such as cross-site scripting (XSS) and Man-in-the-middle (MITM) related attacks.170 171 Example:172 173 .. sourcecode:: none174 175- Set-Cookie: [cookie-name]=[cookie-value] 175+ Content-Security-Policy: default-src https:; script-src 'nonce-{random}'; object-src 'none'176 177-See also `HTTP cookies <https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Secure_and_HttpOnly_cookies>`_ .177+See also `Content Security Policy <https://csp.withgoogle.com/docs/index.html>`_.178 179-HTTP Public Key Pinning (HPKP)180-------------------------------179+Cookie options180+--------------181 182-For associating clients with web servers through a certificate key and prevent MITM attacks.182+While these headers are not directly security related, they have important options that may affect your flask application.183 184+- ``Secure`` limits your cookies to HTTPS traffic only.185+- ``HttpOnly`` protects the contents of your cookie from being visible to XSS.186+- ``SameSite`` ensures that cookies can only be requested from the same domain that created them but this feature is not yet fully supported across all browsers. 187+188 Example:189 190 .. sourcecode:: none191+ 192+ Set-Cookie: [cookie-name]=[cookie-value] 193 188- Public-Key-Pins: pin-sha256="base64=="; max-age=expireTime [; includeSubDomains][; report-uri="reportURI"] 194+See also:195 190-See also `Public Key Pinning <https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning>`_.196+- Mozilla guide to `HTTP cookies <https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Secure_and_HttpOnly_cookies>`_.197+- `OWASP HTTP Only <https://www.owasp.org/index.php/HttpOnly>`_.