Skip to main content

PyPI version PyPI downloads MIT license

DrHeaderPlus

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.

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

DrHeaderPlus ships a built-in OWASP ASVS 4.0 V14 preset (--preset owasp-asvs-v14) for compliance scanning, and is a useful tool to include as part of an automated CI/CD pipeline which checks for missing HTTP headers.

DrHeaderPlus is a modernized fork of the original drHEADer project by Santander UK Security Engineering.

Features

  • Comprehensive header audit against a configurable YAML ruleset aligned with OWASP and Mozilla Observatory
  • CSP intelligence — nonce/hash-aware validation that avoids false positives for modern CSP policies; strict-dynamic support
  • CORS misconfiguration detection — active origin reflection probe in scan mode
  • Cookie security — SameSite=None without Secure flag detection, attribute enforcement
  • Leak header detection — flags Server, X-Powered-By, X-AspNet-Version, and other information disclosure headers
  • Cross-origin isolation — opt-in COEP/COOP validation for sites that need SharedArrayBuffer / high-resolution timers
  • OWASP ASVS 4.0 V14 preset — built-in --preset owasp-asvs-v14 for compliance scanning against ASVS configuration requirements
  • Threshold checks — Value-Gte validation for numeric directives (e.g. HSTS max-age >= 6 months)
  • Per-rule severity — high / medium / low aligned with OWASP guidance
  • CLI and library — use from the command line or integrate into your Python project
  • Multiple output formats — table, JSON, and JUnit XML for CI/CD integration

Installation

Requires Python 3.11+. Install from PyPI:

pip install drheaderplus

How Do I Use It?

There are two ways you could use DrHeaderPlus, 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 DrHeaderPlus 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 DrHeaderPlus 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 DrHeaderPlus Rules?

DrHeaderPlus 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.

Who Is Behind It?

DrHeaderPlus is maintained by @garootman.

The original drHEADer was developed by the Santander UK Security Engineering team:

Metadata

Release files for drheaderplus 3.0.4

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

Source distribution (sdist)

Source distribution for drheaderplus 3.0.4
File Size Uploaded
drheaderplus-3.0.4.tar.gz 30.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drheaderplus 3.0.4
File Interpreter ABI Platform
drheaderplus-3.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 55.7 kB

Release files / drheaderplus-3.0.4.tar.gz

Download URL drheaderplus-3.0.4.tar.gz
Size 30.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4cd2437170b81ae45a4c51526997da15f707933c9c55a64387da8377b24def2c
BLAKE2b-256 checksum
How to use checksums
6bd0922d5920c8333f74a1b38ec1be849ce7e2c6750543efa9d3d1956009cb02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / drheaderplus-3.0.4-py3-none-any.whl

Download URL drheaderplus-3.0.4-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65b7cca7011f339d9df451b7b28e892d2aba865c93d971317a054b8572952d8c
BLAKE2b-256 checksum
How to use checksums
a1e75c4cb0b0a5694cbbca591c93f028d2a91449e6dcd71ba7b6ea9cee96a5ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

3.0.4 This release

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.0

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