securingsincity / react-ace

React Ace Component
http://securingsincity.github.io/react-ace/
MIT License
4.08k stars 604 forks source link

useWorker: false results in CSP Violation #1488

Open bestickley opened 2 years ago

bestickley commented 2 years ago

Problem

With the below use of AceEditor I'm still getting these errors in the console:

ace.js:19091 Refused to create a worker from 'blob:http://localhost:3000/c076b617-e38c-40a6-996d-923c87884f75' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval'". Note that 'worker-src' was not explicitly set, so 'script-src' is used as a fallback.
Could not load worker DOMException: Failed to construct 'Worker': Access to the script at 'blob:https://example.com/5c992133-a21b-4c3e-a231-a5331bd6e901' is denied by the document's Content Security Policy.

Detail the problem here, including any possible solutions.

Sample code to reproduce your issue

<AceEditor
          setOptions={{ useWorker: false }}
          mode="json"
          value={editorInput}
          onChange={(i) => setEditorInput(i)}
          name={id}
          width={editorWidth}
          height={editorHeight}
        />

References

Progress on: #

aman-observo commented 3 months ago

@bestickley were you able to find the solution for this?

bestickley commented 3 months ago

@aman-observo, I don't think I did :/