I keep getting CSP violation warnings like the one below when trying different libraries to add sortable items/ drag & drop functionalities to the Chrome Extension I am building:
Refused to load the script 'https://raw.githack.com/SortableJS/Sortable/master/Sortable.js'
because it violates the following Content Security Policy directive:
"script-src 'self' 'wasm-unsafe-eval'".
Note that 'script-src-elem' was not explicitly set,
so 'script-src' is used as a fallback.
The extension is using V3 of the manifest. I've got this in the configuration:
"content_security_policy": {
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self' 'wasm-unsafe-eval'; script-src-elem 'self' 'wasm-unsafe-eval';"
},
Does anyone know a way to add this functionality to a Chrome Extension?
I'd rather use pure JS but after having tried some of these options I continue to get unsafe-eval
related errors in Chrome.
Like the one below for example which is very simple but seems to be using some sort of eval
variation and Chrome won't let me use this for my extension:
(I'll use JSFiddle links so as not to burden you visually with too much code)
https://jsfiddle.net/jqzzy/028mw6v3/50/
Works ok but not when I add this to my Extension.
Also tried this one with "SortableJS" library and I get the same unsafe-eval
problem:
https://jsfiddle.net/jqzzy/981Lygfx/11/
Does this mean that sortable/drag & drop functions have to absolutely use eval
or its variations?