Skip to content

Commit

Permalink
Exclude frequent timeout/hang spec on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Oct 8, 2021
1 parent 72f2cf2 commit dbbbb74
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 42 deletions.
2 changes: 0 additions & 2 deletions security/cve_2010_1330_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require_relative '../spec_helper'

describe "String#gsub" do

it "resists CVE-2010-1330 by raising an exception on invalid UTF-8 bytes" do
# This original vulnerability talked about KCODE, which is no longer
# used. Instead we are forcing encodings here. But I think the idea is the
Expand All @@ -17,5 +16,4 @@
str.gsub(/</, "&lt;")
}.should raise_error(ArgumentError, /invalid byte sequence in UTF-8/)
end

end
4 changes: 0 additions & 4 deletions security/cve_2013_4164_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
require 'json'

describe "String#to_f" do

it "resists CVE-2013-4164 by converting very long Strings to a Float" do
"1.#{'1'*1000000}".to_f.should be_close(1.1111111111111112, TOLERANCE)
end

end

describe "JSON.parse" do

it "resists CVE-2013-4164 by converting very long Strings to a Float" do
JSON.parse("[1.#{'1'*1000000}]").first.should be_close(1.1111111111111112, TOLERANCE)
end

end
1 change: 0 additions & 1 deletion security/cve_2014_8080_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require_relative '../spec_helper'


ruby_version_is ''...'3.0' do
require 'rexml/document'

Expand Down
4 changes: 0 additions & 4 deletions security/cve_2018_16396_spec.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
require_relative '../spec_helper'

describe "Array#pack" do

ruby_version_is ''...'2.7' do
it "resists CVE-2018-16396 by tainting output based on input" do
"aAZBbHhuMmPp".each_char do |f|
["123456".taint].pack(f).tainted?.should be_true
end
end
end

end

describe "String#unpack" do

ruby_version_is ''...'2.7' do
it "resists CVE-2018-16396 by tainting output based on input" do
"aAZBbHhuMm".each_char do |f|
"123456".taint.unpack(f).first.tainted?.should be_true
end
end
end

end
2 changes: 0 additions & 2 deletions security/cve_2018_8778_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
require_relative '../spec_helper'

describe "String#unpack" do

it "resists CVE-2018-8778 by raising an exception when a position indicator is larger than a native integer" do
pos = (1 << PlatformGuard::POINTER_SIZE) - 99
-> {
"0123456789".unpack("@#{pos}C10")
}.should raise_error(RangeError, /pack length too big/)
end

end
54 changes: 28 additions & 26 deletions security/cve_2019_8323_spec.rb
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
require_relative '../spec_helper'

require 'optparse'
platform_is_not :darwin do # frequent timeout/hang on macOS
require 'optparse'

require 'rubygems'
require 'rubygems/gemcutter_utilities'
require 'rubygems'
require 'rubygems/gemcutter_utilities'

describe "CVE-2019-8323 is resisted by" do
describe "sanitising the body" do
it "for success codes" do
cutter = Class.new {
include Gem::GemcutterUtilities
}.new
response = Net::HTTPSuccess.new(nil, nil, nil)
def response.body
"\e]2;nyan\a"
describe "CVE-2019-8323 is resisted by" do
describe "sanitising the body" do
it "for success codes" do
cutter = Class.new {
include Gem::GemcutterUtilities
}.new
response = Net::HTTPSuccess.new(nil, nil, nil)
def response.body
"\e]2;nyan\a"
end
cutter.should_receive(:say).with(".]2;nyan.")
cutter.with_response response
end
cutter.should_receive(:say).with(".]2;nyan.")
cutter.with_response response
end

it "for error codes" do
cutter = Class.new {
include Gem::GemcutterUtilities
}.new
def cutter.terminate_interaction(n)
end
response = Net::HTTPNotFound.new(nil, nil, nil)
def response.body
"\e]2;nyan\a"
it "for error codes" do
cutter = Class.new {
include Gem::GemcutterUtilities
}.new
def cutter.terminate_interaction(n)
end
response = Net::HTTPNotFound.new(nil, nil, nil)
def response.body
"\e]2;nyan\a"
end
cutter.should_receive(:say).with(".]2;nyan.")
cutter.with_response response
end
cutter.should_receive(:say).with(".]2;nyan.")
cutter.with_response response
end
end
end
6 changes: 3 additions & 3 deletions security/cve_2019_8325_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require_relative '../spec_helper'

require 'rubygems'
require 'rubygems/command_manager'

platform_is_not :darwin do # frequent timeout/hang on macOS
require 'rubygems'
require 'rubygems/command_manager'

describe "CVE-2019-8325 is resisted by" do
describe "sanitising error message components" do
it "for the 'while executing' message" do
Expand Down

0 comments on commit dbbbb74

Please sign in to comment.