rack 2.2.14 → 2.2.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

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: cfe795272720eaaf8af60d73a6f48b8f67363e5fc302f55e58db739c3c934b1a
4
- data.tar.gz: 6bb1f296c683cb5fb4628aed7cca3b34613d3a72f86cf2821e0d5ef358def5d9
3
+ metadata.gz: 2a0c02f8ad516a9e66e1d8ec32ca620dfe46328d5b248fb6a72ed0b8e4a0f91c
4
+ data.tar.gz: d32193586a1367c718a9a4385b26a4159a8e376c852c624fd9e1ad6b77e5137d
5
5
  SHA512:
6
- metadata.gz: 40d36f5e876e382aaf49daa1f56506577a4e24a3227be7a3645c599850b7de06e4a4292fafcdc9cd4cb3da207e7fb635f0382cad5ae4d0a25a7a4fc5aaa7551f
7
- data.tar.gz: 6a348030a182d2d380ba66bdb99d0f9738b6bd25388ca206b4bec1c50fcd195a1d425388c75509628d8fa345a6ccd509741141841bf66722337504685f4c4c7b
6
+ metadata.gz: 8ea04755b2f8c7d4482a35e601d5fdc73d1fd7f62fc0bade4cf6ce0769cbe7e182ec6c6659dddc44489069a19959a3d5fa799451573a38fb943f21376356329d
7
+ data.tar.gz: d8c8032d0fb15a750878a0d4127d79957f21890298b7dbdb743dc276ede56fb0a32b94ece434c7d6bea26bf55167b5318ffc9c0e4c0fe6f5d1baf0cadeba6ba5
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
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.18] - 2025-09-25
6
+
7
+ - [CVE-2025-59830](https://github.com/rack/rack/security/advisories/GHSA-625h-95r8-8xpm) Unbounded parameter parsing in `Rack::QueryParser` can lead to memory exhaustion via semicolon-separated parameters.
8
+
9
+ ## [2.2.17] - 2025-06-03
10
+
11
+ - Backport `Rack::MediaType#params` now handles parameters without values. ([#2263](https://github.com/rack/rack/pull/2263), [@AllyMarthaJ](https://github.com/AllyMarthaJ))
12
+
13
+ ## [2.2.16] - 2025-05-22
14
+
15
+ - Fix incorrect backport of optional `CGI::Cookie` support. ([#2335](https://github.com/rack/rack/pull/2335), [@jeremyevans])
16
+
17
+ ## [2.2.15] - 2025-05-18
18
+
19
+ - Optional support for `CGI::Cookie` if not available. ([#2327](https://github.com/rack/rack/pull/2327), [#2333](https://github.com/rack/rack/pull/2333), [@earlopain])
20
+
5
21
  ## [2.2.14] - 2025-05-06
6
22
 
7
23
  ### Security
@@ -777,3 +793,7 @@ Items below this line are from the previously maintained HISTORY.md and NEWS.md
777
793
  - Removed Rails adapter, was too alpha.
778
794
 
779
795
  ## [0.1] 2007-03-03
796
+
797
+ [@ioquatix]: https://github.com/ioquatix "Samuel Williams"
798
+ [@jeremyevans]: https://github.com/jeremyevans "Jeremy Evans"
799
+ [@earlopain]: https://github.com/earlopain "Earlopain"
@@ -15,8 +15,6 @@ module Rack
15
15
  host = options.delete(:Host) || default_host
16
16
  port = options.delete(:Port) || 8080
17
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
18
  server = ::Thin::Server.new(*args)
21
19
  yield server if block_given?
22
20
  server.start
@@ -27,6 +27,11 @@ module Rack
27
27
  # provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8",
28
28
  # this method responds with the following Hash:
29
29
  # { 'charset' => 'utf-8' }
30
+ #
31
+ # This will pass back parameters with empty strings in the hash if they
32
+ # lack a value (e.g., "text/plain;charset=" will return { 'charset' => '' },
33
+ # and "text/plain;charset" will return { 'charset' => '' }, similarly to
34
+ # the query params parser (barring the latter case, which returns nil instead)).
30
35
  def params(content_type)
31
36
  return {} if content_type.nil?
32
37
 
@@ -40,9 +45,9 @@ module Rack
40
45
 
41
46
  private
42
47
 
43
- def strip_doublequotes(str)
44
- (str.start_with?('"') && str.end_with?('"')) ? str[1..-2] : str
45
- end
48
+ def strip_doublequotes(str)
49
+ (str && str.start_with?('"') && str.end_with?('"')) ? str[1..-2] : str || ''
50
+ end
46
51
  end
47
52
  end
48
53
  end
data/lib/rack/mock.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  require 'uri'
4
4
  require 'stringio'
5
5
  require_relative '../rack'
6
- require 'cgi/cookie'
7
6
 
8
7
  module Rack
9
8
  # Rack::MockRequest helps testing your Rack application without
@@ -171,6 +170,36 @@ module Rack
171
170
  # MockRequest.
172
171
 
173
172
  class MockResponse < Rack::Response
173
+ begin
174
+ # Recent versions of the CGI gem may not provide `CGI::Cookie`.
175
+ require 'cgi/cookie'
176
+ Cookie = CGI::Cookie
177
+ rescue LoadError
178
+ class Cookie
179
+ attr_reader :name, :value, :path, :domain, :expires, :secure
180
+
181
+ def initialize(args)
182
+ @name = args["name"]
183
+ @value = args["value"]
184
+ @path = args["path"]
185
+ @domain = args["domain"]
186
+ @expires = args["expires"]
187
+ @secure = args["secure"]
188
+ end
189
+
190
+ def method_missing(method_name, *args, &block)
191
+ @value.send(method_name, *args, &block)
192
+ end
193
+ # :nocov:
194
+ ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
195
+ # :nocov:
196
+
197
+ def respond_to_missing?(method_name, include_all = false)
198
+ @value.respond_to?(method_name, include_all) || super
199
+ end
200
+ end
201
+ end
202
+
174
203
  class << self
175
204
  alias [] new
176
205
  end
@@ -236,7 +265,7 @@ module Rack
236
265
  set_cookie_header.split("\n").each do |cookie|
237
266
  cookie_name, cookie_filling = cookie.split('=', 2)
238
267
  cookie_attributes = identify_cookie_attributes cookie_filling
239
- parsed_cookie = CGI::Cookie.new(
268
+ parsed_cookie = Cookie.new(
240
269
  'name' => cookie_name.strip,
241
270
  'value' => cookie_attributes.fetch('value'),
242
271
  'path' => cookie_attributes.fetch('path', nil),
@@ -253,7 +282,7 @@ module Rack
253
282
  def identify_cookie_attributes(cookie_filling)
254
283
  cookie_bits = cookie_filling.split(';')
255
284
  cookie_attributes = Hash.new
256
- cookie_attributes.store('value', cookie_bits[0].strip)
285
+ cookie_attributes.store('value', Array(cookie_bits[0].strip))
257
286
  cookie_bits.each do |bit|
258
287
  if bit.include? '='
259
288
  cookie_attribute, attribute_value = bit.split('=')
@@ -188,7 +188,7 @@ module Rack
188
188
  raise QueryLimitError, "total query size (#{qs.bytesize}) exceeds limit (#{@bytesize_limit})"
189
189
  end
190
190
 
191
- if (param_count = qs.count(sep.is_a?(String) ? sep : '&')) >= @params_limit
191
+ if (param_count = qs.count(sep.is_a?(String) ? sep : '&;')) >= @params_limit
192
192
  raise QueryLimitError, "total number of query parameters (#{param_count+1}) exceeds limit (#{@params_limit})"
193
193
  end
194
194
 
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.14"
23
+ RELEASE = "2.2.18"
24
24
 
25
25
  # Return the Rack release as a dotted string.
26
26
  def self.release
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.14
4
+ version: 2.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-05-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: minitest
@@ -77,9 +76,9 @@ executables:
77
76
  - rackup
78
77
  extensions: []
79
78
  extra_rdoc_files:
80
- - README.rdoc
81
79
  - CHANGELOG.md
82
80
  - CONTRIBUTING.md
81
+ - README.rdoc
83
82
  files:
84
83
  - CHANGELOG.md
85
84
  - CONTRIBUTING.md
@@ -169,7 +168,6 @@ metadata:
169
168
  changelog_uri: https://github.com/rack/rack/blob/master/CHANGELOG.md
170
169
  documentation_uri: https://rubydoc.info/github/rack/rack
171
170
  source_code_uri: https://github.com/rack/rack
172
- post_install_message:
173
171
  rdoc_options: []
174
172
  require_paths:
175
173
  - lib
@@ -184,8 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
182
  - !ruby/object:Gem::Version
185
183
  version: '0'
186
184
  requirements: []
187
- rubygems_version: 3.5.22
188
- signing_key:
185
+ rubygems_version: 3.6.9
189
186
  specification_version: 4
190
187
  summary: A modular Ruby webserver interface.
191
188
  test_files: []