Security Headers Checker
Security Headers Checker is a small Python tool that checks several relevant HTTP security headers. It is useful for an initial review of websites you own or are authorized to assess and can be incorporated into manual or CI workflows.
What it checks
Content-Security-PolicyStrict-Transport-SecurityX-Content-Type-OptionsX-Frame-OptionsReferrer-PolicyPermissions-PolicyCross-Origin-Opener-PolicyCross-Origin-Resource-PolicyCross-Origin-Embedder-Policy
The scanner reports missing headers and weak configurations. It provides a baseline, not a complete application security test or professional assessment.
Installation
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
On Windows:
.venv\Scripts\Activate.ps1
Usage
Check one site:
python3 security_headers_checker.py https://www.example.com
Get JSON output:
python3 security_headers_checker.py https://www.example.com --json
Replace example.com with a domain you own or are authorized to assess.
Interpret the result
A missing header can indicate real risk, but every policy must fit the application:
- HSTS should be enabled only after HTTPS and subdomain support are verified.
- CSP must match scripts, workers, frames, and fonts used by the application.
- CORP and COEP can change cross-origin resource behavior.
- COOP can affect popups and OAuth flows.
Read the result together with authentication, routing, cookies, caching, and the application's Content Security Policy.
Operational approach
- Define a baseline for each environment.
- Test in staging.
- Make checks repeatable.
- Begin with non-blocking warnings.
- Document exceptions.
- Add deeper application tests.
Limitations
This tool observes HTTP responses. It does not find server-side vulnerabilities, application bugs, exposed secrets, or misconfigured authentication. It is not proof of compliance.
A correct header is a useful improvement—not a guarantee of security. Combine header checks with code review, application testing, and dependency management.
Top comments (0)