Values
Every value a CSP directive accepts: keywords like 'self', host and scheme sources, nonces, hashes and report-sample, with links to each reference page.
Last update:
Most Content Security Policy (CSP) directives take a space-separated list of source expressions, the values that say what the directive allows. A source expression can be a keyword, a host, a scheme, a nonce, or a hash. This page is the index of those value types and links each one to its full reference.
For the directives that consume these values, see the directives overview; for how a policy is delivered, see the headers overview.
A compact policy that mixes a keyword, a nonce, and a scheme source:
Content-Security-Policy: script-src 'self' 'nonce-{RANDOM}'; img-src 'self' data:The value types
| Value type | Status | What it matches | Example |
|---|---|---|---|
| Keyword | ✅ Good | Single-quoted tokens with fixed meanings | 'self', 'none', 'strict-dynamic' |
| Host source | ✅ Good | A host, optionally with scheme, port, path, or wildcard | cdn.example.com, *.example.com |
| Scheme source | ✅ Good | A whole URL scheme | https:, data:, blob: |
| Nonce | ✅ Good | A per-response token matching a nonce attribute | 'nonce-r4nd0m' |
| Hash | ✅ Good | A digest of an inline script or style | 'sha256-...' |
| report-sample | ✅ Good | Includes a sample of the blocked content in the report | 'report-sample' |
| report-sha256 | ✅ Good | Report-only script hash collection, Chrome 133+ and Safari 18.4+, not Firefox | 'report-sha256' |
Status here rates the value type, not each individual value: 'unsafe-inline'
is a keyword and * is a host source, and both are unsafe. The per-keyword
statuses live on the
keywords page.
Keywords
Keywords are single-quoted tokens with fixed meanings, set out on the keywords page. The ones you reach for most:
'self'matches the page's own origin (same host and port, same scheme or thehttp:tohttps:upgrade), not its subdomains, and does not allow inline code.'none'matches nothing and is used on its own to block a resource type.'unsafe-inline'allows inline scripts and styles, but it is ignored when a nonce or hash is present in the same directive, and for scripts also when'strict-dynamic'is.'strict-dynamic'propagates trust from a nonce- or hash-allowed script to the scripts it loads, and makes host and scheme entries and'self'ignored. It is the basis of a strict policy.'trusted-types-eval'is a newer keyword that allowseval()only with aTrustedScriptwhen Trusted Types are enforced, as a replacement for'unsafe-eval'.
Host and scheme sources
A
host source
allowlists a host, with an optional scheme, port, path, or leading *. wildcard.
*.example.com matches subdomains at any depth but not example.com itself, and
a bare * does not match data:, blob:, or filesystem:.
A
scheme source
allowlists an entire scheme, such as https: or data:. Allowing data: in
script-src or style-src is dangerous; it is usually safe only in img-src or
font-src.
Nonces and hashes
A nonce or hash lets you allow a specific inline script or style without opening the door to all inline code.
- A nonce is a server-generated, unguessable token, unique to each response, set
both in the policy as
'nonce-...'and on the matching element'snonceattribute. - A hash is a digest of the exact inline content, written as
'sha256-...','sha384-...', or'sha512-...'. The browser hashes the element and allows it only if the digest matches.
You can compute a digest for inline content with the hash generator, and produce an integrity attribute for an external resource with the SRI generator.
Reporting values
report-sample
is a keyword you add to a directive to include the first part of the blocked
inline content as a sample field in the violation report, which makes a block
easier to track down.
Separately, the report-only hash keywords report-sha256, report-sha384, and report-sha512 tell the browser to report the hashes of the external scripts a page loads rather than to enforce anything. CentralCSP uses that mechanism to build a script inventory and SBOM of everything running on each page. The keywords are stable in current Chrome and in the CSP3 editor's draft grammar, but remain Chromium-only.
See also
Sources
Directives
Every Content Security Policy directive in one list, grouped by fetch, document, navigation and reporting, with the fallback chain each one follows.
Headers
The HTTP headers that deliver a Content Security Policy, enforce vs report-only, report-to vs report-uri, meta delivery limits, and how policies combine.