Restricting Python's syntax to execute user code safely. Is this a safe approach?

后端 未结 3 711
鱼传尺愫
鱼传尺愫 2020-12-14 04:00

Original question:

Executing mathematical user code on a python web server, what is the simplest secure way?

  • I want to be able to run user submitted co
3条回答
  •  抹茶落季
    2020-12-14 04:35

    The Openerp's source code contains a safe_eval.py that do a similar thing. But Instead of checking the ast of the source, it restrict the byte code that is allowed to execute. I think you may also have a look on it :)

提交回复
热议问题