Missing safety headers
Security headers are a few standard settings your server sends with every page. They tell the browser to block common attacks. AI tools focus on features and usually skip them, because the app looks and works the same either way. Here is what they do and how to add them.
What it means
Your site is missing a few standard safety settings that browsers use to block common attacks (like injecting scripts or embedding your site inside a fake one).
Why AI tools cause it
These are set once, in your framework's config, your middleware or your host's config, not in the pages themselves. The app looks and works the same without them, so nothing prompts anyone to add them.
How xlogs checks it
xlogs reads your live site's response headers and lists the protective ones that are missing.
Check your own app for this
How to fix it
The goal: The response includes Content-Security-Policy, Strict-Transport-Security, X-Frame-Options (or a CSP frame-ancestors), X-Content-Type-Options, and Referrer-Policy, with safe values, and the Content-Security-Policy restricts scripts: it has a script-src or default-src, and allows no 'unsafe-inline' script without a nonce or hash.
- Add or correct the headers (the affected spot) in your framework or host config
- Use strict-but-safe defaults
- For the Content-Security-Policy, set script-src (or default-src) without 'unsafe-inline': first check how your pages render and are cached, then use a per-request nonce (it needs each page rendered per request), hashes for inline scripts that never change, or move inline scripts into files; keep the policy you enforce today in place while you test the stricter one as Content-Security-Policy-Report-Only
- Redeploy and confirm they appear
In my app (the spot the scan shows): missing safety headers. Please make this true: The response includes Content-Security-Policy, Strict-Transport-Security, X-Frame-Options (or a CSP frame-ancestors), X-Content-Type-Options, and Referrer-Policy, with safe values, and the Content-Security-Policy restricts scripts: it has a script-src or default-src, and allows no 'unsafe-inline' script without a nonce or hash. Steps: Add or correct the headers (the spot the scan shows) in your framework or host config; Use strict-but-safe defaults; For the Content-Security-Policy, set script-src (or default-src) without 'unsafe-inline': first check how your pages render and are cached, then use a per-request nonce (it needs each page rendered per request), hashes for inline scripts that never change, or move inline scripts into files; keep the policy you enforce today in place while you test the stricter one as Content-Security-Policy-Report-Only; Redeploy and confirm they appear. Then tell me exactly what you changed, and do not print any secret values back to me or write one into a commit message, a pull request description or a log.
Then verify: After you deploy, xlogs re-reads your headers and reports which are still missing.
Full step-by-step fix guide, with a copy-paste block for each AI tool →
Common questions
Are missing security headers actually dangerous?
Not on their own, where they are a medium-severity gap rather than an emergency. They are defense in depth: they make attacks like script injection and clickjacking harder. Adding them is cheap and worth doing before launch, which is why the scan reports them calmly rather than as a critical.
Which security headers should I set?
Content-Security-Policy, Strict-Transport-Security, X-Frame-Options (or a CSP frame-ancestors), X-Content-Type-Options, and Referrer-Policy. The scan lists which of these are missing on your app, or present but doing nothing (a CSP that allows 'unsafe-inline' scripts, HSTS with max-age=0), so you can fix just those.
