Directives
An index of Content Security Policy directives by category, fetch, document, navigation, reporting, and Trusted Types, with their fallback chains.
Last update:
A Content Security Policy (CSP) is built from directives. Each directive names one resource type or behavior and sets the rule for it: which script hosts are allowed, who may frame the page, where the policy reports to. This page groups every directive by category and links each one to its own reference, so you can find the right directive for what you need to control.
For the rest of the policy syntax, see the values a directive accepts and the headers that deliver it.
Fetch directives
Fetch directives control where a page may load a given resource type from. They
all take a space-separated source list (or 'none') and, unless noted below,
fall back to
default-src
when you do not set them.
| Directive | Controls | Falls back to |
|---|---|---|
| default-src | The fallback source list for most fetch directives | nothing |
| script-src | JavaScript: elements, inline, eval, handlers | default-src |
| script-src-elem | <script> elements | script-src |
| script-src-attr | Inline event handler attributes | script-src |
| style-src | Stylesheets and inline styles | default-src |
| style-src-elem | <style> and <link rel=stylesheet> | style-src |
| style-src-attr | Inline style= attributes | style-src |
| img-src | Images and favicons | default-src |
| font-src | @font-face loads | default-src |
| media-src | <audio>, <video>, <track> | default-src |
| object-src | <object> and <embed> | default-src |
| connect-src | fetch, XHR, WebSocket, EventSource, Beacon | default-src |
| manifest-src | Web app manifest | default-src |
| frame-src | <frame> and <iframe> sources | child-src |
| child-src | Fallback for frame-src and worker-src | default-src |
| worker-src | Worker, SharedWorker, ServiceWorker scripts | child-src |
| prefetch-src | Prefetched and prerendered resources | default-src |
| fenced-frame-src | <fencedframe> sources | frame-src |
prefetch-src is deprecated and removed from Chromium, and fenced-frame-src is
experimental and Chromium-only; the directive pages cover the current status of
each.
Document directives
These directives govern properties of the document itself rather than a fetch.
None of them fall back to default-src.
| Directive | Controls |
|---|---|
| base-uri | The URLs a <base href> may set |
| sandbox | Applies sandbox flags to the document |
| plugin-types | Allowed plugin MIME types (deprecated) |
base-uri has no fallback, so omitting it leaves the page open to base-tag
injection. sandbox takes sandbox tokens rather than a source list and cannot be
set through a <meta> tag. plugin-types is deprecated; use object-src 'none'
instead.
Navigation directives
Navigation directives restrict where the page may navigate and who may navigate
to it. Neither falls back to default-src.
| Directive | Controls |
|---|---|
| form-action | Allowed <form action> targets |
| frame-ancestors | Which parents may embed this page |
frame-ancestors is the anti-clickjacking directive and supersedes
X-Frame-Options.
It also cannot be set through a <meta> tag.
Reporting directives
Reporting directives say where the browser should send violation reports. They are configured per policy and have no fallback.
| Directive | Controls |
|---|---|
| report-to | Names a reporting endpoint group from the Reporting API |
| report-uri | Posts reports directly to a URI (deprecated, keep alongside report-to) |
report-to references a group defined in the
Reporting-Endpoints header.
report-uri is the legacy mechanism and is ignored where report-to is
supported. report-to recently became available across current Chrome, Firefox,
and Safari, so keep report-uri only for old browser versions. See the
CSP headers overview
for how the wiring fits together.
WebRTC directives
WebRTC traffic is not covered by any fetch directive, so the spec draft adds a
dedicated directive for it. It takes 'allow' or 'block' rather than a
source list.
| Directive | Controls |
|---|---|
| webrtc | WebRTC connections (spec-only, no browser support yet) |
Other directives and Trusted Types
These directives do not fit the categories above. None fall back to
default-src.
- upgrade-insecure-requests: a flag directive that rewrites insecure subresource and navigation URLs to HTTPS. It does not replace HSTS.
- block-all-mixed-content:
a flag directive that blocks every HTTP subresource on an HTTPS page. It is
deprecated, superseded by
upgrade-insecure-requestsand default mixed-content blocking. - require-trusted-types-for:
forces Trusted Types at DOM XSS sinks; its value is the token
'script'. Recently became available across current Chrome, Firefox, and Safari. - trusted-types: an allowlist of Trusted Types policy names that constrains which policies the page may create. Recently became available across current Chrome, Firefox, and Safari.
Removed directives
Three directives were dropped from the platform without shipping and keep a short reference page each, since they still appear in old policies and blog posts.
| Directive | Status | What replaced it |
|---|---|---|
| navigate-to | ⚠️ Deprecated | Nothing |
| referrer | ⚠️ Deprecated | The Referrer-Policy header |
| require-sri-for | ⚠️ Deprecated | The Integrity-Policy header |
A fourth, disown-opener, was dropped in favor of
Cross-Origin-Opener-Policy
and does not get a dedicated page. prefetch-src and plugin-types, listed
above as deprecated, have their own pages too.
Fallback chains
When a directive is not set, the browser walks a chain to find a rule. The most
common CSP mistake is assuming default-src covers everything; it does not cover
the document, navigation, reporting, or Trusted Types directives, so each of
those must be set explicitly.
The graph covers every directive that participates in a fallback chain. ⚠️ marks a deprecated directive, 🧪 an experimental one; the directives with no fallback are listed after the graph, and each directive page covers its exact status.
script-src-elemandscript-src-attrtoscript-srctodefault-src; the-attrvariant skips-elemand falls back straight toscript-srcstyle-src-elemandstyle-src-attrtostyle-srctodefault-src, with the same skipframe-srctochild-srctodefault-srcworker-srctochild-srctoscript-srctodefault-src; thechild-srctoscript-srchop applies to worker loads onlyfenced-frame-src(experimental, Chromium-only) toframe-srctochild-srctodefault-srcconnect-src,font-src,img-src,manifest-src,media-src,object-src, and the deprecatedprefetch-srceach fall back todefault-src- No fallback (set these explicitly):
base-uri,form-action,frame-ancestors,sandbox,report-uri,report-to,upgrade-insecure-requests,block-all-mixed-content,require-trusted-types-for,trusted-types,webrtc
To check which directives a real policy is missing, run it through the CSP evaluator, or scan a live page for its headers with the CSP scanner.