Closed
Description
I recently discovered that one of plotly.js's dependency is using Function
constructor.
Unfortunately, I can't tell exactly which one, but the code doesn't seems to belong to plotly itself.
Here is Chrome's error message:
plotly.js:74222Uncaught 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'
www.google-analytics.com ajax.googleapis.com 'nonce-67df8dace6ea7feb57cab73e41ebe0c7'".
makeOp @ plotly.js:74222
(anonymous function) @ plotly.js:74244
455.cwise-compiler @ plotly.js:74271
s @ plotly.js:7
(anonymous function) @ plotly.js:7
129.ndarray @ plotly.js:25687
s @ plotly.js:7
(anonymous function) @ plotly.js:7
138../lib/shaders @ plotly.js:27330
s @ plotly.js:7
(anonymous function) @ plotly.js:7
798.../../constants/gl3d_dashes @ plotly.js:127609
s @ plotly.js:7
(anonymous function) @ plotly.js:7
800.../../constants/gl_markers @ plotly.js:128154
s @ plotly.js:7
(anonymous function) @ plotly.js:7
15.../src/traces/scatter3d @ plotly.js:355
s @ plotly.js:7
(anonymous function) @ plotly.js:7
12../bar @ plotly.js:312
s @ plotly.js:7
e @ plotly.js:7
(anonymous function) @ plotly.js:7
a @ plotly.js:7
(anonymous function) @ plotly.js:7
__webpack_require__ @ bootstrap 08e5224…:585
fn @ bootstrap 08e5224…:109
(anonymous function) @ svg-to-png.js:2
__webpack_require__ @ bootstrap 08e5224…:585
fn @ bootstrap 08e5224…:109
(anonymous function) @ commons.js:36658
__webpack_require__ @ bootstrap 08e5224…:585
fn @ bootstrap 08e5224…:109
(anonymous function) @ index.js:1
__webpack_require__ @ bootstrap 08e5224…:585
fn @ bootstrap 08e5224…:109
(anonymous function) @ bootstrap.js:9
__webpack_require__ @ bootstrap 08e5224…:585
fn @ bootstrap 08e5224…:109
(anonymous function) @ index.js:3
__webpack_require__ @ bootstrap 08e5224…:585
fn @ bootstrap 08e5224…:109
(anonymous function) @ index.js:8
__webpack_require__ @ bootstrap 08e5224…:585
webpackJsonpCallback @ bootstrap 08e5224…:21
(anonymous function) @ index.js:1
Function constructor is considered by browser's CSP as an equivalent of eval
.
Therefore, we can't setup a good Content Security Policy, unless we allow 'unsafe-eval'
which is a whole in the policy itself.
It is possible to identify the faulty dependency, and maybe provide a workaround ?