Skip to main content
Reference

Content-Security-Policy Directive Reference

Alphabetized CSP directive summaries and practical examples adapted from MDN. Use this page as a quick reference while you are reading scan results or composing policies.

Fetch Directive Syntax
Need the full syntax rules behind source lists, nonces, hashes, and quoted values? Open the dedicated explainer.
Open syntax guide
Document

Restricts which URLs can be used in a page's <base> element so relative links cannot be rewritten to an unexpected origin.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: base-uri 'self';
Security Deprecated

Blocks insecure HTTP subresources on HTTPS pages so browsers do not load mixed content.

Obsolete: modern mixed content handling already covers this behavior.

Possible values
(bare directive only)
Example
Content-Security-Policy: block-all-mixed-content;
Legacy

Legacy fallback for nested browsing contexts and workers. Modern policies usually prefer frame-src and worker-src.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: child-src 'self' https://widgets.example.com;
Fetch

Controls the destinations allowed for fetch, XMLHttpRequest, WebSocket, EventSource, and similar network connections.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: connect-src 'self' https://api.example.com;
Baseline

Provides a fallback source list for fetch directives that are not explicitly set elsewhere in the policy.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: default-src 'self';

Restricts sources that can be loaded into fenced frames, which are designed for privacy-preserving embedded content.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: fenced-frame-src https://ads.example.com;
Fetch

Controls where fonts can be loaded from, including fonts referenced by @font-face.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: font-src 'self' https://fonts.example.com;
Navigation

Limits where forms can submit data so posted credentials and messages only go to approved endpoints.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: form-action 'self';
Navigation

Controls which parent pages are allowed to embed the current document in a frame, iframe, or object context.

Possible values
'none' <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: frame-ancestors 'none';
Fetch

Restricts the sources that can be loaded into frames and iframes.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: frame-src https://player.example.com;
Fetch

Controls which origins may deliver images, favicons, and other image-like resources.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: img-src 'self' data: https://images.example.com;
Fetch

Sets the allowed sources for web app manifest files.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: manifest-src 'self';
Fetch

Restricts audio, video, and text track sources.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: media-src 'self' https://media.example.com;
Fetch

Controls plug-in style resources such as object, embed, and applet content. Most modern policies set this to none.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: object-src 'none';
Legacy Deprecated

Limits which MIME types are allowed for embedded plugin content.

Deprecated in modern CSP usage.

Possible values
<media-type>
Example
Content-Security-Policy: plugin-types application/pdf;
Fetch

Defines the sources that may be used for prefetching or similar speculative loading behavior.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: prefetch-src 'self' https://cdn.example.com;
Reporting

Points CSP violation reports at a Reporting API endpoint group configured elsewhere in the response headers.

Possible values
<endpoint-group-name>
Example
Reporting-Endpoints: csp=https://reports.example.com/csp; Content-Security-Policy: report-to csp;
Reporting Deprecated

Legacy reporting destination for CSP violation reports. It is still useful for compatibility with older browsers and tooling.

Use report-to for new policies.

Possible values
<URI>
Example
Content-Security-Policy: report-uri https://reports.example.com/csp;

Requires Trusted Types at sensitive DOM XSS sinks so string-based injection paths are rejected.

Possible values
'script'
Example
Content-Security-Policy: require-trusted-types-for 'script';
Document

Applies iframe-style sandbox restrictions to the protected document, disabling capabilities unless they are explicitly re-enabled.

Possible values
(bare directive) allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols
Example
Content-Security-Policy: sandbox allow-scripts;
Fetch

Controls where JavaScript and related executable content can load from. It is one of the most important CSP directives.

Possible values
'none' * <host-source> <scheme-source> 'self' 'unsafe-inline' 'unsafe-hashes' 'unsafe-eval' 'wasm-unsafe-eval' 'strict-dynamic' 'report-sample' 'nonce-<nonce_value>' 'sha256-<hash_value>' 'sha384-<hash_value>' 'sha512-<hash_value>'
Example
Content-Security-Policy: script-src 'self' https://cdn.example.com;

Restricts script content that appears inside HTML event handler attributes such as onclick or onload.

Possible values
'none' 'unsafe-inline' 'unsafe-hashes' 'report-sample'
Example
Content-Security-Policy: script-src-attr 'none';

Restricts script elements specifically, separate from inline handler attributes.

Possible values
'none' * <host-source> <scheme-source> 'self' 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' 'report-sample' 'nonce-<nonce_value>' 'sha256-<hash_value>' 'sha384-<hash_value>' 'sha512-<hash_value>'

Same source-list syntax as script-src, except unsafe-hashes does not apply here.

Example
Content-Security-Policy: script-src-elem 'self' https://cdn.example.com;
Fetch

Controls where stylesheets and style resources can be loaded from.

Possible values
'none' * <host-source> <scheme-source> 'self' 'unsafe-inline' 'unsafe-hashes' 'unsafe-eval' 'report-sample' 'nonce-<nonce_value>' 'sha256-<hash_value>' 'sha384-<hash_value>' 'sha512-<hash_value>'
Example
Content-Security-Policy: style-src 'self' https://fonts.example.com;

Restricts CSS in style attributes on elements, which helps reduce style injection risk.

Possible values
'none' 'unsafe-inline' 'unsafe-hashes' 'report-sample'
Example
Content-Security-Policy: style-src-attr 'none';

Controls sources for style elements and linked stylesheets separately from inline style attributes.

Possible values
'none' * <host-source> <scheme-source> 'self' 'unsafe-inline' 'unsafe-eval' 'report-sample' 'nonce-<nonce_value>' 'sha256-<hash_value>' 'sha384-<hash_value>' 'sha512-<hash_value>'

Same source-list syntax as style-src, except unsafe-hashes does not apply here.

Example
Content-Security-Policy: style-src-elem 'self' https://fonts.example.com;
Security

Defines the Trusted Types policy names that the page is allowed to create and use.

Possible values
(bare directive) 'none' <policyName> <policyName> <policyName> 'allow-duplicates' *
Example
Content-Security-Policy: trusted-types default dompurify;

Tells the browser to rewrite HTTP requests to HTTPS automatically when possible.

Possible values
(bare directive only)
Example
Content-Security-Policy: upgrade-insecure-requests;
Fetch

Restricts the sources that can be used for web workers, shared workers, and service workers.

Possible values
'none' * <host-source> <scheme-source> 'self'
Example
Content-Security-Policy: worker-src 'self';
Summaries and examples are adapted from MDN's Content-Security-Policy reference. If you want, this page can be expanded later with per-directive notes from the scan engine.