I have a project where I have to execute potentially unsafe code and I thought about using
eval and it does work because most of the use cases imply having code written by oneself or other team members (so the code is trusted most of the use cases). But I want to expand it to other use cases and want to make the code safe.
I want to execute very simple code, things like
if-else, math operations, loops, and such. I don't really need classes or fancy stuff. I want all I/O interfaces to be blocked, and no cookies, indexedDB, etc.
I know there are a few interpreters for some languages only, such as Opal for Ruby, but another requirement is that I need to set a timeout time so that code that stalls is forcefully exited.
Will ruin it.
Thanks in advance.