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:
Hiroshi SHIBATA 2025-03-28 12:02:59 +09:00
parent 09b9468873
commit 2ba37d24e8
Notes: git 2025-03-28 03:45:10 +00:00

View File

@ -1,7 +1,9 @@
require_relative '../spec_helper'
require 'json'
module JSONSpecs
ruby_version_is ""..."3.5" do
require 'json'
module JSONSpecs
class MyClass
def initialize(foo)
@foo = foo
@ -15,12 +17,12 @@ module JSONSpecs
{ 'json_class' => self.class.name, 'args' => [ @foo ] }.to_json(*args)
end
end
end
end
guard -> {
guard -> {
JSON.const_defined?(:Pure) or
version_is(JSON::VERSION, '2.3.0')
} do
} do
describe "CVE-2020-10663 is resisted by" do
it "only creating custom objects if passed create_additions: true or using JSON.load" do
obj = JSONSpecs::MyClass.new("bar")
@ -43,4 +45,5 @@ guard -> {
JSON(json).class.should == Hash
end
end
end
end