2019-03-28 10:22:29 -04:00
|
|
|
require_relative '../spec_helper'
|
|
|
|
|
2022-04-25 08:53:54 -04:00
|
|
|
require 'optparse'
|
2019-03-28 10:22:29 -04:00
|
|
|
|
2022-04-25 08:53:54 -04:00
|
|
|
require 'rubygems'
|
|
|
|
require 'rubygems/gemcutter_utilities'
|
2019-03-28 10:22:29 -04:00
|
|
|
|
2022-04-25 08:53:54 -04:00
|
|
|
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"
|
2019-03-28 10:22:29 -04:00
|
|
|
end
|
2022-04-25 08:53:54 -04:00
|
|
|
cutter.should_receive(:say).with(".]2;nyan.")
|
|
|
|
cutter.with_response response
|
|
|
|
end
|
2019-03-28 10:22:29 -04:00
|
|
|
|
2022-04-25 08:53:54 -04:00
|
|
|
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"
|
2019-03-28 10:22:29 -04:00
|
|
|
end
|
2022-04-25 08:53:54 -04:00
|
|
|
cutter.should_receive(:say).with(".]2;nyan.")
|
|
|
|
cutter.with_response response
|
2019-03-28 10:22:29 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|