rack 3.2.7 → 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: 0b014fbf1db40db15c30606f5c150bdbdb15f55c5ff15f74474e9aa690c750c7
4
- data.tar.gz: d2b99b05d8bcc088ba88373dce20615e7f6bd027f19e718fb6bd2f92518ba80f
3
+ metadata.gz: 57fe61378c6650847203c66b4d5597dadee788d07e9178bb38d89de37ce91f8a
4
+ data.tar.gz: 5cb0747f5ce457a10d836fed60259ab7f7ae37fe33b9c164c2cf201b4d58d306
5
5
  SHA512:
6
- metadata.gz: ab6284c2a463d710f7fcd32366220f8ba61c188810b726846108ad742af5b99ce6430ad880571debac3fb7539e2cb701da74eed468a2393f3398c7d06d0fcd89
7
- data.tar.gz: cb55817f309d78e138365a755ecbcf2f5fd32a285b702f1a69e356e53685b841914d7e8ee9467b1daf7a58c0d90bac9b3066f25fce2af3501161c6d88a5d99c1
6
+ metadata.gz: 4f28e8f049827ce264fcd4845adfad131796e3e1d18d036fc22bbbd68db80800bf124b0324f59ccc098c9bfb0b59a0ecb8ec1d75d22727896681b591b0a68794
7
+ data.tar.gz: 3dcb3e16c41b6c95e06a35d282e9c35ebc7b26a31505be8beb3d17582bfd8a2e182ca132c8e4f1122f15122581165b8cd3337e943c150247d3c577686913f541
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
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
+
5
18
  ## [3.2.7] - 2026-08-13
6
19
 
7
20
  ### Fixed
@@ -115,6 +128,15 @@ This release continues Rack's evolution toward a cleaner, more efficient foundat
115
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])
116
129
  - `Rack::Lint` now disallows `PATH_INFO="" SCRIPT_NAME=""`. ([#2298](https://github.com/rack/rack/issues/2307), [@jeremyevans])
117
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
+
118
140
  ## [3.1.22] - 2026-08-13
119
141
 
120
142
  ### Security
@@ -539,6 +561,18 @@ This release introduces major improvements to Rack, including enhanced support f
539
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))
540
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))
541
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
+
542
576
  ## [2.2.24] - 2026-08-13
543
577
 
544
578
  ### 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/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.7"
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.7
4
+ version: 3.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen