File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -260,6 +260,7 @@ function jq_content_security_policy() {
260
260
return ;
261
261
}
262
262
$ nonce = bin2hex ( random_bytes ( 8 ) );
263
+ $ report_url = 'https://csp-report-api.openjs-foundation.workers.dev/ ' ;
263
264
$ policy = array (
264
265
'default-src ' => "'self' " ,
265
266
'script-src ' => "'self' 'nonce- $ nonce' code.jquery.com " ,
@@ -277,7 +278,10 @@ function jq_content_security_policy() {
277
278
'frame-ancestors ' => "'none' " ,
278
279
'base-uri ' => "'self' " ,
279
280
'block-all-mixed-content ' => '' ,
280
- 'report-to ' => 'https://csp-report-api.openjs-foundation.workers.dev/ ' ,
281
+ 'report-to ' => 'csp-endpoint ' ,
282
+ // Add report-uri for Firefox, which
283
+ // does not yet support report-to
284
+ 'report-uri ' => $ report_url ,
281
285
);
282
286
283
287
$ policy = apply_filters ( 'jq_content_security_policy ' , $ policy );
@@ -287,6 +291,7 @@ function jq_content_security_policy() {
287
291
$ policy_string .= $ key . ' ' . $ value . '; ' ;
288
292
}
289
293
294
+ header ( 'Reporting-Endpoints: csp-endpoint=" ' . $ report_url . '" ' );
290
295
header ( 'Content-Security-Policy-Report-Only: ' . $ policy_string );
291
296
}
292
297
You can’t perform that action at this time.
0 commit comments