rack 3.2.6 → 3.2.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37024c5110b365f1dd0b5627dd903edf42344fa9ad98a99af672e220d2370288
4
- data.tar.gz: d0bd60323a75ff2828b33713963dcb5769898abc82a7ab3c2b9ac4ad36550b88
3
+ metadata.gz: 57fe61378c6650847203c66b4d5597dadee788d07e9178bb38d89de37ce91f8a
4
+ data.tar.gz: 5cb0747f5ce457a10d836fed60259ab7f7ae37fe33b9c164c2cf201b4d58d306
5
5
  SHA512:
6
- metadata.gz: 825e73fe75136333217b5f395f25245fe295fa4749a8068711011ba5c47350043941e4a4319837015e211f6cbd29952970fdc79f5deb0364c76d995c8d9de457
7
- data.tar.gz: 57b8333f46704c6aead2d24ab214ab99ddb8296f93cc62298385d20bf4bffad829fae3b5e3a658e399d1628ab355a9abd69e4e1f2d08971740547b6ff1425f5b
6
+ metadata.gz: 4f28e8f049827ce264fcd4845adfad131796e3e1d18d036fc22bbbd68db80800bf124b0324f59ccc098c9bfb0b59a0ecb8ec1d75d22727896681b591b0a68794
7
+ data.tar.gz: 3dcb3e16c41b6c95e06a35d282e9c35ebc7b26a31505be8beb3d17582bfd8a2e182ca132c8e4f1122f15122581165b8cd3337e943c150247d3c577686913f541
data/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
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
+ ## [3.2.8] - 2026-10-30
6
+
7
+ ### Security
8
+
9
+ - [GHSA-5v64-555j-wjxm](https://github.com/advisories/GHSA-5v64-555j-wjxm) Multipart parser retains parsed data in its scan buffer, allowing denial of service via memory exhaustion.
10
+ - [GHSA-wvg4-6p58-3gh3](https://github.com/advisories/GHSA-wvg4-6p58-3gh3) `Rack::Static` header rules were matched against an unnormalized path, allowing dot segments to bypass them.
11
+ - [GHSA-2j8w-xcrc-x985](https://github.com/advisories/GHSA-2j8w-xcrc-x985) `Rack::Request#host_with_port`, `#base_url`, and `#url` returned the raw authority when it was invalid; `host_with_port` now returns `nil` in that case.
12
+ - [GHSA-p8x9-v4hv-2w4g](https://github.com/advisories/GHSA-p8x9-v4hv-2w4g) Multipart requests with more than one `boundary` parameter were accepted when the first value was empty or began with a quote, semicolon, or comma, bypassing the guard added for CVE-2026-26961.
13
+
14
+ ### Fixed
15
+
16
+ - `Rack::Multipart::UploadedFile` now delegates keyword arguments to the wrapped tempfile. Calls such as `uploaded_file.readlines(chomp: true)` raised `TypeError` on Ruby 3.0+. ([#2481](https://github.com/rack/rack/issues/2481), [#2501](https://github.com/rack/rack/pull/2501), [@SeanLF](https://github.com/SeanLF))
17
+
18
+ ## [3.2.7] - 2026-08-13
19
+
20
+ ### Fixed
21
+
22
+ - Restore Ruby 2.4/2.5 compatibility.
23
+
5
24
  ## [3.2.6] - 2026-04-01
6
25
 
7
26
  ### Security
@@ -17,7 +36,7 @@ All notable changes to this project will be documented in this file. For info on
17
36
  - [CVE-2026-34830](https://github.com/advisories/GHSA-qv7j-4883-hwh7) `Rack::Sendfile` header-based `X-Accel-Mapping` regex injection enables unauthorized `X-Accel-Redirect`.
18
37
  - [CVE-2026-34785](https://github.com/advisories/GHSA-h2jq-g4cq-5ppq) `Rack::Static` prefix matching can expose unintended files under the static root.
19
38
  - [CVE-2026-34829](https://github.com/advisories/GHSA-8vqr-qjwx-82mw) Multipart parsing without `Content-Length` header allows unbounded chunked file uploads.
20
- - [CVE-2026-34827](https://github.com/advisories/GHSA-v6x5-cg8r-vv6x) Quadratic-time multipart header parsing allows denial of service via escape-heavy quoted parameters.
39
+ - [CVE-2026-34827](https://github.com/advisories/GHSA-v6x5-cg8r-vv6x) Multipart header parsing allows denial of service via escape-heavy quoted parameters.
21
40
  - [CVE-2026-26962](https://github.com/advisories/GHSA-rx22-g9mx-qrhv) Improper unfolding of folded multipart headers preserves CRLF in parsed parameter values.
22
41
 
23
42
  ## [3.2.5] - 2026-02-16
@@ -109,6 +128,42 @@ This release continues Rack's evolution toward a cleaner, more efficient foundat
109
128
  - `SERVER_NAME` and `HTTP_HOST` are now more strictly validated according to the relevant specifications. ([#2298](https://github.com/rack/rack/pull/2298), [@ioquatix])
110
129
  - `Rack::Lint` now disallows `PATH_INFO="" SCRIPT_NAME=""`. ([#2298](https://github.com/rack/rack/issues/2307), [@jeremyevans])
111
130
 
131
+ ## [3.1.23] - 2026-10-30
132
+
133
+ ### Security
134
+
135
+ - [GHSA-5v64-555j-wjxm](https://github.com/advisories/GHSA-5v64-555j-wjxm) Multipart parser retains parsed data in its scan buffer, allowing denial of service via memory exhaustion.
136
+ - [GHSA-wvg4-6p58-3gh3](https://github.com/advisories/GHSA-wvg4-6p58-3gh3) `Rack::Static` header rules were matched against an unnormalized path, allowing dot segments to bypass them.
137
+ - [GHSA-2j8w-xcrc-x985](https://github.com/advisories/GHSA-2j8w-xcrc-x985) `Rack::Request#host_with_port`, `#base_url`, and `#url` returned the raw authority when it was invalid; `host_with_port` now returns `nil` in that case.
138
+ - [GHSA-p8x9-v4hv-2w4g](https://github.com/advisories/GHSA-p8x9-v4hv-2w4g) Multipart requests with more than one `boundary` parameter were accepted when the first value was empty or began with a quote, semicolon, or comma, bypassing the guard added for CVE-2026-26961.
139
+
140
+ ## [3.1.22] - 2026-08-13
141
+
142
+ ### Security
143
+
144
+ - [CVE-2026-26962](https://github.com/advisories/GHSA-rx22-g9mx-qrhv) Improper unfolding of folded multipart headers preserves CRLF in parsed parameter values.
145
+
146
+ ### Fixed
147
+
148
+ - Restore Ruby 2.4/2.5 compatibility.
149
+
150
+ ## [3.1.21] - 2026-04-01
151
+
152
+ ### Security
153
+
154
+ - [CVE-2026-34763](https://github.com/advisories/GHSA-7mqq-6cf9-v2qp) Root directory disclosure via unescaped regex interpolation in `Rack::Directory`.
155
+ - [CVE-2026-34230](https://github.com/advisories/GHSA-v569-hp3g-36wr) Avoid O(n^2) algorithm in `Rack::Utils.select_best_encoding` which could lead to denial of service.
156
+ - [CVE-2026-32762](https://github.com/advisories/GHSA-qfgr-crr9-7r49) Forwarded header semicolon injection enables Host and Scheme spoofing.
157
+ - [CVE-2026-26961](https://github.com/advisories/GHSA-vgpv-f759-9wx3) Raise error for multipart requests with multiple boundary parameters.
158
+ - [CVE-2026-34786](https://github.com/advisories/GHSA-q4qf-9j86-f5mh) `Rack::Static` `header_rules` bypass via URL-encoded path mismatch.
159
+ - [CVE-2026-34831](https://github.com/advisories/GHSA-q2ww-5357-x388) `Content-Length` mismatch in `Rack::Files` error responses.
160
+ - [CVE-2026-34826](https://github.com/advisories/GHSA-x8cg-fq8g-mxfx) Multipart byte range processing allows denial of service via excessive overlapping ranges.
161
+ - [CVE-2026-34835](https://github.com/advisories/GHSA-g2pf-xv49-m2h5) `Rack::Request` accepts invalid Host characters, enabling host allowlist bypass.
162
+ - [CVE-2026-34830](https://github.com/advisories/GHSA-qv7j-4883-hwh7) `Rack::Sendfile` header-based `X-Accel-Mapping` regex injection enables unauthorized `X-Accel-Redirect`.
163
+ - [CVE-2026-34785](https://github.com/advisories/GHSA-h2jq-g4cq-5ppq) `Rack::Static` prefix matching can expose unintended files under the static root.
164
+ - [CVE-2026-34829](https://github.com/advisories/GHSA-8vqr-qjwx-82mw) Multipart parsing without `Content-Length` header allows unbounded chunked file uploads.
165
+ - [CVE-2026-34827](https://github.com/advisories/GHSA-v6x5-cg8r-vv6x) Multipart header parsing allows denial of service via escape-heavy quoted parameters.
166
+
112
167
  ## [3.1.20] - 2026-02-16
113
168
 
114
169
  ### Security
@@ -506,6 +561,38 @@ This release introduces major improvements to Rack, including enhanced support f
506
561
  - Fix multipart filename generation for filenames that contain spaces. Encode spaces as "%20" instead of "+" which will be decoded properly by the multipart parser. ([#1736](https://github.com/rack/rack/pull/1645), [@muirdm](https://github.com/muirdm))
507
562
  - `Rack::Request#scheme` returns `ws` or `wss` when one of the `X-Forwarded-Scheme` / `X-Forwarded-Proto` headers is set to `ws` or `wss`, respectively. ([#1730](https://github.com/rack/rack/issues/1730), [@erwanst](https://github.com/erwanst))
508
563
 
564
+ ## [2.2.25] - 2026-10-30
565
+
566
+ ### Security
567
+
568
+ - [GHSA-5v64-555j-wjxm](https://github.com/advisories/GHSA-5v64-555j-wjxm) Multipart parser retains parsed data in its scan buffer, allowing denial of service via memory exhaustion.
569
+ - [GHSA-wvg4-6p58-3gh3](https://github.com/advisories/GHSA-wvg4-6p58-3gh3) `Rack::Static` header rules were matched against an unnormalized path, allowing dot segments to bypass them.
570
+ - [GHSA-p8x9-v4hv-2w4g](https://github.com/advisories/GHSA-p8x9-v4hv-2w4g) Multipart requests with more than one `boundary` parameter were accepted when the first value was empty or began with a quote, semicolon, or comma, bypassing the guard added for CVE-2026-26961.
571
+
572
+ ### Fixed
573
+
574
+ - Multipart parser: scan boundary lines with a literal newline search instead of a backtracking regexp, which allocated tens of megabytes per scan for long lines and made the scan buffer fix above ineffective on this series.
575
+
576
+ ## [2.2.24] - 2026-08-13
577
+
578
+ ### Security
579
+
580
+ - [CVE-2026-26962](https://github.com/advisories/GHSA-rx22-g9mx-qrhv) Improper unfolding of folded multipart headers preserves CRLF in parsed parameter values.
581
+
582
+ ## [2.2.23] - 2026-04-01
583
+
584
+ ### Security
585
+
586
+ - [CVE-2026-34763](https://github.com/advisories/GHSA-7mqq-6cf9-v2qp) Root directory disclosure via unescaped regex interpolation in `Rack::Directory`.
587
+ - [CVE-2026-34230](https://github.com/advisories/GHSA-v569-hp3g-36wr) Avoid O(n^2) algorithm in `Rack::Utils.select_best_encoding` which could lead to denial of service.
588
+ - [CVE-2026-26961](https://github.com/advisories/GHSA-vgpv-f759-9wx3) Raise error for multipart requests with multiple boundary parameters.
589
+ - [CVE-2026-34786](https://github.com/advisories/GHSA-q4qf-9j86-f5mh) `Rack::Static` `header_rules` bypass via URL-encoded path mismatch.
590
+ - [CVE-2026-34831](https://github.com/advisories/GHSA-q2ww-5357-x388) `Content-Length` mismatch in `Rack::Files` error responses.
591
+ - [CVE-2026-34826](https://github.com/advisories/GHSA-x8cg-fq8g-mxfx) Multipart byte range processing allows denial of service via excessive overlapping ranges.
592
+ - [CVE-2026-34830](https://github.com/advisories/GHSA-qv7j-4883-hwh7) `Rack::Sendfile` header-based `X-Accel-Mapping` regex injection enables unauthorized `X-Accel-Redirect`.
593
+ - [CVE-2026-34785](https://github.com/advisories/GHSA-h2jq-g4cq-5ppq) `Rack::Static` prefix matching can expose unintended files under the static root.
594
+ - [CVE-2026-34829](https://github.com/advisories/GHSA-8vqr-qjwx-82mw) Multipart parsing without `Content-Length` header allows unbounded chunked file uploads.
595
+
509
596
  ## [2.2.22] - 2026-02-16
510
597
 
511
598
  ### Security
@@ -127,7 +127,11 @@ module Rack
127
127
  unless data[1].empty?
128
128
  raise Error, "whitespace between boundary parameter name and equal sign"
129
129
  end
130
- if data.post_match.match?(/boundary\s*=/i)
130
+ # Count across the whole header rather than only after the match: the
131
+ # lazy prefix in MULTIPART can skip a first boundary parameter whose
132
+ # value is empty or starts with a quote, semicolon, or comma. Also
133
+ # count RFC 2231 boundary* parameters, which some parsers prefer.
134
+ if content_type.scan(/boundary(?:\*\d*\*?)?\s*=/i).size > 1
131
135
  raise BoundaryTooLongError, "multiple boundary parameters found in multipart content type"
132
136
  end
133
137
 
@@ -494,6 +498,7 @@ module Rack
494
498
  # buffering. Note that the actual limit is the higher of 64KB and the buffer size (1MB by default)
495
499
  raise Error, "multipart mime part header too large" if @sbuf.rest.bytesize > MIME_HEADER_BYTESIZE_LIMIT
496
500
 
501
+ @sbuf.string = @sbuf.rest
497
502
  return :want_read
498
503
  end
499
504
  end
@@ -514,8 +519,8 @@ module Rack
514
519
  update_retained_size(body.bytesize) if @body_retained
515
520
  @collector.on_mime_body @mime_index, body
516
521
  @sbuf.pos += delta
517
- @sbuf.string = @sbuf.rest
518
522
  end
523
+ @sbuf.string = @sbuf.rest
519
524
  :want_read
520
525
  end
521
526
  end
@@ -77,6 +77,7 @@ module Rack
77
77
  def method_missing(method_name, *args, &block) #:nodoc:
78
78
  @tempfile.__send__(method_name, *args, &block)
79
79
  end
80
+ ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
80
81
  end
81
82
  end
82
83
  end
data/lib/rack/request.rb CHANGED
@@ -325,8 +325,10 @@ module Rack
325
325
  end
326
326
 
327
327
  def host_with_port(authority = self.authority)
328
- host, _, port = split_authority(authority)
328
+ parts = split_authority(authority)
329
+ return nil if parts.empty?
329
330
 
331
+ host, _, port = parts
330
332
  if port == DEFAULT_PORTS[self.scheme]
331
333
  host
332
334
  else
@@ -592,7 +594,8 @@ module Rack
592
594
  end
593
595
 
594
596
  def base_url
595
- "#{scheme}://#{host_with_port}"
597
+ hostport = host_with_port || host_with_port(server_authority)
598
+ "#{scheme}://#{hostport}"
596
599
  end
597
600
 
598
601
  # Tries to return a remake of the original request URL as a string.
data/lib/rack/static.rb CHANGED
@@ -168,7 +168,7 @@ module Rack
168
168
 
169
169
  # Convert HTTP header rules to HTTP headers
170
170
  def applicable_rules(path)
171
- path = ::Rack::Utils.unescape_path(path)
171
+ path = ::Rack::Utils.clean_path_info(::Rack::Utils.unescape_path(path))
172
172
 
173
173
  @header_rules.find_all do |rule, new_headers|
174
174
  case rule
data/lib/rack/utils.rb CHANGED
@@ -146,8 +146,8 @@ module Rack
146
146
  end
147
147
  end
148
148
 
149
- ALLOWED_FORWARED_PARAMS = %w[by for host proto].to_h { |name| [name, name.to_sym] }.freeze
150
- private_constant :ALLOWED_FORWARED_PARAMS
149
+ ALLOWED_FORWARDED_PARAMS = %w[by for host proto].map { |name| [name, name.to_sym] }.to_h.freeze
150
+ private_constant :ALLOWED_FORWARDED_PARAMS
151
151
 
152
152
  def forwarded_values(forwarded_header)
153
153
  return unless forwarded_header
@@ -170,7 +170,7 @@ module Rack
170
170
  param.chomp!('=')
171
171
  param.strip!
172
172
  param.downcase!
173
- return unless param = ALLOWED_FORWARED_PARAMS[param]
173
+ return unless param = ALLOWED_FORWARDED_PARAMS[param]
174
174
 
175
175
  if header[0] == '"'
176
176
  # Parameter value is quoted, parse it, handling backslash escapes
data/lib/rack/version.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # See MIT-LICENSE or https://opensource.org/licenses/MIT.
7
7
 
8
8
  module Rack
9
- VERSION = "3.2.6"
9
+ VERSION = "3.2.8"
10
10
 
11
11
  RELEASE = VERSION
12
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.6
4
+ version: 3.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 4.0.6
159
+ rubygems_version: 4.0.10
160
160
  specification_version: 4
161
161
  summary: A modular Ruby webserver interface.
162
162
  test_files: []