-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MessageFormat transpiler throws 'unsafe-eval' when activating CSP #364
Comments
@ftischler I scaned source code on github and npm and I cannot find any |
@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 😊 |
Here the error with SourceMaps enabled:
|
@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: |
@k3nsei so does it need to be replaced in transloco or is there a possibility for me to change the configuration of my app to avoid the usage of it? |
@k3nsei thanks for referencing the issues. I'll add a note about it in the docs so people are aware. @ftischler You don't have to use the message format transpiler if you are not actually using it. |
Can I also just add that It becomes a problem when it's evaluating text from a source outside the developer's control, such as User Generated Content. However, if the developer controls what it is evaluating it's a much reduced risk. To avoid CSP issues though it's definitely worth investigating intl-messageformat if it does not use |
@k3nsei @shaharkazaz @Coly010 thanks a lot for your help. I really appreciate your work! I forked transloco and played a little bit arround with intl-messageformat here Some things worked, but 2 tests still broke at the end. On my way I saw another problem: transloco has a dependency on TypeScript v3 (I Think because of Angular v7) while intl-messageformat depends on TypeScript v4. Maybe this is the reason why I got the error Nevertheless I hope my investigations can help a litte bit. Just like @Coly010 wrote, |
@ftischler Thanks for the update, and thanks @k3nsei @Coly010 for taking part in this discussion. Closing this, I'll update the docs with a note regarding the messageformat transpiler. |
Adding an alternative messageformat transpiler based on formatjs/intlmessageformat white_check_mark Closes: jsverse#364 Signed-off-by: isc-auf <[email protected]>
After activating CSP for my app I get the following error:
Is it really necessary for transloco to use eval in production bundles? Or is there something wrong with the configuration of my app?
The text was updated successfully, but these errors were encountered: