rubyzip 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubyzip might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/lib/zip/entry.rb +10 -9
- data/lib/zip/extra_field.rb +1 -1
- data/lib/zip/inflater.rb +1 -1
- data/lib/zip/version.rb +1 -1
- data/test/data/path_traversal/tilde.zip +0 -0
- data/test/path_traversal_test.rb +7 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5bed33b4d4b864f1ad4d1a3483022c13b8079a607b2e4afc5b3828b9267f04c8
|
4
|
+
data.tar.gz: 0acb47d50691a266b1abc45e9b9c2abe5ac2310f38706ef5905bf53723e1f26d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64da2a44d5a0b167ad81023554552f7cf101a6e5eb380ef356abaeb3c97d40e6dc6a5013b3fbfa615823833106bb31c8766e38b81d378b685a4eb680f5cc4ab5
|
7
|
+
data.tar.gz: 7f8157731ecfbb4497e97dcaff38bb6f259c5b18f070e04d5706170a999c7e0d41a32487fbf0e297836f60669f6d0a3e0cbbead7f5c2a06b56f651285786163e
|
data/lib/zip/entry.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'pathname'
|
1
2
|
module Zip
|
2
3
|
class Entry
|
3
4
|
STORED = 0
|
@@ -117,7 +118,7 @@ module Zip
|
|
117
118
|
return false unless cleanpath.relative?
|
118
119
|
root = ::File::SEPARATOR
|
119
120
|
naive_expanded_path = ::File.join(root, cleanpath.to_s)
|
120
|
-
|
121
|
+
::File.absolute_path(cleanpath.to_s, root) == naive_expanded_path
|
121
122
|
end
|
122
123
|
|
123
124
|
def local_entry_offset #:nodoc:all
|
@@ -275,10 +276,10 @@ module Zip
|
|
275
276
|
zip64 = @extra['Zip64']
|
276
277
|
[::Zip::LOCAL_ENTRY_SIGNATURE,
|
277
278
|
@version_needed_to_extract, # version needed to extract
|
278
|
-
@gp_flags, # @gp_flags
|
279
|
+
@gp_flags, # @gp_flags
|
279
280
|
@compression_method,
|
280
|
-
@time.to_binary_dos_time, # @last_mod_time
|
281
|
-
@time.to_binary_dos_date, # @last_mod_date
|
281
|
+
@time.to_binary_dos_time, # @last_mod_time
|
282
|
+
@time.to_binary_dos_date, # @last_mod_date
|
282
283
|
@crc,
|
283
284
|
zip64 && zip64.compressed_size ? 0xFFFFFFFF : @compressed_size,
|
284
285
|
zip64 && zip64.original_size ? 0xFFFFFFFF : @size,
|
@@ -432,11 +433,11 @@ module Zip
|
|
432
433
|
@header_signature,
|
433
434
|
@version, # version of encoding software
|
434
435
|
@fstype, # filesystem type
|
435
|
-
@version_needed_to_extract, # @versionNeededToExtract
|
436
|
-
@gp_flags, # @gp_flags
|
436
|
+
@version_needed_to_extract, # @versionNeededToExtract
|
437
|
+
@gp_flags, # @gp_flags
|
437
438
|
@compression_method,
|
438
|
-
@time.to_binary_dos_time, # @last_mod_time
|
439
|
-
@time.to_binary_dos_date, # @last_mod_date
|
439
|
+
@time.to_binary_dos_time, # @last_mod_time
|
440
|
+
@time.to_binary_dos_date, # @last_mod_date
|
440
441
|
@crc,
|
441
442
|
zip64 && zip64.compressed_size ? 0xFFFFFFFF : @compressed_size,
|
442
443
|
zip64 && zip64.original_size ? 0xFFFFFFFF : @size,
|
@@ -602,7 +603,7 @@ module Zip
|
|
602
603
|
get_input_stream do |is|
|
603
604
|
set_extra_attributes_on_path(dest_path)
|
604
605
|
|
605
|
-
buf = ''
|
606
|
+
buf = ''.dup
|
606
607
|
while (buf = is.sysread(::Zip::Decompressor::CHUNK_SIZE, buf))
|
607
608
|
os << buf
|
608
609
|
end
|
data/lib/zip/extra_field.rb
CHANGED
data/lib/zip/inflater.rb
CHANGED
data/lib/zip/version.rb
CHANGED
Binary file
|
data/test/path_traversal_test.rb
CHANGED
@@ -131,4 +131,11 @@ class PathTraversalTest < MiniTest::Test
|
|
131
131
|
refute File.exist?('/tmp/file.txt')
|
132
132
|
end
|
133
133
|
end
|
134
|
+
|
135
|
+
def test_entry_name_with_tilde
|
136
|
+
in_tmpdir do
|
137
|
+
extract_path_traversal_zip 'tilde.zip'
|
138
|
+
assert File.exist?('~tilde~')
|
139
|
+
end
|
140
|
+
end
|
134
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyzip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Simonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -164,6 +164,7 @@ files:
|
|
164
164
|
- test/data/path_traversal/jwilk/relative2.zip
|
165
165
|
- test/data/path_traversal/jwilk/symlink.zip
|
166
166
|
- test/data/path_traversal/relative1.zip
|
167
|
+
- test/data/path_traversal/tilde.zip
|
167
168
|
- test/data/path_traversal/tuzovakaoff/README.md
|
168
169
|
- test/data/path_traversal/tuzovakaoff/absolutepath.zip
|
169
170
|
- test/data/path_traversal/tuzovakaoff/symlink.zip
|
@@ -226,8 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
227
|
- !ruby/object:Gem::Version
|
227
228
|
version: '0'
|
228
229
|
requirements: []
|
229
|
-
|
230
|
-
rubygems_version: 2.6.13
|
230
|
+
rubygems_version: 3.0.1
|
231
231
|
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: rubyzip is a ruby module for reading and writing zip files
|
@@ -280,6 +280,7 @@ test_files:
|
|
280
280
|
- test/data/rubycode2.zip
|
281
281
|
- test/data/mimetype
|
282
282
|
- test/data/zipWithEncryption.zip
|
283
|
+
- test/data/path_traversal/tilde.zip
|
283
284
|
- test/data/path_traversal/Makefile
|
284
285
|
- test/data/path_traversal/relative1.zip
|
285
286
|
- test/data/path_traversal/jwilk/dirsymlink.zip
|