Node.js · Senior · Question 32 of 75
Why is eval (or new Function) on user input dangerous even in a 'sandbox' like vm?
- ✓Correct answer: It gives the input full code execution; the
vmmodule is explicitly not a security boundary - 2It's only slow, not dangerous
- 3
vmblocks access toprocess, so it is safe
Explanation
Escapes from vm contexts are well known. Run untrusted code in a separate process or container with strict limits, or avoid running it at all.