Grading Your Security Headers: What an A Actually Takes
Security headers are the cheapest defense-in-depth you can ship — a few response headers that stop clickjacking, downgrade attacks, and content injection. Here's what separates an A from an F.
- Security Headers
- CSP
- Web Security
- AppSec
Security headers are the rare security win that's almost free: a handful of HTTP response headers that meaningfully shrink your attack surface, with no code changes to your app logic. And yet most sites ship with half of them missing. I built a Security Headers Grader to make the gap obvious — paste your headers (or a URL) and get an A–F grade with concrete fixes.
Here's what the grade is actually measuring.
The headers that matter
- Content-Security-Policy (CSP). The big one. A good CSP controls what can load and run on your page, neutralizing most cross-site scripting. It's also the hardest to get right — which is why I built a separate CSP Builder & Linter for composing one safely. A missing or
unsafe-inline-riddled CSP is the single biggest drag on a grade. - Strict-Transport-Security (HSTS). Forces HTTPS and prevents downgrade attacks. Without it, a user's first request can be hijacked.
- X-Frame-Options / frame-ancestors. Stops clickjacking by controlling who can embed your site in an iframe.
- X-Content-Type-Options: nosniff. Stops browsers from MIME-sniffing responses into something executable.
- Referrer-Policy and Permissions-Policy. Control what you leak in referrers and which browser features your site can use.
Grading fairly across very different sites
The tricky part of a grader isn't knowing the headers — it's scoring them fairly across wildly different setups. A static marketing site and a complex web app have genuinely different needs. So the grader weights the high-impact headers (CSP, HSTS) heavily, gives partial credit for present-but-weak values, and — crucially — recommends a safe default value, not just "add this header." "Add a CSP" is useless advice; "here's a starter CSP that won't break your site" is actionable.
It also flags disclosure headers like Server and X-Powered-By — the ones that quietly advertise your stack and version to anyone scanning.
Why the letter grade works
An A–F grade does something a raw list of findings doesn't: it creates a target. "You're a C, here's how to get to an A" turns an abstract security chore into a concrete, satisfying task. Each header gets its own card — present or missing, its value, what's good or risky, and the recommended fix — so the path from grade to green is spelled out.
The takeaway
Security headers won't stop a determined attacker on their own, but they close off entire classes of cheap attacks for the price of a config change. If you've never checked yours, you're probably leaving an easy A on the table.
Try it
The Security Headers Grader is live — paste your response headers or a URL and see where you land.
Davis Barillas is a forward deployed engineer working across security, identity, and AI. I build small, sharp, privacy-first tools around the problems I run into in the field.