CentralCSP
Reporting APIReport types

Script hash

The csp-hash report sends a hash of every script the page loads, the basis for a browser-side script inventory.

Last update:

A csp-hash report carries the hash of an external script the page loaded. Unlike a violation report, it is not about something being blocked: you opt in with a 'report-sha256' source expression and the browser reports a hash for every matching resource. That stream is how you build an inventory of the scripts actually running in the browser, mapped to library, version, and known CVEs.

Chromium and Safari, not Firefox

Script hash reporting ships enabled by default in Chromium (133+) and Safari (18.4+), with no origin trial. Firefox does not send it. The field casing also differs from the CSP draft (see Gotchas), so check a live capture. See Browser support below.

When the browser sends it

When the directive that governs script elements (script-src-elem, or its fallback script-src or default-src) carries 'report-sha256' (or 'report-sha384' / 'report-sha512'), the browser (Chromium 133+, Safari 18.4+) emits one csp-hash report for each external script it loads, sent to the policy's report-to endpoints (a policy with only report-uri sends nothing). Inline scripts and other destinations are not reported. It reports rather than blocks, so it does not affect what runs, and it works in enforced and Report-Only policies alike. Hash reports are not exposed to ReportingObserver; they only go to the endpoint.

Setup

Reporting-Endpoints: hashes-endpoint="https://<Endpoint-ID>.report.centralcsp.com"
Content-Security-Policy-Report-Only: script-src 'self' 'report-sha256'; report-to hashes-endpoint

Payload example

{
  "type": "csp-hash",
  "age": 12,
  "url": "https://example.com/",
  "user_agent": "Mozilla/5.0 ...",
  "body": {
    "documentURL": "https://example.com/",
    "subresourceURL": "https://example.com/main.js",
    "hash": "sha256-hQOPj5p/GwS1Mpxe2N/9xBO/jfeTVTBcuw6B5I3+9p0=",
    "type": "subresource",
    "destination": "script"
  }
}

Every csp-hash report body carries these fields inside the shared report envelope.

Field reference

FieldMeaning
documentURLThe page the script loaded on.
subresourceURLThe URL of the loaded script or resource.
hashThe hash as <alg>-<base64>, for example sha256-.... Empty for a cross-origin script loaded without CORS (no crossorigin attribute), since its body is opaque.
typeAlways subresource in Chromium and WebKit.
destinationAlways script in Chromium and WebKit.

How to receive it

Declare an endpoint and add 'report-sha256' to script-src; keep the policy in Report-Only so it never blocks. This is the exact mechanism behind the CentralCSP Technologies inventory, which maps each reported hash to a library, version, and known CVEs, and behind the PCI DSS script inventory that records the review status of each script, with no snippet or browser extension required.

What it tells you about security

A script hash you did not deploy is a supply-chain signal: a tampered CDN asset, an injected formjacking or Magecart script, or an unexpected third party. Continuous hash reporting plus alerting on new or changed hashes is how you catch that change the moment it reaches a real browser, rather than in a post-incident review.

Gotchas

Field casing is unsettled: Chromium and WebKit emit camelCase (documentURL, subresourceURL) while the CSP editor draft example uses snake_case (document_url, subresource_url). Confirm against a live capture.

An earlier design used a 'report-hashes' keyword; the shipped keyword is 'report-sha256' (and the sha384/sha512 variants). The keyword and report shape are still evolving in the CSP draft, so expect them to change.

Browser support

Enabled by default in Chromium-based browsers since Chrome 133 and in Safari since 18.4. Firefox does not support it. Both engines send the same camelCase body, which differs from the CSP draft example, so check any parser against a live capture.

See also

Sources

On this page