5

I'll preface this by saying I am quite new to PyPy, though fairly experienced with Python.

I'm looking to run a web app where I run untrusted Python code. The PyPy sandboxing features look ideal for what I'm doing.

The PyPy docs on sandboxing indicate that you can call a PyPy sandbox from either Python or PyPy. This seems to imply that there's some separate program or executable that is the sandbox.

I'm wondering, is it possible to call a PyPy sandbox from a non-Python language? I'm looking at Haskell in particular, but it's also very possible that I could use C or C++ as an intermediate.

jmite
  • 8,171
  • 6
  • 40
  • 81

2 Answers2

2

Yes, that's possible. The PyPy sandbox is a separate process communicating only via stdin/stdout. If you want to rewrite the "external" part, you can; it's not using anything that should be too heavily Python-related.

Armin Rigo
  • 12,048
  • 37
  • 48
  • Would you be able to give an example of how to do this in some language? Is `pypy-c-sandbox` just an executable? – jmite Mar 16 '14 at 19:08
  • 1
    Yes, pypy-c-sandbox is just an executable. The example of how to do that is https://bitbucket.org/pypy/pypy/raw/default/pypy/sandbox/pypy_interact.py and the sandlib and vfs modules it depends on. – Armin Rigo Mar 17 '14 at 20:45
0

Note that the sandboxing feature of PyPy is not being maintained any more, see http://www.pypy.org/features.html#sandboxing

mattip
  • 2,360
  • 1
  • 13
  • 13