hoodwink.d enhanced


FrkyFrkyBox'n ][ #

by why in inspect

Well, yeah, good progress, many adornments now line the fuzzy coat of Mr. F. F. Snadbox. We’ll draw our gaze to that plastic patch buttoned onto one of the extra buttons of his sleeve. It says extern rb_global_tbl (Audience Compulsion Favorite 2006.)

Here’s the deal: the sandbox won’t be completely safe under 1.8.4 and previous. That’s okay, you’ll still have chance to do some of the neat namespacing tricks. However, it won’t be safe for running untrusted code.

Why not? Well, the global variables will be shared between all sandboxes in 1.8.4. Also, some classes (specifically: MatchData, RegexpError and NameError::message) expose the main namespace. Matz has now given FreakyFreaky some access to swap these out for 1.8.5.

So Sandbox.new will work under both Ruby versions. But Sandbox.safe will only work under 1.8.5.

Anyway, here’s a rundown of the enhancements over the last day:

  • Sandbox imports singletons and constants for the core classes.
  • Added Regexp, Range to the core.
  • Fixed obvious problems with GC and the swapping tables. (The previous symbol table is saved in kit->banished now.)
  • Sandbox.load can be used to load files into the sandbox. (s = Sandbox.new; s.load('pascal.rb'); puts s.eval('pascal(10)'))

You know, RubyQuiz is such a great place to get test scripts for this kind of thing.

said on 20 Jul 2006 at 11:49

said on 20 Jul 2006 at 12:37

Three Cheers!

said on 20 Jul 2006 at 13:56

Cool stuff. Hopefully this makes it into the standard library. :)

said on 20 Jul 2006 at 14:39

I totaly proposed the name change… (why am I such a credit w.. hog?) This is still coolness and the namespace tricks are cool.

said on 21 Jul 2006 at 00:18

Anyone succeeded with a Windows installation?

said on 21 Jul 2006 at 00:57

Dr Nic: Mauricio has nudged me to cross-compile and I am. I was able to manufacture some Hpricot DLLs on FreeBSD today. The bigger trouble here is: you’ll need to get a binary of the latest ruby-1.8.5 (not preview1 or preview2.) Win32 is probably two months away since you’ll have to wait for 1.8.5 to be released, then for the Windows Installer to put their build out.

I might release the unsafe 1.8.4 binding, we’ll see.

said on 21 Jul 2006 at 02:10

_why: the unsafe binding would be great for dev/testing before an app is deployed to 1.8.5+safe env.

11 Jul 2010 at 21:31

* do fancy stuff in your comment.