-
Notifications
You must be signed in to change notification settings - Fork 981
Description
Describe the bug
First of all thanks for the incredible work realized !
We use the mjml-browser package to make some basic mjml->html conversion but the mjml-browser bundle contains some code that causes CSP (Content Security Policy) issues:
This issue is due to code that is equivalent to use of eval (cf. https://developer.mozilla.org/fr/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#unsafe-eval)
In the bundle file there is at least two occurrences of eval code :
And
To Reproduce
Steps to reproduce the behavior:
- Create a website with CSP and minimal whitelist rules (for example 'strict-dynamic' and 'self' for script-src CSP policy)
- require mjml-browser in your code
- See error :
Expected behavior
No use of unsafe-eval in production code
MJML environment (please complete the following information):
- OS: Ubuntu 22.04.3 LTS
- MJML Version 4.14.1
- MJML Browser Version 4.14.1
Additional context
Saw this issue - webpack/webpack#6461 - so applied some recommended potential solutions, but I was only able to remove the first "eval" code (the call to new Function("return this")) but not the second one (new Function(""+e)).
Maybe an upgrade to a more recent version of webpack can help (tried upgrading to webpack@latest but too much errors at build time)
It's very crucial for us to keep consistent CSP rules to avoid security issues and to stay aligned with best practices in web security.
Thanks in advance for your help


