Skip to content

Manage the policy

After setup, the Policy tab of Security > CSP holds the policy and every control that changes it. The Overview tab shows the totals (active violations, pending sources, pages, the policy version and mode) and the quick actions.

The card Current policy shows the version, the mode (Report-only or Enforcing) and one of two states: Deployed or Not deployed. Read the policy By directive or as Text.

A change to the policy makes a new version. A new version is not live until you deploy it. When a version waits, the page shows “Version N is ready to deploy” with a Deploy button.

  1. Select Deploy.
  2. Read the dialog. It shows the exact headers that Quant writes to the project.
  3. Select Deploy to confirm.

Quant writes the headers and clears the cache of the project. Allow up to about a minute before every page shows the new header.

The card Versions lists each version. Each generate, edit, import, restore or mode switch makes a version.

  • View shows the policy text and the mode of a version.
  • Restore makes a new version from that version. The new version is not live until you deploy it.

Use Add a source in the Sources card when you know that the site needs a source that no scan found.

  1. Select the Kind:
    • Domain: a host name such as cdn.example.net. Do not use * or a path.
    • Hash: the hash of one inline script or one inline style, as sha256-, sha384- or sha512- followed by the base64 value.
    • Keyword: a CSP keyword such as 'unsafe-inline', 'unsafe-eval', 'wasm-unsafe-eval', 'unsafe-hashes', 'strict-dynamic', data: or blob:. The dialog tells you the effect before you confirm.
  2. Select the Type: script, style, img, font, connect, media, frame, worker, object, manifest, form-action, base-uri or frame-ancestors. A hash applies to script or style only.
  3. Add the source.
  4. Open the actions of the current policy and select Generate from approved sources. This makes a new version.
  5. Select Validate, then Deploy.

To find new sources after the site changes, select Scan for sources in the Pages card. New sources show as pending in the Sources list. Approve or deny them, then generate a new version.

  • Edit opens the policy text. Do not write report directives: Quant adds them on deploy.
  • Import takes one Content-Security-Policy header value that you paste, and a mode. Use it to bring in a policy that you wrote by hand.

Each makes a new version. Validate the version before you deploy it.

  1. Select Switch to enforcing mode or Switch to report-only mode.
  2. Confirm. This makes a new version in the other mode. Nothing changes on the site at this step.
  3. Select Deploy and read the headers of the new version. Then confirm.

The card Site settings holds the Base URL that scans and drift checks read, and the two strict flags. After you change a setting, scan for sources and generate a new version.

Browsers send violation reports to an address that is unique to the site. Change report address gives the site a new address. Use it if the address receives reports that do not come from your site.

The old address works for 24 hours. Then Quant writes the headers again with the new address. You can change the address 5 times in one day.

Quant compares the headers that the site serves with the policy you deployed. A difference is drift. A typical cause is a change to the project headers outside the CSP page.

When Quant finds drift, the page shows The served headers differ from the deployed policy above the tabs, with the served headers. Select one action:

  • Restore the deployed policy writes the deployed policy to the project again.
  • Accept the served policy records the served headers as the deployed policy, as a new version. Its new sources start as pending. No header is written.

Check for drift now on the Overview tab runs the check at once.

After a policy is deployed, the CSP page owns three header names: Content-Security-Policy, Content-Security-Policy-Report-Only and Reporting-Endpoints.

A request to the custom headers API that includes one of these names succeeds with status 200, and your other headers are saved. The owned names are not changed. The response header X-Quant-Warning names the headers that the request did not change.

If a script, a CI job or Terraform sets a CSP header on the project, remove those names from it and manage the policy on the CSP page.

The History tab lists past scans (discovery, validation and script integrity) with their results, and each deployment: deploy, mode switch, restore and accept.