I tried adding nonce to SCRIPT_SRC
, but CSP complains about adsbygoogle.js:
refused to execute inline event handler because it violates the following Content Security Policy directive:
"script-src 'self' *.facebook.net *.facebook.com www.google.com www.gstatic.com
google.com www.google-analytics.com adservice.google.com adservice.google.de
pagead2.googlesyndication.com www.pagead2.googlesyndication.com
https://pagead2.googlesyndication.com storage.googleapis.com
googleads.g.doubleclick.net ajax.googleapis.com 'nonce-5MallQacNWY+qLLMd5hwAGRaJXReVK7U'".
(anonymous) @ adsbygoogle.js:2887
It complains about line 2887 (I unminified adsbygoogle.js to see which line csp complains about).
I assume adding nonce will allow anything from the javascript file it is applied to, except unsafe-inline
.
Is there another way to have google adsense play along with CSP or is adding 'unsafe-inline' the only option?
According to this stackoverflow answer https://stackoverflow.com/a/44867210/4496068 it won't work properly with CSP.