擅长:python、mysql、java
<p>我不会使用任何python沙盒方法在您的机器上执行任意代码,因为安全专业人员已经多次演示了它们是如何逃逸的。
<a href="http://www.slideshare.net/tzanany/escaping-the-python-sandbox" rel="nofollow noreferrer">Escaping the python sandbox</a></p>
<p>我建议在docker容器中运行代码,让新用户具有受限权限。在</p>
<p><a href="https://gist.github.com/FrankSpierings/5c79523ba693aaa38bc963083f48456c" rel="nofollow noreferrer">Hardening Linux Containers</a></p>
<p>最后,您可以尝试将python代码解析为AST,并深入到各个级别,以确保不存在危险的操作。在</p>
<p>我的选择是使用docker容器,最好是限制访问的Alpine版本。在</p>