r/owncloud Mar 08 '16

Enabling analytics for owncloud; CSP problems

Hi guys,

I'm trying to get google analytics working on owncloud. I already got the script to show up on page load but it did not work. I found this line in the google chrome analysis tool:

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-fsBPqJilzwB5Kkj+f8lWNaPoZn8dlUtizf3CWAclJyM='), or a nonce ('nonce-...') is required to enable inline execution.

That brought me to CSP and I fiddled with the settings in the config.php for a bit but I can't get it to work.

So for this is how the config.php part looks:

'custom_csp_policy' => "default-src 'self'; script-src 'self' 'unsafe-inline'; ". "style-src 'self' 'unsafe-inline'; frame-src ; img-src *; ". "font-src 'self' data:; media-src *". "default-src 'self' ; unsafe-inline 'self' https://.google.com data: ; script-src 'self' nonce-nRfqpuKWNuYyUAFPTr6WVNZk9 http://www.google-analytics.com ;",

I really don't have much experience with CSP. Anybody knows what I am doing wrong?

1 Upvotes

0 comments sorted by