rack 2.2.1 → 2.2.3.1

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: ecd99d8eb4cb36d36f656ff9f0d688f5e97cfc9c219ea61daf75cc11c5b213fe
4
- data.tar.gz: d61d3ae82e127877da8629b4d8f36fb8007b51793589c864f9632aed55bdc5fd
3
+ metadata.gz: cd07394d5db5fbf3068cc076eea4059190c06a6e466de13383400bec4ff12e52
4
+ data.tar.gz: ae077819a035b88761b3fffe4f48d948c05e88d2b4942a6589216d929936a47d
5
5
  SHA512:
6
- metadata.gz: 4e2b43fae3062393ce93b0a9624177551a5aca4cb537203a99245b37ad97417f7f4e5d593ace93068cda6b8cce5fb111496caf46af90ff4ab16082b1d6927bd0
7
- data.tar.gz: 43f899d6905c51240e5b2ba429818a025596a0a7cdb7b447a3f2760c8af50999387d7f198e7a553befd82eb66784e16ad6cb8f6720e300904388fb07b6365917
6
+ metadata.gz: 405db34fbc0eca9a8cf15a7887c73a939b33fc25b1283fbc4791a2fbd25053565a19ad891c0b3704b0120157b118997a08b627b856de1dfc088705759930ced2
7
+ data.tar.gz: 98d7b2f6277118a8fa4b7dd7f43eafbc5c4724474b1bb481f798df97b688ec13b61d821d62c04f5839a96ffd298d4a6a2e22f6e2be6d54b0f8485bee37372bc7
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.3.1] - 2022-05-27
6
+
7
+ - [CVE-2022-30123] Fix shell escaping issue in Common Logger
8
+ - [CVE-2022-30122] Restrict parsing of broken MIME attachments
9
+
10
+ ## [2.2.3] - 2020-02-11
11
+
12
+ - [CVE-2020-8184] Only decode cookie values
13
+
14
+ ## [2.2.2] - 2020-02-11
15
+
16
+ ### Fixed
17
+
18
+ - Fix incorrect `Rack::Request#host` value. ([#1591](https://github.com/rack/rack/pull/1591), [@ioquatix](https://github.com/ioquatix))
19
+ - Revert `Rack::Handler::Thin` implementation. ([#1583](https://github.com/rack/rack/pull/1583), [@jeremyevans](https://github.com/jeremyevans))
20
+ - Double assignment is still needed to prevent an "unused variable" warning. ([#1589](https://github.com/rack/rack/pull/1589), [@kamipo](https://github.com/kamipo))
21
+ - Fix to handle same_site option for session pool. ([#1587](https://github.com/rack/rack/pull/1587), [@kamipo](https://github.com/kamipo))
22
+
5
23
  ## [2.2.1] - 2020-02-09
6
24
 
7
25
  ### Fixed
@@ -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)
@@ -12,20 +12,14 @@ module Rack
12
12
  environment = ENV['RACK_ENV'] || 'development'
13
13
  default_host = environment == 'development' ? 'localhost' : '0.0.0.0'
14
14
 
15
- if block_given?
16
- host = options.delete(:Host) || default_host
17
- port = options.delete(:Port) || 8080
18
- args = [host, port, app, options]
19
- # Thin versions below 0.8.0 do not support additional options
20
- args.pop if ::Thin::VERSION::MAJOR < 1 && ::Thin::VERSION::MINOR < 8
21
- server = ::Thin::Server.new(*args)
22
- yield server
23
- server.start
24
- else
25
- options[:address] = options[:Host] || default_host
26
- options[:port] = options[:Port] || 8080
27
- ::Thin::Controllers::Controller.new(options).start
28
- end
15
+ host = options.delete(:Host) || default_host
16
+ port = options.delete(:Port) || 8080
17
+ args = [host, port, app, options]
18
+ # Thin versions below 0.8.0 do not support additional options
19
+ args.pop if ::Thin::VERSION::MAJOR < 1 && ::Thin::VERSION::MINOR < 8
20
+ server = ::Thin::Server.new(*args)
21
+ yield server if block_given?
22
+ server.start
29
23
  end
30
24
 
31
25
  def self.valid_options
data/lib/rack/lint.rb CHANGED
@@ -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 BROKEN_QUOTED, BROKEN_UNQUOTED
304
+ when BROKEN
305
305
  filename = $1
306
+ filename = $1 if filename =~ /^"(.*)"$/
306
307
  end
307
308
 
308
309
  return unless filename
@@ -16,8 +16,7 @@ module Rack
16
16
  TOKEN = /[^\s()<>,;:\\"\/\[\]?=]+/
17
17
  CONDISP = /Content-Disposition:\s*#{TOKEN}\s*/i
18
18
  VALUE = /"(?:\\"|[^"])*"|#{TOKEN}/
19
- BROKEN_QUOTED = /^#{CONDISP}.*;\s*filename="(.*?)"(?:\s*$|\s*;\s*#{TOKEN}=)/i
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/request.rb CHANGED
@@ -598,7 +598,7 @@ module Rack
598
598
  value ? value.strip.split(/[,\s]+/) : []
599
599
  end
600
600
 
601
- AUTHORITY = /
601
+ AUTHORITY = /^
602
602
  # The host:
603
603
  (?<host>
604
604
  # An IPv6 address:
@@ -612,7 +612,7 @@ module Rack
612
612
  )
613
613
  # The optional port:
614
614
  (:(?<port>\d+))?
615
- /x
615
+ $/x
616
616
 
617
617
  private_constant :AUTHORITY
618
618
 
@@ -252,6 +252,7 @@ module Rack
252
252
  @default_options = self.class::DEFAULT_OPTIONS.merge(options)
253
253
  @key = @default_options.delete(:key)
254
254
  @cookie_only = @default_options.delete(:cookie_only)
255
+ @same_site = @default_options.delete(:same_site)
255
256
  initialize_sid
256
257
  end
257
258
 
@@ -118,7 +118,6 @@ module Rack
118
118
  Called from: #{caller[0]}.
119
119
  MSG
120
120
  @coder = options[:coder] ||= Base64::Marshal.new
121
- @same_site = options.delete :same_site
122
121
  super(app, options.merge!(cookie_only: true))
123
122
  end
124
123
 
@@ -63,12 +63,12 @@ module Rack
63
63
  def pretty(env, exception)
64
64
  req = Rack::Request.new(env)
65
65
 
66
- # This double assignment is to prevent an "unused variable" warning on
67
- # Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
66
+ # This double assignment is to prevent an "unused variable" warning.
67
+ # Yes, it is dumb, but I don't like Ruby yelling at me.
68
68
  path = path = (req.script_name + req.path_info).squeeze("/")
69
69
 
70
- # This double assignment is to prevent an "unused variable" warning on
71
- # Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
70
+ # This double assignment is to prevent an "unused variable" warning.
71
+ # Yes, it is dumb, but I don't like Ruby yelling at me.
72
72
  frames = frames = exception.backtrace.map { |line|
73
73
  frame = OpenStruct.new
74
74
  if line =~ /(.*?):(\d+)(:in `(.*)')?/
@@ -23,14 +23,14 @@ module Rack
23
23
 
24
24
  # client or server error, or explicit message
25
25
  if (status.to_i >= 400 && empty) || env[RACK_SHOWSTATUS_DETAIL]
26
- # This double assignment is to prevent an "unused variable" warning on
27
- # Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
26
+ # This double assignment is to prevent an "unused variable" warning.
27
+ # Yes, it is dumb, but I don't like Ruby yelling at me.
28
28
  req = req = Rack::Request.new(env)
29
29
 
30
30
  message = Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s
31
31
 
32
- # This double assignment is to prevent an "unused variable" warning on
33
- # Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
32
+ # This double assignment is to prevent an "unused variable" warning.
33
+ # Yes, it is dumb, but I don't like Ruby yelling at me.
34
34
  detail = detail = env[RACK_SHOWSTATUS_DETAIL] || message
35
35
 
36
36
  body = @template.result(binding)
data/lib/rack/utils.rb CHANGED
@@ -212,8 +212,12 @@ module Rack
212
212
  # The syntax for cookie headers only supports semicolons
213
213
  # User Agent -> Server ==
214
214
  # Cookie: SID=31d4d96e407aad42; lang=en-US
215
- cookies = parse_query(header, ';') { |s| unescape(s) rescue s }
216
- cookies.each_with_object({}) { |(k, v), hash| hash[k] = Array === v ? v.first : v }
215
+ return {} unless header
216
+ header.split(/[;] */n).each_with_object({}) do |cookie, cookies|
217
+ next if cookie.empty?
218
+ key, value = cookie.split('=', 2)
219
+ cookies[key] = (unescape(value) rescue value) unless cookies.key?(key)
220
+ end
217
221
  end
218
222
 
219
223
  def add_cookie_to_header(header, key, value)
data/lib/rack/version.rb CHANGED
@@ -20,7 +20,7 @@ module Rack
20
20
  VERSION.join(".")
21
21
  end
22
22
 
23
- RELEASE = "2.2.1"
23
+ RELEASE = "2.2.3.1"
24
24
 
25
25
  # Return the Rack release as a dotted string.
26
26
  def self.release
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.1
4
+ version: 2.2.3.1
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-02-09 00:00:00.000000000 Z
11
+ date: 2022-05-27 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.6
187
+ rubygems_version: 3.0.3.1
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: A modular Ruby webserver interface.