Skip to main content

A Flask extension for adding security headers to HTTP responses

Project description

Flask-Helmet

PyPI version

Flask-Helmet is a Flask extension that makes it easy to add security headers to your HTTP responses. The goal of this project is to help you build more secure web applications by providing a simple and flexible API for adding headers that improve the security of your application.

Installation

You can install Flask-Helmet using pip:

pip install flask-helmet

Usage

To use Flask-Helmet in your Flask application, you need to do the following:

Import the extension:

from flask_helmet import FlaskHelmet

Initialize the extension:

helmet = FlaskHelmet()
helmet.init_app(app)

Headers

Flask-Helmet supports the following headers:
X-XSS-Protection: This header is used to configure the browser's XSS
X-Content-Type-Options: This header is used to prevent browsers from interpreting files as a different MIME type.
Content-Security-Policy: This header is used to control the resources that a browser is allowed to load for a given page.
X-Frame-Options: This header prevents browsers from displaying the content of the site in a frame.
Strict-Transport-Security: This header enforces secure (HTTPS) connections to the server.
Referrer-Policy: This header specifies the value of the Referer header sent with requests.
X-Permitted-Cross-Domain-Policies: This header controls the delivery of Adobe Flash content, including Flash cookies (LSOs).
X-Download-Options: This header tells Internet Explorer 8 and later to prevent file downloads from executing.
X-DNS-Prefetch-Control: This header controls browser DNS prefetching.
X-Powered-By: This header identifies the technology used to build the site.

For more information on the headers supported by Flask-Helmet, see the official documentation.

Contributing

If you want to contribute to Flask-Helmet, you can do so by submitting a pull request on Github. Before submitting your pull request, be sure to run the tests and make sure that your code follows the PEP 8 style guide.

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Make your changes and write tests for them.
  4. Submit a pull request.

License

Flask-Helmet is released under the MIT License. See the LICENSE file for more information.

We welcome contributions to this library. If you have an idea for a new feature or have found a bug, please open an issue on Github.

Buy me a Coffee

ko-fi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-helmet-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_helmet-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file flask-helmet-1.0.0.tar.gz.

File metadata

  • Download URL: flask-helmet-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.1

File hashes

Hashes for flask-helmet-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e35c9de314b12f7ae87eb720937354f338e3b12a4f9a120598775c51f2fa2409
MD5 2713a005d320924cb7afc13f4dcbb0b1
BLAKE2b-256 9e442115ae076506b6dd96d1ef778f41349936d23e60cb5fef898b7031a31195

See more details on using hashes here.

File details

Details for the file flask_helmet-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: flask_helmet-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.1

File hashes

Hashes for flask_helmet-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d55f7ceace736c024714dc1278bdafbaf04f7d3d9c2aaf541b33fb91335eb47a
MD5 c2ed5fb278dc6fb0e180dbdf9418803b
BLAKE2b-256 4a3dfabe57292d988496b5b835a91b3f11d89e563e1e7d630cdd8fba13ac0313

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page