Replacement for rexec/Bastion?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Colin Coghill (SFive)

    Replacement for rexec/Bastion?


    Hi, a year or so back some students of mine and I wrote some software
    which made use of the rexec module to run untrusted user code relatively
    safely. (We were creating a prototype of a mobile-code style app)

    I'm now working on another project which will need to be able to
    do something similar, and I noticed that rexec and Bastion have been
    withdrawn for (in)security reasons.

    I've searched fairly hard, and have been unable to find any replacement,
    but notice that the source still seems to have some form of restricted
    environment available (involving __builtins__ manipulation), but I can't
    find any documentation or discussion of this.

    Is Python (preferably CPython 2.3) still able to "sandbox" bits of code
    under an application provided API safely?

    Even Jython or Stackless would be ok, I suppose.

    I'd like to be able to have (possibly malicious) users of my software able
    to script behavior using small snippets of python code. Anything from a line
    to maybe a few pages in length each. I can trap endless loops and the like,
    but I need something to stop them just importing sys and raising havoc.

    - Colin
  • Michael Hudson

    #2
    Re: Replacement for rexec/Bastion?

    "Colin Coghill (SFive)" <mugginsm@und er-the-fridge.com> writes:

    [snippety]
    [color=blue]
    > I'd like to be able to have (possibly malicious) users of my software able
    > to script behavior using small snippets of python code. Anything from a line
    > to maybe a few pages in length each. I can trap endless loops and the like,
    > but I need something to stop them just importing sys and raising havoc.[/color]

    Zope's RestrictedPytho n might be an option.

    Cheers,
    mwh

    --
    how am I expected to quit smoking if I have to deal with NT
    every day -- Ben Raia

    Comment

    • Christian Tismer

      #3
      Re: Replacement for rexec/Bastion?

      Colin Coghill (SFive) wrote:

      ....
      [color=blue]
      > Is Python (preferably CPython 2.3) still able to "sandbox" bits of code
      > under an application provided API safely?
      >
      > Even Jython or Stackless would be ok, I suppose.[/color]

      I really love to see Stackless mentioned, but I don't
      see how this is related?
      Stackless, due to its ability to pickle and transfer
      executable code, is much more "dangerous" than regular
      Python, if used in the correct "wrong" mode.

      ciao - chris

      --
      Christian Tismer :^) <mailto:tismer@ tismer.com>
      Mission Impossible 5oftware : Have a break! Take a ride on Python's
      Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
      14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
      work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776
      PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today? http://www.stackless.com/



      Comment

      Working...