diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-09-24 20:59:12 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-11-18 01:00:25 +0200 |
commit | ffd0820ab317542f8780aac475da590a4bdbc7a8 (patch) | |
tree | 6a5d774933c15fd2b9ea948bd3ae2fa587faaf82 /test/ruby/test_marshal.rb | |
parent | c5c05460ac20abcbc0ed686eb4acf06da7a39a79 (diff) | |
download | ruby-ffd0820ab317542f8780aac475da590a4bdbc7a8.tar.gz |
Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards. This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
Diffstat (limited to 'test/ruby/test_marshal.rb')
-rw-r--r-- | test/ruby/test_marshal.rb | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index f6d84d181a..f300710d2c 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -189,57 +189,6 @@ class TestMarshal < Test::Unit::TestCase end end - def test_taint - x = Object.new - x.taint - s = Marshal.dump(x) - assert_equal(true, s.tainted?) - y = Marshal.load(s) - assert_equal(true, y.tainted?) - end - - def test_taint_each_object - x = Object.new - obj = [[x]] - - # clean object causes crean stream - assert_equal(false, obj.tainted?) - assert_equal(false, obj.first.tainted?) - assert_equal(false, obj.first.first.tainted?) - s = Marshal.dump(obj) - assert_equal(false, s.tainted?) - - # tainted object causes tainted stream - x.taint - assert_equal(false, obj.tainted?) - assert_equal(false, obj.first.tainted?) - assert_equal(true, obj.first.first.tainted?) - t = Marshal.dump(obj) - assert_equal(true, t.tainted?) - - # clean stream causes clean objects - assert_equal(false, s.tainted?) - y = Marshal.load(s) - assert_equal(false, y.tainted?) - assert_equal(false, y.first.tainted?) - assert_equal(false, y.first.first.tainted?) - - # tainted stream causes tainted objects - assert_equal(true, t.tainted?) - y = Marshal.load(t) - assert_equal(true, y.tainted?) - assert_equal(true, y.first.tainted?) - assert_equal(true, y.first.first.tainted?) - - # same tests by different senario - s.taint - assert_equal(true, s.tainted?) - y = Marshal.load(s) - assert_equal(true, y.tainted?) - assert_equal(true, y.first.tainted?) - assert_equal(true, y.first.first.tainted?) - end - def test_symbol2 [:ruby, :"\u{7d05}\u{7389}"].each do |sym| assert_equal(sym, Marshal.load(Marshal.dump(sym)), '[ruby-core:24788]') @@ -499,16 +448,6 @@ class TestMarshal < Test::Unit::TestCase module TestModule end - def test_marshal_load_should_not_taint_classes - bug7325 = '[ruby-core:49198]' - for c in [TestClass, TestModule] - assert_not_predicate(c, :tainted?) - c2 = Marshal.load(Marshal.dump(c).taint) - assert_same(c, c2) - assert_not_predicate(c, :tainted?, bug7325) - end - end - class Bug7627 < Struct.new(:bar) attr_accessor :foo @@ -620,15 +559,6 @@ class TestMarshal < Test::Unit::TestCase assert_equal(Marshal.dump(bare), Marshal.dump(packed)) end - def test_untainted_numeric - bug8945 = '[ruby-core:57346] [Bug #8945] Numerics never be tainted' - b = RbConfig::LIMITS['FIXNUM_MAX'] + 1 - tainted = [0, 1.0, 1.72723e-77, b].select do |x| - Marshal.load(Marshal.dump(x).taint).tainted? - end - assert_empty(tainted.map {|x| [x, x.class]}, bug8945) - end - class Bug9523 attr_reader :cc def marshal_dump |