Eric H. wrote:
$SAFE is switched when you assign to it, never at any other time.
Is it so? Consider the following code:
puts RUBY_VERSION, RUBY_PLATFORM
class Test
def show_safe
puts $SAFE
end
end
Test.new.show_safe
Test.new.method(:show_safe).taint.call
It produces:
:!ruby safe.rb
1.8.4
i686-linux
0
safe.rb:5:in write': Insecure operation
write’ at level 4
(SecurityError)
from safe.rb:5:in `show_safe’
from safe.rb:12
You have code like $SAFE = 4 in your program somwhere. Use grep to
find it.
Not necessarily. See above.
Typically $SAFE = 4 is only set in a spawned thread since its so
strict its rarely useful outside of sandboxing dangerous code.
Gennady.