Chrome is reporting Content Security Policy violations to the report-uri
, but it reports no violation details. It reports {}
instead of providing details regarding the violated policy. All other browsers seem to be reporting violation details fine. My policy is provided below.
I've tried...
report-uri
directive. Report-Only
modedefault-src 'none' ; report-uri /api/csp-report;
Questions I haven't found an answer for yet
The Policy (Delivered via HTTP Header)
Content-Security-Policy-Report-Only: default-src 'none' ; script-src 'self' 'unsafe-eval' https://www.google-analytics.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' https://www.google-analytics.com ; font-src 'self' https://fonts.gstatic.com; connect-src 'self' https://api.servicesite.com; frame-src 'none' ; child-src 'none' ; frame-ancestors 'none' ; form-action 'self' ; upgrade-insecure-requests; block-all-mixed-content; reflected-xss block; base-uri https://*.mysite.com; referrer origin-when-cross-origin; report-uri /api/csp-report;
That leads me to think this is a parsing issue in my receiving code (node, express using body-parser). However, still confounded as to why this would only happen for Chrome CSP reports. All other browser's reports pass though just fine.
application/json
described in CSP spec level 1content-type: application/json
Had to include application/csp-report
as a valid content type to parse.Changed this...
app.use(bodyParser.json());
To this...
app.use(bodyParser.json({type: ['application/json', 'application/csp-report']}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With