Skip to content

Instantly share code, notes, and snippets.

@aqt01
Last active June 28, 2024 05:52
Show Gist options
  • Save aqt01/5095689df248ee3fa8352e3681d59840 to your computer and use it in GitHub Desktop.
Save aqt01/5095689df248ee3fa8352e3681d59840 to your computer and use it in GitHub Desktop.
Flask security documentation

- SSL/HTTPS

For implementing HTTPS on your server

Below some packages in suggestion order that implements this protocol:

Security Headers

This sections contains sections headers supported by Flask and a list of packages in suggestion order that implements it

For enhancing security and preventing common web vulnerabilities such as cross-site scripting and MITM related attacks

Example

Content-Security-Policy: default-src https:; script-src 'nonce-{random}'; object-src 'none'

To learn more check this link

For automatically redirect HTTP to HTTPS on all the website url's and prevent MITM attacks

Example

Strict-Transport-Security: max-age=

Strict-Transport-Security: max-age=; includeSubDomains

Strict-Transport-Security: max-age=; preload

To learn more check this link

Prevents the client clicking page elements outside of the website avoiding hijacking or UI redress attacks

Example

X-Frame-Options: DENY

X-Frame-Options: SAMEORIGIN

X-Frame-Options: ALLOW-FROM https://example.com/

To learn more check this link

Prevents XSS by blocking requests on clients and forcing then to read the content type instead of first opening it.

Example

X-Content-Type-Options: nosniff

To learn more check this link

For setting cookies on client-side storage

Example

Set-Cookie: [cookie-name]=[cookie-value]

To learn more check this link

For associating clients with web servers throught a certificate key and prevent MITM attacks

Example

Public-Key-Pins: pin-sha256="base64=="; max-age=expireTime [; includeSubDomains][; report-uri="reportURI"]

To learn more check this link

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment