Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari bug, The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored. 4 #23

Closed
arelaxend opened this issue Sep 19, 2018 · 3 comments

Comments

@arelaxend
Copy link

arelaxend commented Sep 19, 2018

Dear contributors,

The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.

The bug appears in the "demo" link of the page.

On Safari Version 12.0 (13606.2.11)

A.

Edit: reference here google/google-api-javascript-client#397

@arelaxend
Copy link
Author

arelaxend commented Sep 19, 2018

Here, they specify to use none https://developers.google.com/recaptcha/docs/faq#im-using-content-security-policy-csp-on-my-website-how-can-i-configure-it-to-work-with-recaptcha

I put the following as a try in my index.html

  <meta http-equiv="Content-Security-Policy" content="
    script-src 'self' 'nonce-ch4hvvbHDpv7xCSvXCs3BrNggHdTzxUA';
    frame-src 'self' 'nonce-ch4hvvbHDpv7xCSvXCs3BrNggHdTzxUA' ;
    style-src 'self' 'unsafe-inline';
    object-src 'self';
  ">

And, I add:

  var script = document.createElement('script');
   script.src = 'https://www.google.com/recaptcha/api.js?hl=' + locale + '&onload=GoogleRecaptchaLoaded&render=explicit';
 ...
  script.nonce = 'ch4hvvbHDpv7xCSvXCs3BrNggHdTzxUA';

And now, I am still getting the following error... unbelievable

Refused to load https://www.google.com/recaptcha/api2/anchor?ar=1&k=***=fr&v=v1536705955372&size=invisible&badge=inline&cb=*** because it does not appear in the frame-src directive of the Content Security Policy.

@arelaxend
Copy link
Author

arelaxend commented Sep 19, 2018

Ok, I found that is might or might not be relevant.
In their demo, https://www.google.com/recaptcha/api2/demo?invisible=true
They put a nonce for the script, and
content-security-policy: script-src 'report-sample' 'nonce-zPUGd9Hi6LE/jcyMULaEIKJTCDU' 'unsafe-inline' 'strict-dynamic' https: http: 'unsafe-eval';object-src 'none';base-uri 'self';report-uri https://csp.withgoogle.com/csp/recaptcha/1

@youriv2019
Copy link

this bug caused my website to stop working. I have taken recaptcha away now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants