workings of the freaky freaky sandbox

N

Nick Grandy

hi all,

a couple questions directed towards a greater understanding of the
workings of the freaky freaky sandbox
(http://code.whytheluckystiff.net/sandbox/), which i hope might be
addressed by _why or others familiar with such things.

let's say i have a class that is referenced from inside the sandbox, eg:

ffbox = Sandbox.safe
ffbox.ref MyClass
ffbox.ref OtherClass
ffbox.eval "m = OtherClass.get_myclass"

where get_myclass returns an instance of MyClass. in my understanding,
and according to the specs posted here,
(http://www.ruby-forum.com/topic/150864) the variable m will be an
instance inside the sandbox of a Sandbox::Ref. however, in practice
it seems as though m is an instance of MyClass that is being
marshalled to get it into the sandbox. what exactly is going on here?

a secondary question: while the instance is being marshalled and
unmarshalled, i get a "dump format error (user class)", which
apparently derives from marshal.c in the ruby source code. when i
dump and load MyClass without a sandbox involved, it works fine. so,
any thoughts on what is causing the marshalling error in the sandbox
context? is it possible that the BoxedClass class is confusing
things?

i acknowledge that i have delved only briefly into the sandbox source
code. my apologies if my questions are ill-informed.

thanks,
nick
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top