Skip to main content

GitHub release Github all releases HitCount MIT license

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.

How Do I Install It?

drHEADer requires at least Python 3.8 to run. The easiest way to install drHEADer is to clone this repository and via a terminal window, run the following command:

$ python3 setup.py install --user

This will install all the pre-requisites and you'll end up with a drHEADer executable.

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:

Release files for drheader 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drheader 2.0.0
File Size Uploaded
drheader-2.0.0.tar.gz 35.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drheader 2.0.0
File Interpreter ABI Platform
drheader-2.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 55.7 kB

Release files / drheader-2.0.0.tar.gz

Download URL drheader-2.0.0.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
291ae019ea389218023c5b4df3ead2840dc0fd326da348b60d2cab9e2ca7039a
BLAKE2b-256 checksum
How to use checksums
a5e60f407efaebe98cf4c4b431288c2e79e4fbec03749f1ec7dd0c66bfeba594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / drheader-2.0.0-py2.py3-none-any.whl

Download URL drheader-2.0.0-py2.py3-none-any.whl
Size 19.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3e48fb1063a0dbdb7216de961e11d6bcb99822ed567960c5623c9fa9f43a9397
BLAKE2b-256 checksum
How to use checksums
12f0ba68626f35de680dd52374510a6a3df8ce6c524f5bb5d51c5fbfdda91f2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.3

2 release files

1.5.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page