Project

General

Profile

Backport #7325 ยป taint.rb

urielka (Uriel Katz), 11/10/2012 10:00 PM

 
1
class MyObject
2
 def test
3
  $SAFE
4
 end
5
end
6
puts "Before marshal is tainted?: #{MyObject.new.method(:test).tainted?}"
7
File.write("/tmp/marshal_bug",Marshal.dump(MyObject))
8
Marshal.load(File.open("/tmp/marshal_bug"))
9
puts "After marshal is tainted?: #{MyObject.new.method(:test).tainted?}"
10

    
11
puts "Safe level when calling tainted method using call: #{MyObject.new.method(:test).call}"
12
puts "Safe level when calling tainted method directly: #{MyObject.new.test}"