Comment by nchilada
9 days ago
Ironically, eval & co. don't actually increase the power of Optimizely Web Experimentation scripts, which are designed to support arbitrary customer-specific JavaScript and which primarily do so by compiling custom code into the syntax tree. (I left Optimizely in 2020, but I would be quite confident that the “only” inputs that get eval'd are intended code inputs.)
Softer questions might be: why is eval (still) being used for any inputs at all; and to the extent that it is used, why did¹ the docs not concede the breadth of CSP unsafe-eval (which allows eval in all scripts, not just Optimizely's), and why do the docs actively discourage attempts to enable Trusted Types (which includes the much narrower CSP trusted-types-eval²) instead of actively facilitating its use?
And needless to say, a more direct question would be: why should customers use a class of product that is so powerful that unsafe-eval doesn't increase its capabilities at all?
¹ cf. https://web.archive.org/web/20260810141143/https://support.o... vs. https://docs.optimizely.com/web-experimentation/docs/update-... (updated yesterday).
² ~84% browser support, per https://caniuse.com/mdn-http_headers_content-security-policy...
No comments yet
Contribute on Hacker News ↗