Guides

CSP sources for common third-party services

Vendors change their hosts, so each list links to its source. Add the values to the directives you already have: a directive can appear only once in a policy.

Google Tag Manager

Google recommends a nonce, set in the header and on the container snippet:

script-src-elem 'nonce-RANDOM'

Without one, the container needs:

script-src-elem https://www.googletagmanager.com 'unsafe-inline';
img-src https://www.googletagmanager.com;
connect-src https://www.googletagmanager.com https://www.google.com

Custom JavaScript variables also need 'unsafe-eval' in script-src. Tags you add in Tag Manager need their own sources, so keep reporting on: anyone with access can add a tag that your policy then blocks.

Source: Google, use Tag Manager with a CSP

Google Analytics 4

Without advertising features:

script-src-elem https://www.googletagmanager.com;
img-src https://www.googletagmanager.com https://*.google-analytics.com;
connect-src https://www.googletagmanager.com https://*.google-analytics.com https://*.google.com

With Google Ads features there are several more, including country domains such as https://*.google.co.uk. Google lists them on the same page.

Source: Google, use Tag Manager with a CSP

Google Fonts

style-src https://fonts.googleapis.com;
font-src https://fonts.gstatic.com

Hosting the fonts yourself removes both, and the connection to Google.

Stripe

Stripe.js and Elements:

script-src https://*.js.stripe.com https://js.stripe.com https://maps.googleapis.com;
frame-src https://*.js.stripe.com https://js.stripe.com https://hooks.stripe.com;
connect-src https://api.stripe.com https://maps.googleapis.com

Stripe Checkout:

script-src https://checkout.stripe.com;
frame-src https://checkout.stripe.com;
connect-src https://checkout.stripe.com;
img-src https://*.stripe.com

Link and Connect embedded components have more, on Stripe's page.

Source: Stripe, integration security guide

reCAPTCHA

Google recommends a nonce on the script tag. Otherwise:

script-src https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/;
frame-src https://www.google.com/recaptcha/ https://recaptcha.google.com/recaptcha/;
connect-src https://www.google.com/recaptcha/

Keep the paths. https://www.google.com on its own allows far more than reCAPTCHA.

Source: Google, reCAPTCHA FAQ

Cloudflare Turnstile

script-src https://challenges.cloudflare.com;
frame-src https://challenges.cloudflare.com

A nonce on the script tag works too. In pre-clearance mode, connect-src has to include 'self'.

Source: Cloudflare, Turnstile CSP reference

hCaptcha

script-src https://hcaptcha.com https://*.hcaptcha.com;
frame-src https://hcaptcha.com https://*.hcaptcha.com;
style-src https://hcaptcha.com https://*.hcaptcha.com;
connect-src https://hcaptcha.com https://*.hcaptcha.com

hCaptcha asks you not to list individual subdomains, because they change.

Source: hCaptcha documentation

Sentry

For the browser loader:

script-src https://browser.sentry-cdn.com https://js.sentry-cdn.com;
connect-src *.sentry.io

Also add the host in your DSN to connect-src. Bundling the SDK with your own code removes the need for the script hosts.

Source: Sentry, loader script

YouTube embeds

frame-src https://www.youtube.com https://www.youtube-nocookie.com

Anything else

Search the vendor's help for “CSP”. If there is nothing, add the service with a report-only policy and see which hosts it uses. Be wary of allowing a shared host such as *.cloudfront.net, where anyone can put a file.

Last checked 24 November 2026.

Read next