Docs

Understanding your first CSP violation

Learn how to investigate CSP violations, understand blocked resources, identify trusted activity, and safely update your Content Security Policy with Header Centaur.

Understanding your first CSP violation

Your first Content Security Policy (CSP) report tells you that something on your website didn’t match the rules in its policy. It might be a script, an image, a connection to an API, or another resource.

A report is a useful starting point for investigation. It isn’t, by itself, evidence of an attack—or a reason to allow the blocked resource.

This guide walks through a typical violation and explains how to decide what to do next.

What does a CSP violation mean?

A Content Security Policy tells the browser which resources a page is allowed to load and which actions it can perform. When activity falls outside those rules, the browser can send a violation report to Header Centaur.

What happens to the activity depends on how the policy is delivered:

  • Enforced policy: the browser blocks activity that violates the policy.
  • Report-Only policy: the browser reports activity that would violate the policy, without blocking it under that policy.

A page can have both an enforced policy and a Report-Only policy. Check which policy produced the report before assuming that something broke for your visitors.

Start with one violation group

Open Violations in your Header Centaur organisation and select the site you want to investigate. Choose a violation group and open Investigate.

Header Centaur groups related reports so you can investigate a recurring issue together. A high report count doesn’t necessarily mean many separate problems: the same resource might trigger reports across multiple page loads.

Start with an issue affecting an important visitor journey, such as signing in, submitting a form, or completing a purchase.

Read the report

Imagine your website uses a support widget loaded from:

https://widgets.example.net/support.js

Your page currently sends this policy:

Content-Security-Policy: default-src 'self'; script-src 'self'

The script-src directive allows scripts from the page’s own origin. The support widget comes from a different origin, so it doesn’t meet that rule.

A report for this example might show:

Field Example What it tells you
Document URL https://www.example.com/contact The page where the violation happened.
Blocked resource https://widgets.example.net The resource or origin that didn’t match the policy. Some URLs may be shortened for privacy.
Effective directive script-src-elem The browser rule involved—in this case, a script element.
Disposition enforce The report came from an enforced policy. A Report-Only violation uses report.
Original policy default-src 'self'; script-src 'self' The policy the browser evaluated.

The effective directive can be more specific than the directive written in your header. In this example, the browser reports script-src-elem, while script-src supplies the applicable rule because there is no separate script-src-elem directive.

Use the affected pages, first and last seen times, and example reports to understand where the issue occurs and whether it coincides with a recent deployment.

Check whether the activity belongs on your site

Before changing your policy, establish why the browser tried to load the resource.

Ask:

  • Does your application or an approved third-party integration use this resource?
  • Did someone recently deploy a feature, change a tag manager, or add a service?
  • Is the domain exactly the one you expect?
  • Can you reproduce the activity on an affected page?

For the support widget example, check the page’s scripts and your integration configuration. Confirm that the widget is intentional and that its source matches the provider’s documented requirements.

A familiar-looking domain is not enough to establish trust. Check it against your own configuration and the service’s official documentation.

If you cannot identify the resource, keep investigating before adding it to your policy.

Reproduce the issue in your browser

Open an affected page with your browser’s developer tools available.

  1. Check the Console for CSP messages.
  2. Use the Network panel to inspect the page’s response headers.
  3. Repeat the action associated with the report, such as opening the support widget.
  4. Compare the resource and directive with the report in Header Centaur.

Test with a clean browser profile or with extensions disabled where possible. Extensions can introduce activity that doesn’t come from your application.

If you cannot reproduce the issue, consider whether it depends on a particular page, consent choice, account state, browser, or older cached version of the site. A single visit may not exercise the same conditions as the original report.

Choose the right response

Most investigations lead to one of three outcomes.

The resource is required and trusted

If the support widget is intentional, you may need to adjust the policy to permit its script source.

For this simplified example, the change would be:

Content-Security-Policy: default-src 'self'; script-src 'self' https://widgets.example.net

This is an illustration, not a complete policy to copy onto your site. Keep your existing directives and reporting configuration, and review the permissions needed by your own integration.

A widget may also load images, styles, frames, or API connections. Investigate those requirements individually instead of broadly allowing the domain everywhere.

In Header Centaur, use Approve as trusted when your investigation supports that decision. Approved activity can inform the policy builder’s recommendations, so approval should reflect a deliberate trust decision.

The resource should not be loaded

Sometimes the policy is doing exactly what you want.

The report might expose an outdated integration, an unexpected tag, or a resource your team no longer uses. Fix or remove the source of that activity rather than expanding the policy to accommodate it.

Use Reject when the activity should not contribute to the policy builder’s trusted inputs.

The activity is noise or needs more investigation

Some reports may relate to browser extensions, automated traffic, or conditions you cannot yet reproduce.

Use Investigating while you gather evidence. If you conclude that a group does not require action, use Ignored and record the reasoning in your team’s normal investigation notes.

Review decisions and investigation status serve different purposes: deciding that activity is trusted is separate from deciding that the issue has been resolved.

Test any policy change before enforcing it

Avoid making broad policy changes just to make reports disappear. Wildcards and weaker script settings can remove useful protections without addressing the underlying cause.

When preparing a policy change:

  1. Review the proposed permissions.
  2. Test it in a controlled environment or through an appropriate Report-Only rollout.
  3. Exercise important journeys, including consent-dependent features and authenticated pages.
  4. Deploy the enforced change when you have enough evidence.
  5. Watch for new violations and check that the affected feature works.

Adding a Report-Only policy does not relax an existing enforced policy. If the enforced policy still blocks the resource, it will continue to do so.

Header Centaur’s policy builder can help you prepare a recommendation from trusted activity. Review the result before applying it: Header Centaur does not deploy the policy to your website.

Confirm the outcome

After your fix is deployed, revisit the affected page and repeat the original action.

Check that the feature behaves as intended and review subsequent reports in Header Centaur. Existing reports remain useful history; they do not disappear because the issue has been fixed.

Mark the group Resolved once you have verified the outcome. Keep monitoring after resolution, because later changes can introduce new activity.

A drop in reports alone is not proof of success. Confirm that reporting still works and that the relevant visitor journeys have actually been exercised.

Your next step

Open Violations, choose one group, and answer three questions:

  • What was the browser trying to do?
  • Does that activity belong on this site?
  • Should you change the application, the policy, or neither?

Answering those questions turns a CSP report into a clear, reviewable decision.