From a73a309379f74741ab34c7504c55f3ce34c3d2fb Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Mon, 23 Nov 2026 23:33:00 +0000 Subject: [PATCH] site: let the CSP load CrawlProof stats and ads The layout has carried the stats.js and ad.js tags since launch, but the Content-Security-Policy added in #5 never listed crawlproof.com in script-src or connect-src. Every browser refused both scripts, so the CrawlProof dashboard for diskpush.com read zero visitors. Allow crawlproof.com for scripts and beacons, and ad creative images and media for the srcdoc ad frame, which inherits this policy. Co-Authored-By: Claude Fable 5.2 --- apps/web/next.config.mjs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index eeab32e..fee304a 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -7,15 +7,23 @@ // policy without 'unsafe-inline' in those two places blanks the page. Scripts // are otherwise same-origin only, which is the part that actually limits an // injection, and `object-src 'none'` plus `frame-ancestors 'none'` close the -// two classic bypasses. +// two classic bypasses. The one third-party script origin besides the WebMCP +// embed is crawlproof.com, our own analytics and ad server. const csp = [ "default-src 'self'", - "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net", + // crawlproof.com serves stats.js (analytics) and ad.js. Without it here the + // browser refuses both tags in the layout and the site records no traffic. + "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://crawlproof.com", "style-src 'self' 'unsafe-inline'", - "img-src 'self' data: https://built.indie.pit.world https://pwamart.com", + // Ad creatives render in a srcdoc frame, which inherits this policy, and + // their images come from whatever host the advertiser used. Images cannot + // run script, so any https origin is allowed. + "img-src 'self' data: https:", + "media-src 'self' https://crawlproof.com https://supabase.crawlproof.com", "font-src 'self' data:", - // The download page reads release metadata from the GitHub API. - "connect-src 'self' https://api.github.com", + // The download page reads release metadata from the GitHub API; stats.js + // and ad.js post page views and ad requests back to crawlproof.com. + "connect-src 'self' https://api.github.com https://crawlproof.com", "object-src 'none'", "base-uri 'self'", "form-action 'self'",