Website security · Raksha guide
Security Headers Check: CSP, HSTS and Browser Protections
Security headers tell a browser which scripts may run, whether a page may be framed and how to handle sensitive information. A missing header usually identifies a defence-in-depth gap—not proof of account compromise or an exploitable vulnerability.
By Raksha · Reviewed 16 November 2026
Six protections to review
| Header | Purpose | Rollout consideration |
|---|---|---|
| Content-Security-Policy | Restricts scripts and other resource sources; frame-ancestors controls framing. | Use nonces or hashes where appropriate. Start with report-only and test real user journeys. |
| Strict-Transport-Security | Tells browsers to use HTTPS on future visits. | Only enable on a working HTTPS deployment; includeSubDomains and preload need separate planning. |
| X-Frame-Options / CSP frame-ancestors | Limits embedding to reduce clickjacking risk. | Allow legitimate embedding deliberately. CSP frame-ancestors is the more flexible modern control. |
| X-Content-Type-Options | nosniff prevents certain MIME-type guessing. | Serve the correct Content-Type first, including scripts and styles. |
| Referrer-Policy | Controls referrer details sent to other origins. | strict-origin-when-cross-origin is a common baseline; sensitive pages may need stricter rules. |
| Permissions-Policy | Restricts browser features such as camera or geolocation. | Disable features you do not use; test features you intentionally allow. |
How to check security headers with curl
Replace example.com with an authorised target. Inspect GET responses as well as redirects: some applications handle HEAD differently. Check login, error and API responses separately.
curl -sS -D - -o /dev/null https://example.com/
curl -sS -L -D - -o /dev/null https://example.com/loginEach redirect has its own header block. A policy on the homepage does not prove it is present on every endpoint or enforced at every edge location.
What missing CSP means
CSP can limit the impact of script injection but does not repair unsafe rendering or prove that an injection exists. Investigate user-controlled inputs, the affected context and an actual security consequence before calling the result a confirmed vulnerability.
A policy permitting broad script sources or unsafe execution can offer little protection. Do not copy a universal policy into production just to satisfy a grade.
Report-only first, then enforce
- Inventory scripts, frames, fonts, analytics and other external resources.
- Deploy a report-only policy in staging and exercise sign-in, payment and embedded content.
- Review reports without storing sensitive URLs or user content unnecessarily.
- Fix violations and introduce appropriate nonces or hashes.
- Enforce gradually, monitor failures and keep a rollback path.
# Illustrative starting point, not a complete script policy
Content-Security-Policy-Report-Only: object-src 'none'; base-uri 'self'; frame-ancestors 'self'
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()frame-ancestors is not enforced in report-only mode. Test the enforced framing rule separately before relying on it.
What a good header result does not prove
Headers do not establish secure database permissions, patched dependencies or safe account-to-account access. Raksha’s public scan inspects served headers; connected reviews and authorised tests answer different questions.
Plan API permission testsWill a strict policy break my site?
It can block legitimate resources. Test first, and fix the application rather than broadly allowing everything to silence reports.
Sources and further reading
Consult current official documentation before changing a production system. Examples are illustrative, not live findings or universal configurations.
Start with a site you are authorised to test
A free passive check needs no card. Sign-in, email confirmation, ownership rules and usage limits apply. It is not an unrestricted penetration test.