Re: building an online judge to evaluate Python programs

Discussion in 'Python' started by Fábio Santos, Sep 23, 2013.

  1. On 20 Sep 2013 21:14, "Jabba Laci" <> wrote:
    >
    > > That last seems to me to be the biggie. Several times in the past few
    > > years, people in this mailing list have tried to build a safe sandbox.
    > > And each one was a big failure, for a hacker of sufficient interest.
    > > Some of them were spectacular failures.
    > >
    > > If you have to be safe from your user, Python may be the wrong language
    > > to give them.

    >
    > Well, the course is about Python and I want to test Python scripts...
    >
    > I've heard about "chroot jail" but I never used it. Wikipedia says:
    >
    > "A chroot on Unix operating systems is an operation that changes the
    > apparent root directory for the current running process and its
    > children. A program that is run in such a modified environment cannot
    > name (and therefore normally not access) files outside the designated
    > directory tree. The term "chroot" may refer to the chroot(2) system
    > call or the chroot(8) wrapper program. The modified environment is
    > called a "chroot jail"."
    >
    > I guess it could be used for sandboxing.
    >
    > Laszlo


    It may be a good start to whitelist the modules and builtins they are
    allowed to use.

    The ast module could be used to scan the source tree for import statements
    and run the imported modules through the whitelist.

    There should also be many ways to run a script with stripped-down builtins.

    Then you can control execution time and memory usage using an external tool.

    I'm quite sure this isn't all you need, but it can be a good place to start.
     
    Fábio Santos, Sep 23, 2013
    #1
    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. Jabba Laci
    Replies:
    9
    Views:
    189
    Dennis Lee Bieber
    Sep 22, 2013
  2. Dave Angel
    Replies:
    0
    Views:
    148
    Dave Angel
    Sep 20, 2013
  3. Jabba Laci
    Replies:
    0
    Views:
    141
    Jabba Laci
    Sep 20, 2013
  4. Terry Reedy
    Replies:
    0
    Views:
    129
    Terry Reedy
    Sep 20, 2013
  5. Modulok
    Replies:
    0
    Views:
    169
    Modulok
    Sep 21, 2013
Loading...

Share This Page