Search code examples
c#v8clearscript

How can I run untrusted javascript in clearscript?


I'm looking at Clearscript for running my javascript code in my c# program.

I intend to use its V8 implementation, as implementing my own build of V8 is not possible right now (MSVC build is broken, hope they'll fix it soon).

The question is: can I run untrusted javascript code through clearscript, without exposing anything that could put the executing machine to risk?

I need to expose to the running javascript only very specific functions written by me as the code comes from untrusted sources, and could contain malevolent code.


Solution

  • The documentation at https://github.com/microsoft/ClearScript looks like scripts only have access to objects/functions you expose to them, so it seems that the answer to your question would be "yes". If reading that documentation doesn't give you this impression, then you should ask the ClearScript folks for clarification.