MessageFormat transpiler throws 'unsafe-eval' when activating CSP
See original GitHub issueAfter activating CSP for my app I get the following error:
ERROR 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' 'unsafe-inline'".
at new Function (<anonymous>)
at t.value (main-es2015.cb51f3636f796a68c875.js:formatted:3091)
at transpile (main-es2015.cb51f3636f796a68c875.js:formatted:63482)
at translate (main-es2015.cb51f3636f796a68c875.js:formatted:34366)
at t.updateValue (main-es2015.cb51f3636f796a68c875.js:formatted:34679)
at u._next (main-es2015.cb51f3636f796a68c875.js:formatted:34670)
at u.__tryOrUnsub (main-es2015.cb51f3636f796a68c875.js:formatted:10670)
at u.next (main-es2015.cb51f3636f796a68c875.js:formatted:10633)
at l._next (main-es2015.cb51f3636f796a68c875.js:formatted:10593)
at l.next (main-es2015.cb51f3636f796a68c875.js:formatted:10578)
Is it really necessary for transloco to use eval in production bundles? Or is there something wrong with the configuration of my app?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Update to angular 12 gives CSP unsafe-eval error in chrome ...
Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval'".
Read more >Reactive Extensions (Rx) – Part 7 - Muhammad Rehan Saeed
I was talking to a colleague yesterday who had been using standard C# events in WPF (The principals learned in this post can...
Read more >https://patch-diff.githubusercontent.com/raw/vuejs...
toString().match(/unsafe-eval|CSP/)) { + warn$$1( + 'It seems you are using the standalone build of Vue.js in an ' + + 'environment with Content...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ftischler so the best option is to create an issue in messageformat github repository and link it here. Also it worth to report package on its npm page to mark those versions as risky.
Edited: There is already such an issue https://github.com/messageformat/messageformat/issues/180 created. They are recommending usage of https://formatjs.io/docs/intl-messageformat/ as a replacment.
@k3nsei messageformat.transpiler.ts imports the node_module messageformat which uses eval here at line 197 and many others as well.
Can I do something to get rid of this? I would like to remove ‘unsafe-eval’ from my CSP as quick as possible. Thank you 😊