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

content security policy script-src: 'unsafe-eval' required to compile schema in netlify cms js 2.9.1 #2343

Closed
ghost opened this issue May 23, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented May 23, 2019

Describe the bug
Cannot load netlify cms js 2.9.1 without permitting the content security policy directive script-src: 'unsafe-eval'

To Reproduce
Steps to reproduce the behavior. For example:

  1. set the content security policy for a site to only permit certain script-src urls and NOT 'unsafe-eval'
  2. rebuild and deploy your website
  3. Visit the netlify cms admin url
  4. See error in the console output
Uncaught (in promise) EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'

    at new Function (<anonymous>)
    at v.D (index.js:120)
    at v.l (resolve.js:54)
    at Object.L [as resolveRef] (index.js:189)
    at Object.e.exports [as code] (ref.js:21)
    at Object.e.exports [as validate] (validate.js:285)
    at Object.e.exports [as code] (properties.js:195)
    at e.exports (validate.js:382)
    at D (index.js:88)
    at v.e (index.js:55)

Expected behavior
Setting the content security policy script-src directive WITHOT 'unsafe-eval' should load netlify cms at the admin url

Screenshots

Applicable Versions:

  • Netlify CMS version: 2.9.1
  • Chrome version: 74.0.3729.131

from https://unpkg.com/netlify-cms@^2.9.1/dist/netlify-cms.js

CMS configuration

Additional context

@erquhart
Copy link
Contributor

erquhart commented Jun 4, 2019

Duplicate of #2138, please track there.

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

No branches or pull requests

1 participant