rack 2.1.1 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c636b399e2635a9c09098c5b9c7bc47488b2184d0283d21853616862bbadacd
4
- data.tar.gz: fc4e151fe86e0752616e3e42b01f7f730250ab6cc55dc1bbe3452ed7bc92b507
3
+ metadata.gz: 83025be71b5d57dbb184eb3d2364c727dad01c2214f683377dec5fdb3de0bc7d
4
+ data.tar.gz: c672e59748bb0b5412f017260168b7cd718f99c6bc7fc7ec2fd374d21b5dc7e3
5
5
  SHA512:
6
- metadata.gz: 416fca4689a96df477d6b90978470c34c68facfa7ce1ee48cc1956f47e9f7379d906ae661b1c78ff14ff565c19f16ca28e5dcbfef18e9f87c36f7fb5d781d54f
7
- data.tar.gz: 8d400ae00dae63dc5afcb84aef13598b95892dce2d9bd3d2662da64c22dc97e28d30b125692c71547b0d41e44fb1628d1eba9cf5e42a834502353c7730acd872
6
+ metadata.gz: 9e3eecfe73f0dc2def1653c47d84dc9d044395ffed4a4021ac5dfd565267f214264c06efec8ef84fec3159a0e793acf6190ecf151280ab544cbb852eb32db168
7
+ data.tar.gz: 9c64bdf7f521ef19170025a24627f0e59ea3f18be605da7e623027928f153c1a3a71fc001695d52e99d153a3d50f11ef9b13c11223c3245bbf0a5cc3f10f2e57
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [2.1.2] - 2020-01-27
2
+
3
+ - Fix multipart parser for some files to prevent denial of service ([@aiomaster](https://github.com/aiomaster))
4
+ - Fix `Rack::Builder#use` with keyword arguments ([@kamipo](https://github.com/kamipo))
5
+ - Skip deflating in Rack::Deflater if Content-Length is 0 ([@jeremyevans](https://github.com/jeremyevans))
6
+ - Remove `SessionHash#transform_keys`, no longer needed ([@pavel](https://github.com/pavel))
7
+ - Add to_hash to wrap Hash and Session classes ([@oleh-demyanyuk](https://github.com/oleh-demyanyuk))
8
+ - Handle case where session id key is requested but missing ([@jeremyevans](https://github.com/jeremyevans))
9
+
1
10
  ## [2.1.1] - 2020-01-12
2
11
 
3
12
  - Remove `Rack::Chunked` from `Rack::Server` default middleware. ([#1475](https://github.com/rack/rack/pull/1475), [@ioquatix](https://github.com/ioquatix))
data/lib/rack.rb CHANGED
@@ -20,7 +20,7 @@ module Rack
20
20
  VERSION.join(".")
21
21
  end
22
22
 
23
- RELEASE = "2.1.1"
23
+ RELEASE = "2.1.3"
24
24
 
25
25
  # Return the Rack release as a dotted string.
26
26
  def self.release
data/lib/rack/builder.rb CHANGED
@@ -101,6 +101,7 @@ module Rack
101
101
  end
102
102
  @use << proc { |app| middleware.new(app, *args, &block) }
103
103
  end
104
+ ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true)
104
105
 
105
106
  # Takes an argument that is an object that responds to #call and returns a Rack response.
106
107
  # The simplest form of this is a lambda object:
data/lib/rack/deflater.rb CHANGED
@@ -124,6 +124,10 @@ module Rack
124
124
  # Skip if @condition lambda is given and evaluates to false
125
125
  return false if @condition && !@condition.call(env, status, headers, body)
126
126
 
127
+ # No point in compressing empty body, also handles usage with
128
+ # Rack::Sendfile.
129
+ return false if headers[CONTENT_LENGTH] == '0'
130
+
127
131
  true
128
132
  end
129
133
  end
@@ -106,13 +106,12 @@ table { width:100%%; }
106
106
 
107
107
  def list_directory(path_info, path, script_name)
108
108
  files = [['../', 'Parent Directory', '', '', '']]
109
- glob = ::File.join(path, '*')
110
109
 
111
110
  url_head = (script_name.split('/') + path_info.split('/')).map do |part|
112
111
  Rack::Utils.escape_path part
113
112
  end
114
113
 
115
- Dir[glob].sort.each do |node|
114
+ Dir.entries(path).reject { |e| e.start_with?('.') }.sort.each do |node|
116
115
  stat = stat(node)
117
116
  next unless stat
118
117
  basename = ::File.basename(node)
@@ -185,7 +185,7 @@ module Rack
185
185
  @collector = Collector.new tempfile
186
186
 
187
187
  @sbuf = StringScanner.new("".dup)
188
- @body_regex = /(.*?)(#{EOL})?#{Regexp.quote(@boundary)}(#{EOL}|--)/m
188
+ @body_regex = /(?:#{EOL})?#{Regexp.quote(@boundary)}(?:#{EOL}|--)/m
189
189
  @rx_max_size = EOL.size + @boundary.bytesize + [EOL.size, '--'.size].max
190
190
  @head_regex = /(.*?#{EOL})#{EOL}/m
191
191
  end
@@ -268,8 +268,8 @@ module Rack
268
268
  end
269
269
 
270
270
  def handle_mime_body
271
- if @sbuf.check_until(@body_regex) # check but do not advance the pointer yet
272
- body = @sbuf[1]
271
+ if (body_with_boundary = @sbuf.check_until(@body_regex)) # check but do not advance the pointer yet
272
+ body = body_with_boundary.sub(/#{@body_regex}\z/m, '') # remove the boundary from the string
273
273
  @collector.on_mime_body @mime_index, body
274
274
  @sbuf.pos += body.length + 2 # skip \r\n after the content
275
275
  @state = :CONSUME_TOKEN
@@ -56,14 +56,6 @@ module Rack
56
56
  end
57
57
  } unless {}.respond_to?(:transform_keys)
58
58
 
59
- def transform_keys(&block)
60
- hash = dup
61
- each do |key, value|
62
- hash[block.call(key)] = value
63
- end
64
- hash
65
- end
66
-
67
59
  include Enumerable
68
60
  attr_writer :id
69
61
 
@@ -209,7 +201,7 @@ module Rack
209
201
  end
210
202
 
211
203
  def stringify_keys(other)
212
- other.transform_keys(&:to_s)
204
+ other.to_hash.transform_keys(&:to_s)
213
205
  end
214
206
  end
215
207
 
@@ -460,7 +452,7 @@ module Rack
460
452
  def [](key)
461
453
  if key == "session_id"
462
454
  load_for_read!
463
- id.public_id
455
+ id.public_id if id
464
456
  else
465
457
  super
466
458
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-11 00:00:00.000000000 Z
11
+ date: 2020-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest