Skip to main content

Audit your HTTP response headers for misconfigurations and enforce custom security rules!

Project description

GitHub release Github all releases HitCount MIT license

drHEADer

Welcome to drHEADer

There are a number of HTTP headers which enhance the security of a website when used. Often ignored, or unknown, these HTTP security headers help prevent common web application vulnerabilities when used.

drHEADer helps with the audit of security headers received in response to a single request or a list of requests.

When combined with the OWASP Application Security Verification Standard (ASVS) 4.0, it is a useful tool to include as part of an automated CI/CD pipeline which checks for missing HTTP headers.

Installation

To run drheader, you must have Python 3.8+ installed. The easiest way to install drheader is using pip:

$ pip install drheader

How Do I Use It?

There are two ways you could use drHEADer, depending on what you want to achieve. The easiest way is using the CLI.

CLI

For details on using the CLI, see CLI.md

In a Project

It is also possible to call drHEADer from within an existing project, and this is achieved like so:

from drheader import Drheader

scanner = Drheader(headers={'X-XSS-Protection': '1; mode=block'})

report = scanner.analyze()

Customize HTTP request

By default, the tool uses HEAD method when making a request, but you can change that by supplying the method argument like this:

from drheader import Drheader

scanner = Drheader(url='https://example.com', method='POST')
Other requests arguments

You can use any other arguments that are supported by requests to customise the HTTP request:

from drheader import Drheader

scanner = Drheader(url='https://example.com', headers={'X-API-Key': '726204fe-8a3a-4478-ae8f-4fb216a8c4ba'})
from drheader import Drheader

scanner = Drheader(url='https://example.com', verify=False)

Cross-Origin Isolation

The default rules in drHEADer support cross-origin isolation via the Cross-Origin-Embedder-Policy and Cross-Origin-Opener-Policy headers. Due to the potential for this to break websites that have not yet properly configured their sub-resources for cross-origin isolation, these validations are opt-in at analysis time. If you want to enforce these cross-origin isolation validations, you must pass the cross_origin_isolated flag.

In a project:

from drheader import Drheader

scanner = Drheader(url='https://example.com')
scanner.analyze(cross_origin_isolated=True)

How Do I Customise drHEADer Rules?

drHEADer relies on a yaml file that defines the policy it will use when auditing security headers. The file is located at ./drheader/resources/rules.yml, and you can customise it to fit your particular needs. Please follow this link if you want to know more.

Notes

  • On ubuntu systems you may need to install libyaml-dev to avoid errors related to a missing yaml.h.

Roadmap

We have a lot of ideas for drHEADer, and will push often as a result. Some of the things you'll see shortly are:

  • Building on the Python library to make it easier to embed in your own projects.
  • Releasing the API, which is separate from the core library - the API allows you to hit URLs or endpoints at scale
  • Better integration into MiTM proxies.

Who Is Behind It?

drHEADer was developed by the Santander UK Security Engineering team, who are:

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

drheaderplus-3.0.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

drheaderplus-3.0.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file drheaderplus-3.0.0.tar.gz.

File metadata

  • Download URL: drheaderplus-3.0.0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.14

File hashes

Hashes for drheaderplus-3.0.0.tar.gz
Algorithm Hash digest
SHA256 9971f2483ce1982cda2279558b00de2d503d7fa67cc657ce4f724da018645e02
MD5 a95ca9a02b1ecac84c92965866d6d7c0
BLAKE2b-256 b4b4d5ca71e5aa6c0ea3288ca60463bccebc8c4ee33a494d1e59b001e3e2d559

See more details on using hashes here.

File details

Details for the file drheaderplus-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for drheaderplus-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b79e98f2de95431509e1224f1298992ad5597d057a12b39c0e08dae2c55a0f71
MD5 ae2003fb44ab146c89065aa8e00c5998
BLAKE2b-256 76d90cae1da2a4dc5c26128fdefff09f9a09c2527c8975e3f409a1056aaf3186

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