mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Removed trial and errors
This commit is contained in:
parent
a68205c5c1
commit
03fdf02321
1 changed files with 0 additions and 26 deletions
|
@ -9,27 +9,6 @@ describe "CVE-2018-6914 is resisted by" do
|
||||||
@dir = tmp("CVE-2018-6914")
|
@dir = tmp("CVE-2018-6914")
|
||||||
Dir.mkdir(@dir, 0700)
|
Dir.mkdir(@dir, 0700)
|
||||||
ENV['TMPDIR'] = @dir
|
ENV['TMPDIR'] = @dir
|
||||||
|
|
||||||
# Make sure that ENV["TMPDIR"] is used by Dir.tmpdir
|
|
||||||
# https://github.com/ruby/ruby/runs/294462511#step:10:134
|
|
||||||
10.times do
|
|
||||||
break if Dir.tmpdir == File.expand_path(@dir)
|
|
||||||
sleep 0.1
|
|
||||||
end
|
|
||||||
|
|
||||||
@debug_print = ->(actual) {
|
|
||||||
PP.pp({
|
|
||||||
actual: actual,
|
|
||||||
absolute: File.absolute_path(actual),
|
|
||||||
dir: @dir,
|
|
||||||
pwd: Dir.pwd,
|
|
||||||
tmpdir: @tmpdir,
|
|
||||||
Dir_tmpdir: Dir.tmpdir,
|
|
||||||
TMPDIR: ENV['TMPDIR'],
|
|
||||||
stat: File.stat(@dir),
|
|
||||||
}, STDERR)
|
|
||||||
}
|
|
||||||
|
|
||||||
@dir << '/'
|
@dir << '/'
|
||||||
|
|
||||||
@tempfile = nil
|
@tempfile = nil
|
||||||
|
@ -44,14 +23,12 @@ describe "CVE-2018-6914 is resisted by" do
|
||||||
it "Tempfile.open by deleting separators" do
|
it "Tempfile.open by deleting separators" do
|
||||||
@tempfile = Tempfile.open(['../', 'foo'])
|
@tempfile = Tempfile.open(['../', 'foo'])
|
||||||
actual = @tempfile.path
|
actual = @tempfile.path
|
||||||
@debug_print.call(actual)
|
|
||||||
File.absolute_path(actual).should.start_with?(@dir)
|
File.absolute_path(actual).should.start_with?(@dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "Tempfile.new by deleting separators" do
|
it "Tempfile.new by deleting separators" do
|
||||||
@tempfile = Tempfile.new('../foo')
|
@tempfile = Tempfile.new('../foo')
|
||||||
actual = @tempfile.path
|
actual = @tempfile.path
|
||||||
@debug_print.call(actual)
|
|
||||||
File.absolute_path(actual).should.start_with?(@dir)
|
File.absolute_path(actual).should.start_with?(@dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -59,7 +36,6 @@ describe "CVE-2018-6914 is resisted by" do
|
||||||
actual = Tempfile.create('../foo') do |t|
|
actual = Tempfile.create('../foo') do |t|
|
||||||
t.path
|
t.path
|
||||||
end
|
end
|
||||||
@debug_print.call(actual)
|
|
||||||
File.absolute_path(actual).should.start_with?(@dir)
|
File.absolute_path(actual).should.start_with?(@dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -67,7 +43,6 @@ describe "CVE-2018-6914 is resisted by" do
|
||||||
actual = Dir.mktmpdir('../foo') do |path|
|
actual = Dir.mktmpdir('../foo') do |path|
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
@debug_print.call(actual)
|
|
||||||
File.absolute_path(actual).should.start_with?(@dir)
|
File.absolute_path(actual).should.start_with?(@dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,7 +50,6 @@ describe "CVE-2018-6914 is resisted by" do
|
||||||
actual = Dir.mktmpdir(['../', 'foo']) do |path|
|
actual = Dir.mktmpdir(['../', 'foo']) do |path|
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
@debug_print.call(actual)
|
|
||||||
File.absolute_path(actual).should.start_with?(@dir)
|
File.absolute_path(actual).should.start_with?(@dir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue