rexec

Is there an alternative to rexec for Python sandboxing?

回眸只為那壹抹淺笑 提交于 2019-11-30 20:54:58
Implementing a 'sandbox' environment in Python used to be done with the rexec module ( http://docs.python.org/library/rexec.html ). Unfortunately, it has been deprecated/removed due to some security vulnerabilities. Is there an alternative? My goal is to have Python code execute semi-trusted Python scripts. In a perfect world, calls to any functions outside of a pre-defined set would raise exceptions. From what I've read about rexec's deprecation, this may not be possible. So I'll settle for as much as I can get. I can spawn a separate process to run the scripts, which helps a lot. But they

Is there an alternative to rexec for Python sandboxing?

删除回忆录丶 提交于 2019-11-30 04:42:49
问题 Implementing a 'sandbox' environment in Python used to be done with the rexec module (http://docs.python.org/library/rexec.html). Unfortunately, it has been deprecated/removed due to some security vulnerabilities. Is there an alternative? My goal is to have Python code execute semi-trusted Python scripts. In a perfect world, calls to any functions outside of a pre-defined set would raise exceptions. From what I've read about rexec's deprecation, this may not be possible. So I'll settle for as