strapyourself.in and flouri.sh

How to set up the ruby sandbox

April 4th, 2009

There's very little recent work on the MRI ruby sandbox, so here's a quick guide to getting the sandbox installed and running. Unfortunately, the sandbox requires a patched ruby, but luckily it's not that hard to set up.

  1. Download the latest version of ruby 1.8.6 from ftp://ftp.ruby-lang.org/pub/ruby/1.8 (does not work with 1.8.7 or 1.9, sorry)
  2. Download the sandbox gem source from git://github.com/why/sandbox.git
  3. Patch ruby:
    patch -p1 < ../sandbox_gem/patch/ruby-1.8.6-sandbox_needs.patch
    patching file error.c
  4. Compile and install the patched ruby:
    ./configure
    make
    sudo make install
  5. Download and install rubygems from RubyForge
  6. Install the sandbox gem:
    cd sandbox_gem && sudo ruby setup.rb
  7. Test the sandbox:
    require "sandbox"
    Sandbox.safe.eval("2+2")
    # yields 4
    

Now that you've got the sandbox running, read more about it in my article on Advanced Sandboxing, or my Sandbox Introduction.

1 Response to “How to set up the ruby sandbox”

  1. Ryan Garver Says:
    David, are you planning on getting this project up and live again? I'm interested in seeing it running some more modern versions of the MRI.

Sorry, comments are closed for this article.

original design by gorotron ported by railsgrunt powered by mephisto