rack 2.2.2 → 2.2.4
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 +4 -4
- data/CHANGELOG.md +18 -0
- data/lib/rack/common_logger.rb +3 -0
- data/lib/rack/etag.rb +2 -0
- data/lib/rack/lint.rb +3 -3
- data/lib/rack/multipart/parser.rb +2 -1
- data/lib/rack/multipart.rb +1 -2
- data/lib/rack/query_parser.rb +6 -2
- data/lib/rack/utils.rb +11 -4
- data/lib/rack/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 562d6b2cb433ea758545c29074629d82b364bf197dfab096c1821ffb72928e3c
|
4
|
+
data.tar.gz: 5adf005621955c2a5a524f966603c2d8c0f7cf640f6fff4439d024a921f69c4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8a134688af4df517e1483bca22c63582e5b29d6d4f2b71c11b220ee57642d046a4188038a45d02e20357b6823c7938c57aa45fd88f504732a76b58c6bf70eb7
|
7
|
+
data.tar.gz: 81164557b5a8e25d35ff7f2e2889ea7e6eb04df8a23b42513fdcffa7d85dfd07f925372c703f5bf6a9a1fea2f3b842de5565cb0608d713b4cfe81440007e1d2e
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,24 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. For info on how to format all future additions to this file please reference [Keep A Changelog](https://keepachangelog.com/en/1.0.0/).
|
4
4
|
|
5
|
+
## [2.2.4] - 2022-06-30
|
6
|
+
|
7
|
+
- Better support for lower case headers in `Rack::ETag` middleware. ([#1919](https://github.com/rack/rack/pull/1919), [@ioquatix](https://github.com/ioquatix))
|
8
|
+
- Use custom exception on params too deep error. ([#1838](https://github.com/rack/rack/pull/1838), [@simi](https://github.com/simi))
|
9
|
+
|
10
|
+
## [2.2.3.1] - 2022-05-27
|
11
|
+
|
12
|
+
### Security
|
13
|
+
|
14
|
+
- [CVE-2022-30123] Fix shell escaping issue in Common Logger
|
15
|
+
- [CVE-2022-30122] Restrict parsing of broken MIME attachments
|
16
|
+
|
17
|
+
## [2.2.3] - 2020-02-11
|
18
|
+
|
19
|
+
### Security
|
20
|
+
|
21
|
+
- [CVE-2020-8184] Only decode cookie values
|
22
|
+
|
5
23
|
## [2.2.2] - 2020-02-11
|
6
24
|
|
7
25
|
### Fixed
|
data/lib/rack/common_logger.rb
CHANGED
@@ -60,7 +60,10 @@ module Rack
|
|
60
60
|
length,
|
61
61
|
Utils.clock_time - began_at ]
|
62
62
|
|
63
|
+
msg.gsub!(/[^[:print:]\n]/) { |c| "\\x#{c.ord}" }
|
64
|
+
|
63
65
|
logger = @logger || env[RACK_ERRORS]
|
66
|
+
|
64
67
|
# Standard library logger doesn't support write but it supports << which actually
|
65
68
|
# calls to write on the log device without formatting
|
66
69
|
if logger.respond_to?(:write)
|
data/lib/rack/etag.rb
CHANGED
data/lib/rack/lint.rb
CHANGED
@@ -48,10 +48,10 @@ module Rack
|
|
48
48
|
|
49
49
|
## and returns an Array of exactly three values:
|
50
50
|
ary = @app.call(env)
|
51
|
-
assert("response
|
51
|
+
assert("response is not an Array, but #{ary.class}") {
|
52
52
|
ary.kind_of? Array
|
53
53
|
}
|
54
|
-
assert("response array
|
54
|
+
assert("response array has #{ary.size} elements instead of 3") {
|
55
55
|
ary.size == 3
|
56
56
|
}
|
57
57
|
|
@@ -337,7 +337,7 @@ module Rack
|
|
337
337
|
check_hijack env
|
338
338
|
|
339
339
|
## * The <tt>REQUEST_METHOD</tt> must be a valid token.
|
340
|
-
assert("REQUEST_METHOD unknown: #{env[REQUEST_METHOD]}") {
|
340
|
+
assert("REQUEST_METHOD unknown: #{env[REQUEST_METHOD].dump}") {
|
341
341
|
env[REQUEST_METHOD] =~ /\A[0-9A-Za-z!\#$%&'*+.^_`|~-]+\z/
|
342
342
|
}
|
343
343
|
|
@@ -301,8 +301,9 @@ module Rack
|
|
301
301
|
elsif filename = params['filename*']
|
302
302
|
encoding, _, filename = filename.split("'", 3)
|
303
303
|
end
|
304
|
-
when
|
304
|
+
when BROKEN
|
305
305
|
filename = $1
|
306
|
+
filename = $1 if filename =~ /^"(.*)"$/
|
306
307
|
end
|
307
308
|
|
308
309
|
return unless filename
|
data/lib/rack/multipart.rb
CHANGED
@@ -16,8 +16,7 @@ module Rack
|
|
16
16
|
TOKEN = /[^\s()<>,;:\\"\/\[\]?=]+/
|
17
17
|
CONDISP = /Content-Disposition:\s*#{TOKEN}\s*/i
|
18
18
|
VALUE = /"(?:\\"|[^"])*"|#{TOKEN}/
|
19
|
-
|
20
|
-
BROKEN_UNQUOTED = /^#{CONDISP}.*;\s*filename=(#{TOKEN})/i
|
19
|
+
BROKEN = /^#{CONDISP}.*;\s*filename=(#{VALUE})/i
|
21
20
|
MULTIPART_CONTENT_TYPE = /Content-Type: (.*)#{EOL}/ni
|
22
21
|
MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:.*;\s*name=(#{VALUE})/ni
|
23
22
|
MULTIPART_CONTENT_ID = /Content-ID:\s*([^#{EOL}]*)/ni
|
data/lib/rack/query_parser.rb
CHANGED
@@ -16,6 +16,10 @@ module Rack
|
|
16
16
|
# sequence.
|
17
17
|
class InvalidParameterError < ArgumentError; end
|
18
18
|
|
19
|
+
# ParamsTooDeepError is the error that is raised when params are recursively
|
20
|
+
# nested over the specified limit.
|
21
|
+
class ParamsTooDeepError < RangeError; end
|
22
|
+
|
19
23
|
def self.make_default(key_space_limit, param_depth_limit)
|
20
24
|
new Params, key_space_limit, param_depth_limit
|
21
25
|
end
|
@@ -81,7 +85,7 @@ module Rack
|
|
81
85
|
# the structural types represented by two different parameter names are in
|
82
86
|
# conflict, a ParameterTypeError is raised.
|
83
87
|
def normalize_params(params, name, v, depth)
|
84
|
-
raise
|
88
|
+
raise ParamsTooDeepError if depth <= 0
|
85
89
|
|
86
90
|
name =~ %r(\A[\[\]]*([^\[\]]+)\]*)
|
87
91
|
k = $1 || ''
|
@@ -168,7 +172,7 @@ module Rack
|
|
168
172
|
|
169
173
|
def []=(key, value)
|
170
174
|
@size += key.size if key && !@params.key?(key)
|
171
|
-
raise
|
175
|
+
raise ParamsTooDeepError, 'exceeded available parameter key space' if @size > @limit
|
172
176
|
@params[key] = value
|
173
177
|
end
|
174
178
|
|
data/lib/rack/utils.rb
CHANGED
@@ -22,6 +22,9 @@ module Rack
|
|
22
22
|
COMMON_SEP = QueryParser::COMMON_SEP
|
23
23
|
KeySpaceConstrainedParams = QueryParser::Params
|
24
24
|
|
25
|
+
RFC2822_DAY_NAME = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
|
26
|
+
RFC2822_MONTH_NAME = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
|
27
|
+
|
25
28
|
class << self
|
26
29
|
attr_accessor :default_query_parser
|
27
30
|
end
|
@@ -212,8 +215,12 @@ module Rack
|
|
212
215
|
# The syntax for cookie headers only supports semicolons
|
213
216
|
# User Agent -> Server ==
|
214
217
|
# Cookie: SID=31d4d96e407aad42; lang=en-US
|
215
|
-
|
216
|
-
|
218
|
+
return {} unless header
|
219
|
+
header.split(/[;] */n).each_with_object({}) do |cookie, cookies|
|
220
|
+
next if cookie.empty?
|
221
|
+
key, value = cookie.split('=', 2)
|
222
|
+
cookies[key] = (unescape(value) rescue value) unless cookies.key?(key)
|
223
|
+
end
|
217
224
|
end
|
218
225
|
|
219
226
|
def add_cookie_to_header(header, key, value)
|
@@ -323,8 +330,8 @@ module Rack
|
|
323
330
|
# weekday and month.
|
324
331
|
#
|
325
332
|
def rfc2109(time)
|
326
|
-
wday =
|
327
|
-
mon =
|
333
|
+
wday = RFC2822_DAY_NAME[time.wday]
|
334
|
+
mon = RFC2822_MONTH_NAME[time.mon - 1]
|
328
335
|
time.strftime("#{wday}, %d-#{mon}-%Y %H:%M:%S GMT")
|
329
336
|
end
|
330
337
|
|
data/lib/rack/version.rb
CHANGED
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.2.
|
4
|
+
version: 2.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leah Neukirchen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
|
-
rubygems_version: 3.0.
|
187
|
+
rubygems_version: 3.0.3.1
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: A modular Ruby webserver interface.
|