asvd / jailed

execute untrusted code with custom permissions
MIT License
1k stars 73 forks source link

Is there any way to import third party node module/lib to sandbox? #31

Open we-zhang opened 8 years ago

we-zhang commented 8 years ago

If the loaded code in sandbox requires some dependency/lib, is there any way to import the libs to sandbox for the code to use?

cristiano-belloni commented 8 years ago

What I do is loading the third party library as text (with webpack, in my case) and inject it in the wrapper code. You can't normally access the DOM or window object, though, at least in the browser, so be prepared to mock stuff :)

cristiano-belloni commented 8 years ago

And I guess this is a duplicate of https://github.com/asvd/jailed/issues/23