From: Dave Burt Date: 2005-01-27T23:05:54+09:00 Subject: Re: When little languages grow... "ts" wrote: > Well, a better example is > > uln% cat b.rb > #!/usr/local/bin/ruby > source = < a = Object.new > class << a > def to_s > puts "hello :-)" > super > end > end > a > EOT > > puts Thread.new { $SAFE = 4; eval source }.value > uln% > > uln% b.rb > hello :-) > # > uln% > > > i.e. you *MUST* validate the object with $SAFE = 4 and never trust it. Like this? Thread.new { $SAFE = 4; puts eval(source) } Or like this? puts Thread.new { $SAFE = 4; String.new(eval(source).to_s) }.value Both of these generate the SecurityError that your example above bypasses by running at $SAFE=0. Dave