Skip to content

Commit eb098b3

Browse files
committed
Try reenabling all specs on macOS in GitHub Actions
* The main cause of timeouts seems compile_extension() being too slow on macOS GitHub Actions.
1 parent f02df6b commit eb098b3

File tree

5 files changed

+91
-101
lines changed

5 files changed

+91
-101
lines changed

security/cve_2019_8321_spec.rb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
require_relative '../spec_helper'
22

3-
guard_not -> { platform_is :darwin and ENV['GITHUB_ACTIONS'] } do # frequent timeout/hang on macOS in GitHub Actions
4-
require 'rubygems'
5-
require 'rubygems/user_interaction'
3+
require 'rubygems'
4+
require 'rubygems/user_interaction'
65

7-
describe "CVE-2019-8321 is resisted by" do
8-
it "sanitising verbose messages" do
9-
ui = Class.new {
10-
include Gem::UserInteraction
11-
}.new
12-
ui.should_receive(:say).with(".]2;nyan.")
13-
verbose_before = Gem.configuration.verbose
14-
begin
15-
Gem.configuration.verbose = :really_verbose
16-
ui.verbose("\e]2;nyan\a")
17-
ensure
18-
Gem.configuration.verbose = verbose_before
19-
end
6+
describe "CVE-2019-8321 is resisted by" do
7+
it "sanitising verbose messages" do
8+
ui = Class.new {
9+
include Gem::UserInteraction
10+
}.new
11+
ui.should_receive(:say).with(".]2;nyan.")
12+
verbose_before = Gem.configuration.verbose
13+
begin
14+
Gem.configuration.verbose = :really_verbose
15+
ui.verbose("\e]2;nyan\a")
16+
ensure
17+
Gem.configuration.verbose = verbose_before
2018
end
2119
end
2220
end

security/cve_2019_8322_spec.rb

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
require_relative '../spec_helper'
22

3-
guard_not -> { platform_is :darwin and ENV['GITHUB_ACTIONS'] } do # frequent timeout/hang on macOS in GitHub Actions
4-
require 'yaml'
5-
require 'rubygems'
6-
require 'rubygems/safe_yaml'
7-
require 'rubygems/commands/owner_command'
3+
require 'yaml'
4+
require 'rubygems'
5+
require 'rubygems/safe_yaml'
6+
require 'rubygems/commands/owner_command'
87

9-
describe "CVE-2019-8322 is resisted by" do
10-
it "sanitising owner names" do
11-
command = Gem::Commands::OwnerCommand.new
12-
def command.rubygems_api_request(*args)
13-
Struct.new(:body).new("---\n- email: \"\e]2;nyan\a\"\n handle: handle\n id: id\n")
14-
end
15-
def command.with_response(response)
16-
yield response
17-
end
18-
command.should_receive(:say).with("Owners for gem: name")
19-
command.should_receive(:say).with("- .]2;nyan.")
20-
command.show_owners "name"
8+
describe "CVE-2019-8322 is resisted by" do
9+
it "sanitising owner names" do
10+
command = Gem::Commands::OwnerCommand.new
11+
def command.rubygems_api_request(*args)
12+
Struct.new(:body).new("---\n- email: \"\e]2;nyan\a\"\n handle: handle\n id: id\n")
2113
end
14+
def command.with_response(response)
15+
yield response
16+
end
17+
command.should_receive(:say).with("Owners for gem: name")
18+
command.should_receive(:say).with("- .]2;nyan.")
19+
command.show_owners "name"
2220
end
2321
end

security/cve_2019_8323_spec.rb

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
11
require_relative '../spec_helper'
22

3-
guard_not -> { platform_is :darwin and ENV['GITHUB_ACTIONS'] } do # frequent timeout/hang on macOS in GitHub Actions
4-
require 'optparse'
3+
require 'optparse'
54

6-
require 'rubygems'
7-
require 'rubygems/gemcutter_utilities'
5+
require 'rubygems'
6+
require 'rubygems/gemcutter_utilities'
87

9-
describe "CVE-2019-8323 is resisted by" do
10-
describe "sanitising the body" do
11-
it "for success codes" do
12-
cutter = Class.new {
13-
include Gem::GemcutterUtilities
14-
}.new
15-
response = Net::HTTPSuccess.new(nil, nil, nil)
16-
def response.body
17-
"\e]2;nyan\a"
18-
end
19-
cutter.should_receive(:say).with(".]2;nyan.")
20-
cutter.with_response response
8+
describe "CVE-2019-8323 is resisted by" do
9+
describe "sanitising the body" do
10+
it "for success codes" do
11+
cutter = Class.new {
12+
include Gem::GemcutterUtilities
13+
}.new
14+
response = Net::HTTPSuccess.new(nil, nil, nil)
15+
def response.body
16+
"\e]2;nyan\a"
2117
end
18+
cutter.should_receive(:say).with(".]2;nyan.")
19+
cutter.with_response response
20+
end
2221

23-
it "for error codes" do
24-
cutter = Class.new {
25-
include Gem::GemcutterUtilities
26-
}.new
27-
def cutter.terminate_interaction(n)
28-
end
29-
response = Net::HTTPNotFound.new(nil, nil, nil)
30-
def response.body
31-
"\e]2;nyan\a"
32-
end
33-
cutter.should_receive(:say).with(".]2;nyan.")
34-
cutter.with_response response
22+
it "for error codes" do
23+
cutter = Class.new {
24+
include Gem::GemcutterUtilities
25+
}.new
26+
def cutter.terminate_interaction(n)
27+
end
28+
response = Net::HTTPNotFound.new(nil, nil, nil)
29+
def response.body
30+
"\e]2;nyan\a"
3531
end
32+
cutter.should_receive(:say).with(".]2;nyan.")
33+
cutter.with_response response
3634
end
3735
end
3836
end

security/cve_2019_8325_spec.rb

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
11
require_relative '../spec_helper'
22

3-
guard_not -> { platform_is :darwin and ENV['GITHUB_ACTIONS'] } do # frequent timeout/hang on macOS in GitHub Actions
4-
require 'rubygems'
5-
require 'rubygems/command_manager'
3+
require 'rubygems'
4+
require 'rubygems/command_manager'
65

7-
describe "CVE-2019-8325 is resisted by" do
8-
describe "sanitising error message components" do
9-
it "for the 'while executing' message" do
10-
manager = Gem::CommandManager.new
11-
def manager.process_args(args, build_args)
12-
raise StandardError, "\e]2;nyan\a"
13-
end
14-
def manager.terminate_interaction(n)
15-
end
16-
manager.should_receive(:alert_error).with("While executing gem ... (StandardError)\n .]2;nyan.")
17-
manager.run nil, nil
6+
describe "CVE-2019-8325 is resisted by" do
7+
describe "sanitising error message components" do
8+
it "for the 'while executing' message" do
9+
manager = Gem::CommandManager.new
10+
def manager.process_args(args, build_args)
11+
raise StandardError, "\e]2;nyan\a"
1812
end
13+
def manager.terminate_interaction(n)
14+
end
15+
manager.should_receive(:alert_error).with("While executing gem ... (StandardError)\n .]2;nyan.")
16+
manager.run nil, nil
17+
end
1918

20-
it "for the 'invalid option' message" do
21-
manager = Gem::CommandManager.new
22-
def manager.terminate_interaction(n)
23-
end
24-
manager.should_receive(:alert_error).with("Invalid option: --.]2;nyan.. See 'gem --help'.")
25-
manager.process_args ["--\e]2;nyan\a"], nil
19+
it "for the 'invalid option' message" do
20+
manager = Gem::CommandManager.new
21+
def manager.terminate_interaction(n)
2622
end
23+
manager.should_receive(:alert_error).with("Invalid option: --.]2;nyan.. See 'gem --help'.")
24+
manager.process_args ["--\e]2;nyan\a"], nil
25+
end
2726

28-
it "for the 'loading command' message" do
29-
manager = Gem::CommandManager.new
30-
def manager.require(x)
31-
raise 'foo'
32-
end
33-
manager.should_receive(:alert_error).with("Loading command: .]2;nyan. (RuntimeError)\n\tfoo")
34-
manager.send :load_and_instantiate, "\e]2;nyan\a"
27+
it "for the 'loading command' message" do
28+
manager = Gem::CommandManager.new
29+
def manager.require(x)
30+
raise 'foo'
3531
end
32+
manager.should_receive(:alert_error).with("Loading command: .]2;nyan. (RuntimeError)\n\tfoo")
33+
manager.send :load_and_instantiate, "\e]2;nyan\a"
3634
end
3735
end
3836
end

security/cve_2020_10663_spec.rb

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,19 @@ def to_json(*args)
2222
JSON.const_defined?(:Pure) or
2323
version_is(JSON::VERSION, '2.3.0')
2424
} do
25-
guard_not -> { platform_is :darwin and ENV['GITHUB_ACTIONS'] } do # frequent timeout/hang on macOS in GitHub Actions
26-
describe "CVE-2020-10663 is resisted by" do
27-
it "only creating custom objects if passed create_additions: true or using JSON.load" do
28-
obj = JSONSpecs::MyClass.new("bar")
29-
JSONSpecs::MyClass.should.json_creatable?
30-
json = JSON.dump(obj)
25+
describe "CVE-2020-10663 is resisted by" do
26+
it "only creating custom objects if passed create_additions: true or using JSON.load" do
27+
obj = JSONSpecs::MyClass.new("bar")
28+
JSONSpecs::MyClass.should.json_creatable?
29+
json = JSON.dump(obj)
3130

32-
JSON.parse(json, create_additions: true).class.should == JSONSpecs::MyClass
33-
JSON(json, create_additions: true).class.should == JSONSpecs::MyClass
34-
JSON.load(json).class.should == JSONSpecs::MyClass
31+
JSON.parse(json, create_additions: true).class.should == JSONSpecs::MyClass
32+
JSON(json, create_additions: true).class.should == JSONSpecs::MyClass
33+
JSON.load(json).class.should == JSONSpecs::MyClass
3534

36-
JSON.parse(json).class.should == Hash
37-
JSON.parse(json, nil).class.should == Hash
38-
JSON(json).class.should == Hash
39-
end
35+
JSON.parse(json).class.should == Hash
36+
JSON.parse(json, nil).class.should == Hash
37+
JSON(json).class.should == Hash
4038
end
4139
end
4240
end

0 commit comments

Comments
 (0)