>>>>> "P" == Peter Triller <p.triller / virtual-solution.de> writes:

P> this wasnt working. so I read around in the docu:
P> "Can't define, redefine, remove, or undef a method in a nontainted class 
P> or module."

moulon% cat b.rb
#!/usr/bin/ruby
module A
end
A.taint

$SAFE = 4

user_code = '1 + 1'

eval <<-EOT
   def A.a
      #{user_code}
   end
EOT
A.a
#
# it will give an error : unsecure write
#
p A.a
moulon% 

moulon% ./b.rb
./b.rb:19:in `write': Insecure operation `write' at level 4 (SecurityError)
	from ./b.rb:19
moulon% 


Guy Decoux