rack 3.1.22 → 3.1.23

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: f3f9b36f03c948233dee682ef0a4724302be7f64dee1b599d45c7ef4068c6b0c
4
- data.tar.gz: 428c57448bdc479dd1bab423ff9df7376e660a9603b648de733c7c08ae186693
3
+ metadata.gz: 0eea0a8704e9041b0816ff683feadf99a2f94106884de54455550b427f437981
4
+ data.tar.gz: 72e7f3f74af13b783cb4ad583301092c0ccb19b8245a72fe9c1ed38351c8067f
5
5
  SHA512:
6
- metadata.gz: f25b66f8c806f983f6ec504f5c97ffeec03d1994d8ba508763fb903923c28a9d6a85feab7bba9f6da248e90ef6697dabda9da32ea62d3935259ea4e963ad79d2
7
- data.tar.gz: 2cc6a87b8003ed98a246913322e266e83e7c3cd1247e27e2540dbed28910cfef76c34dbd635f26da547817f2136d87468be6b3c98566c627fbf9b854f51cce62
6
+ metadata.gz: fd22ed0b602803fce4cc4a4b00e3e055f5dafc7b9ef8925d4c2d9fb7eed1c5ee27eec1a06001b08dd560e62074dd9a6f7dffcc70b1229eebae81648be8914f9f
7
+ data.tar.gz: 4563c28eaa11ff0a607c8f1d31a8b9483fd1d9b0b9ca55d684bea8bf52e50d72519ec062d130921108b115537e6738792645307718f20c7ec8b9a8e563166811
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
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.1.23] - 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
+
5
14
  ## [3.1.22] - 2026-08-13
6
15
 
7
16
  ### Security
@@ -115,7 +115,11 @@ module Rack
115
115
  unless data[1].empty?
116
116
  raise Error, "whitespace between boundary parameter name and equal sign"
117
117
  end
118
- if data.post_match.match?(/boundary\s*=/i)
118
+ # Count across the whole header rather than only after the match: the
119
+ # lazy prefix in MULTIPART can skip a first boundary parameter whose
120
+ # value is empty or starts with a quote, semicolon, or comma. Also
121
+ # count RFC 2231 boundary* parameters, which some parsers prefer.
122
+ if content_type.scan(/boundary(?:\*\d*\*?)?\s*=/i).size > 1
119
123
  raise BoundaryTooLongError, "multiple boundary parameters found in multipart content type"
120
124
  end
121
125
 
@@ -485,6 +489,7 @@ module Rack
485
489
  # buffering. Note that the actual limit is the higher of 64KB and the buffer size (1MB by default)
486
490
  raise Error, "multipart mime part header too large" if @sbuf.rest.bytesize > MIME_HEADER_BYTESIZE_LIMIT
487
491
 
492
+ @sbuf.string = @sbuf.rest
488
493
  return :want_read
489
494
  end
490
495
  end
@@ -505,8 +510,8 @@ module Rack
505
510
  update_retained_size(body.bytesize) if @body_retained
506
511
  @collector.on_mime_body @mime_index, body
507
512
  @sbuf.pos += delta
508
- @sbuf.string = @sbuf.rest
509
513
  end
514
+ @sbuf.string = @sbuf.rest
510
515
  :want_read
511
516
  end
512
517
  end
data/lib/rack/request.rb CHANGED
@@ -320,8 +320,10 @@ module Rack
320
320
  end
321
321
 
322
322
  def host_with_port(authority = self.authority)
323
- host, _, port = split_authority(authority)
323
+ parts = split_authority(authority)
324
+ return nil if parts.empty?
324
325
 
326
+ host, _, port = parts
325
327
  if port == DEFAULT_PORTS[self.scheme]
326
328
  host
327
329
  else
@@ -591,7 +593,8 @@ module Rack
591
593
  end
592
594
 
593
595
  def base_url
594
- "#{scheme}://#{host_with_port}"
596
+ hostport = host_with_port || host_with_port(server_authority)
597
+ "#{scheme}://#{hostport}"
595
598
  end
596
599
 
597
600
  # 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
@@ -12,7 +12,7 @@
12
12
  # so it should be enough just to <tt>require 'rack'</tt> in your code.
13
13
 
14
14
  module Rack
15
- RELEASE = "3.1.22"
15
+ RELEASE = "3.1.23"
16
16
 
17
17
  # Return the Rack release as a dotted string.
18
18
  def self.release
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.1.22
4
+ version: 3.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen