spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ...3.5' spec/ruby/security/cve_2020_10663_spec.rb
This commit is contained in:
parent
09b9468873
commit
2ba37d24e8
Notes:
git
2025-03-28 03:45:10 +00:00
@ -1,7 +1,9 @@
|
|||||||
require_relative '../spec_helper'
|
require_relative '../spec_helper'
|
||||||
require 'json'
|
|
||||||
|
|
||||||
module JSONSpecs
|
ruby_version_is ""..."3.5" do
|
||||||
|
require 'json'
|
||||||
|
|
||||||
|
module JSONSpecs
|
||||||
class MyClass
|
class MyClass
|
||||||
def initialize(foo)
|
def initialize(foo)
|
||||||
@foo = foo
|
@foo = foo
|
||||||
@ -15,12 +17,12 @@ module JSONSpecs
|
|||||||
{ 'json_class' => self.class.name, 'args' => [ @foo ] }.to_json(*args)
|
{ 'json_class' => self.class.name, 'args' => [ @foo ] }.to_json(*args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
guard -> {
|
guard -> {
|
||||||
JSON.const_defined?(:Pure) or
|
JSON.const_defined?(:Pure) or
|
||||||
version_is(JSON::VERSION, '2.3.0')
|
version_is(JSON::VERSION, '2.3.0')
|
||||||
} do
|
} do
|
||||||
describe "CVE-2020-10663 is resisted by" do
|
describe "CVE-2020-10663 is resisted by" do
|
||||||
it "only creating custom objects if passed create_additions: true or using JSON.load" do
|
it "only creating custom objects if passed create_additions: true or using JSON.load" do
|
||||||
obj = JSONSpecs::MyClass.new("bar")
|
obj = JSONSpecs::MyClass.new("bar")
|
||||||
@ -43,4 +45,5 @@ guard -> {
|
|||||||
JSON(json).class.should == Hash
|
JSON(json).class.should == Hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user