Skip to content
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

Replace use of eval() #9024

Closed
moxizhou opened this issue Jul 8, 2020 · 11 comments · Fixed by #11400
Closed

Replace use of eval() #9024

moxizhou opened this issue Jul 8, 2020 · 11 comments · Fixed by #11400

Comments

@moxizhou
Copy link

moxizhou commented Jul 8, 2020

We are using CSP headers and ran into an issue using this library because of the use of unsafe eval.

I am wondering if there is an alternative for this?

@moxizhou moxizhou changed the title Use of eval() Replace use of eval() Jul 8, 2020
@shunter
Copy link
Contributor

shunter commented Jul 8, 2020

This is in third-party code (requirejs) but after a quick look at the code, I'm pretty sure this code is never used in Cesium, so you could try commenting it out or removing it.

@moxizhou
Copy link
Author

moxizhou commented Jul 8, 2020

When I ran cesium, it did go through the line mentioned above, but this was a while ago. I did not know this was third-party code though, so there is no way to remove it on cesium end?

@OmarShehata
Copy link
Contributor

I don't think this is something we plan on changing at the moment, this is just part of how RequireJS works.

I would recommend adding an exception to allow this use eval when running CesiumJS.

@candrews
Copy link

candrews commented Apr 8, 2021

Is it possible that use of eval will be eliminated by #9473 ?

@mramato
Copy link
Contributor

mramato commented Apr 8, 2021

@candrews Not as a side effect. The main problem here is that (at least last time I looked) Web Workers do not support loading ES6 modules directly and you need to use an old school browser module system (like amd/requirejs) which is why this code exists. However it's probably worth looking into if that has a better alternative now. I'll add a note to the linked issue for us to take a look. Thanks for the reminder!

@alexfrigault
Copy link

Has there been any update on this issue? We are trying to use Cesium in our application but we are required to not include 'unsafe-eval' in our CSP. Simply having Cesium load in through webpack runs into this issue.

@ggetz
Copy link
Contributor

ggetz commented Feb 14, 2022

@alexfrigault No updates yet. We are potentially taking a look at eliminating requireJS and therefore eval as a part of some modernization efforts in the near future.

@superFelix5000
Copy link

@ggetz any updates on this one? :)

@ggetz
Copy link
Contributor

ggetz commented May 4, 2022

@pixelschubs Not yet. I would recommend keeping an eye on #9473. We'll post any updates there.

@boeckMt
Copy link

boeckMt commented May 3, 2023

@ggetz are there any updates on this Issue?
Issue #9473 is closed and I don't found any helpful things there.

I'm using the packages "@cesium/engine": "^2.2.0" and "@cesium/widgets": "^2.1.1"

@ggetz
Copy link
Contributor

ggetz commented May 3, 2023

Hi, the most recent blocker for replacing requireJS in our packaged web workers was that Firefox did not support ESM modules in workers. The good news is that issue was recently marked as resolved!

I'll re-open this issue to track updating our build system to remove RequireJS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: In Review
Development

Successfully merging a pull request may close this issue.

9 participants