简体   繁体   English

如何使用 VM 在 nodejs 中安全地运行用户代码而不会受到攻击

[英]How can I run user code securely in nodejs using VM without being vulnerable to attacks

I'm making a nodejs project, and I want to be able to run user code safely using the vm module, but there's many vulnerabilities such as the constructor of every object/function to be used to eval js string.我正在制作一个 nodejs 项目,我希望能够使用vm模块安全地运行用户代码,但是存在许多漏洞,例如每个对象/函数的constructor函数都用于评估 js 字符串。 any way to secure it?有什么方法可以保护它吗? Thanks!谢谢!

I tried everything, but nothing works.我尝试了一切,但没有任何效果。 I also don't want to use other packages.我也不想使用其他包。 Thanks.谢谢。

There doesn't seem to be any built-in method to run untrusted code safely.似乎没有任何内置方法可以安全地运行不受信任的代码。 I suppose if you could work with external libraries, there are a few solutions dedicated to this purpose like isolated-vm and vm2 .我想如果您可以使用外部库,那么有一些专门用于此目的的解决方案,例如isolated-vmvm2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 此代码是否容易受到XSS攻击? - Is this code vulnerable to XSS attacks? 如何在共享服务器上安全地存储用户名和密码? - How can I store user name and password securely on a shared server? NodeJS:如何在不使用require的情况下包含一些javascript代码段? - NodeJS: How can I include some javascript code snippet without using require? 如何正确使用 UNNEST 而不会受到 sql 注入的影响 - How to properly use UNNEST without being vulnerable to sql injections 是否可以在不使用AJAX的情况下以Javascript运行PHP代码? - Can I run PHP code in Javascript without using AJAX? 是否有一个 javaScript 引擎,我可以在其中运行我的代码而不必被迫使用浏览器? - Is there a javaScript engine where I can run my code without being forced to use a browser? Javascript如何安全地访问用户信息? - How can Javascript securely access user info? Firebase 身份验证如何仅使用客户端代码安全地对用户进行身份验证? - How can Firebase Authentication securely authenticate a user with only client-side code? 如何运行用户输入 Ace 编辑器的代码 - How can I run the code the user enters into the Ace Editor 如何在没有 Web 服务器的情况下运行 ajax 代码? - How can I run ajax code without web server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM