Security headers

Content-Security-Policy (CSP)

Send a Content-Security-Policy that limits where scripts, styles, and frames can come from, instead of allowing everything.

Why it matters

CSP is the safety net when malicious script gets into a page. Without it, one injected snippet can read cookies and send them to an attacker.

It also forces you to know which external scripts you actually load. That alone removes old tags and tracking you forgot about.

How to fix it

  1. List the scripts, styles, fonts, and frames you actually use

  2. Start with default-src 'self' and add only the sources you need

  3. Avoid 'unsafe-inline' and 'unsafe-eval' for scripts

  4. Test with Content-Security-Policy-Report-Only before enforcing

Prompt for an AI assistant

Copy the text below and paste it into an AI assistant.

You are the person improving this website. Check the item below and fix it if it applies to the site.

Item: Content-Security-Policy (CSP)
Summary: Send a Content-Security-Policy that limits where scripts, styles, and frames can come from, instead of allowing everything.
Steps:
1. List the scripts, styles, fonts, and frames you actually use
2. Start with default-src 'self' and add only the sources you need
3. Avoid 'unsafe-inline' and 'unsafe-eval' for scripts
4. Test with Content-Security-Policy-Report-Only before enforcing
References:
- Content-Security-Policy (MDN) (https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)
- Content Security Policy (web.dev) (https://web.dev/articles/csp)

Constraints:
- Keep the existing design and tone of voice.
- Show the file or section you changed and the suggested final wording.
- Do not decide ambiguous points alone; give options and a recommendation.
- Do not change anything outside the listed item.

Checked by

  • vuln

    Public exposure checks

Related checks

  • Other security headers

    Set X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and COOP/CORP to close the small gaps browsers leave open by default.

  • Subresource Integrity (SRI)

    Add an integrity hash to scripts and styles loaded from a CDN, so a changed file is refused.

References

Check your site now

Enter a URL and find what is missing before launch, for free.

Run audit