Executing untrusted scripts in a sandboxed environment

Discussion in 'Python' started by Robin Krahl, Oct 5, 2012.

  1. Robin Krahl

    Robin Krahl Guest

    Hi all,

    I need to execute untrusted scripts in my Python application. To avoid security issues, I want to use a sandboxed environment. This means that the script authors have no access to the file system. They may only access objects, modules and classes that are "flagged" or "approved" for scripting.

    I read that I will not be able to do this with Python scripts. (See SandboxedPython page in the Python wiki [0] and several SE.com questions, e. g. [1].) So my question is: What is the best way to "embed" a script engine in a sandboxed environment that has access to the Python modules and classes that I provide?

    Thanks for your help.

    Best regards,
    Robin

    [0] http://wiki.python.org/moin/SandboxedPython
    [1] http://stackoverflow.com/questions/3068139/how-can-i-sandbox-python-in-pure-python
    Robin Krahl, Oct 5, 2012
    #1
    1. Advertising

  2. On Saturday, 6 October 2012 04:00:08 UTC+5:30, Robin Krahl wrote:
    > Hi all,
    >
    > I need to execute untrusted scripts in my Python application. To avoid security issues, I want to use a sandboxed environment. This means that the script authors have no access to the file system. They may only access objects, modules and classes that are "flagged" or "approved" for scripting.
    >
    > I read that I will not be able to do this with Python scripts. (See SandboxedPython page in the Python wiki [0] and several SE.com questions, e. g. [1].) So my question is: What is the best way to "embed" a script engine ina sandboxed environment that has access to the Python modules and classes that I provide?
    >
    > Thanks for your help.
    >
    > Best regards,
    > Robin
    >
    > [0] http://wiki.python.org/moin/SandboxedPython
    > [1] http://stackoverflow.com/questions/3068139/how-can-i-sandbox-python-in-pure-python

    From http://wiki.python.org/moin/SandboxedPython
    "The Java and CLR/.NET runtimes support restricted execution, and these canbe utilised through the Jython and IronPython variants of Python (as well as by other languages, obviously)."
    You can also check out http://doc.pypy.org/en/latest/sandbox.html for PyPy's sandbox
    Ramchandra Apte, Oct 6, 2012
    #2
    1. Advertising

  3. On Saturday, 6 October 2012 04:00:08 UTC+5:30, Robin Krahl wrote:
    > Hi all,
    >
    > I need to execute untrusted scripts in my Python application. To avoid security issues, I want to use a sandboxed environment. This means that the script authors have no access to the file system. They may only access objects, modules and classes that are "flagged" or "approved" for scripting.
    >
    > I read that I will not be able to do this with Python scripts. (See SandboxedPython page in the Python wiki [0] and several SE.com questions, e. g. [1].) So my question is: What is the best way to "embed" a script engine ina sandboxed environment that has access to the Python modules and classes that I provide?
    >
    > Thanks for your help.
    >
    > Best regards,
    > Robin
    >
    > [0] http://wiki.python.org/moin/SandboxedPython
    > [1] http://stackoverflow.com/questions/3068139/how-can-i-sandbox-python-in-pure-python
    >From http://wiki.python.org/moin/SandboxedPython

    "The Java and CLR/.NET runtimes support restricted execution, and these canbe utilised through the Jython and IronPython variants of Python (as well as by other languages, obviously)."
    You can also check out http://doc.pypy.org/en/latest/sandbox.html for PyPy's sandbox
    Ramchandra Apte, Oct 6, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Emanuele D'Arrigo

    Executing untrusted code

    Emanuele D'Arrigo, Aug 7, 2009, in forum: Python
    Replies:
    6
    Views:
    325
    Emanuele D'Arrigo
    Aug 20, 2009
  2. Rohan Malhotra
    Replies:
    0
    Views:
    201
    Rohan Malhotra
    Feb 27, 2011
  3. Chris Angelico
    Replies:
    2
    Views:
    178
    Chris Angelico
    Oct 6, 2012
  4. Mark Lawrence
    Replies:
    0
    Views:
    155
    Mark Lawrence
    Oct 6, 2012
  5. Rodrick Brown
    Replies:
    0
    Views:
    159
    Rodrick Brown
    Oct 6, 2012
Loading...

Share This Page