File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,7 +61,11 @@ export function buildContentSecurityPolicy(
6161 env : RuntimeEnv = process . env ,
6262) : string {
6363 const apiOrigin = origin ( env . CNODE_API_BASE_URL || "https://api.cnodejs.org" ) ;
64- const connectSources = [ "'self'" , "https://challenges.cloudflare.com" ] ;
64+ const connectSources = [
65+ "'self'" ,
66+ "https://challenges.cloudflare.com" ,
67+ "https://cloudflareinsights.com" ,
68+ ] ;
6569 if ( apiOrigin && ! connectSources . includes ( apiOrigin ) ) connectSources . push ( apiOrigin ) ;
6670
6771 // Arbitrary HTTPS images are existing user-content behavior; scripts remain nonce-restricted.
Original file line number Diff line number Diff line change @@ -96,7 +96,9 @@ describe("Web document security headers", () => {
9696 const policy = buildContentSecurityPolicy ( "nonce" , {
9797 CNODE_API_BASE_URL : "https://api.example.com/v1" ,
9898 } ) ;
99- expect ( policy ) . toContain ( "connect-src 'self' https://challenges.cloudflare.com https://api.example.com" ) ;
99+ expect ( policy ) . toContain (
100+ "connect-src 'self' https://challenges.cloudflare.com https://cloudflareinsights.com https://api.example.com" ,
101+ ) ;
100102 expect ( policy ) . toContain ( "frame-src https://challenges.cloudflare.com" ) ;
101103 expect ( policy ) . toContain ( "img-src 'self' data: blob: https:" ) ;
102104 expect ( policy ) . toContain ( "report-uri /__csp-report" ) ;
You can’t perform that action at this time.
0 commit comments