rack 3.2.4 → 3.2.5

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: 3c8830e7467cbfb11b649492479a89660919c738ea98d4903215d413b981c0ab
4
- data.tar.gz: 9b5ffea244da69c22d243ebb9a8779f5b38fbe014f5a6992f181c17c2939f198
3
+ metadata.gz: dcab43418ebec9227dad4a8e8fbfeb403097a3c34bcebc63a230350984c68ab9
4
+ data.tar.gz: 6b82c8e25fa9bc835cfe24a05da9731bd9a0654b40a56a01c6f77ac7fc7029f4
5
5
  SHA512:
6
- metadata.gz: 604e146a609767332da5dea6f4aef3e9a5dd41b15577a2fa91c6b56fccaf705f0e37b86e11532e252e1c2a70e5950e2c6a59b6d7daddd7de84f33c1946615f18
7
- data.tar.gz: e1c4d36619ab862546301ce9bcd722e1a432d04d2c39988acf6df636936a1d855b75e133381af683f2a2bb4a8a9b908a2594db68cc6246dfa2d38f1f0956a71a
6
+ metadata.gz: a727df6903901d26a8d4e031302cb0c5b45134b9e31b2443b6e4d4a595233f4d18d58ff265cafbd9e344e4b7958fd3d27b6e46d57c6f37c9744617da8eba6db4
7
+ data.tar.gz: 8c914906cc9c4d0610ab8dc0de815cb714311261dc50ef6d1a6c1b5ecacd9d3f58e477014176a0044dd1f1dd24ecc55554eb6eebe78995205bd6c47bee83d9eb
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
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
+ ## Unreleased
6
+
7
+ ### Security
8
+
9
+ - [CVE-2026-25500](https://github.com/advisories/GHSA-whrj-4476-wvmp) XSS injection via malicious filename in `Rack::Directory`.
10
+ - [CVE-2026-22860](https://github.com/advisories/GHSA-mxw3-3hh2-x2mh) Directory traversal via root prefix bypass in `Rack::Directory`.
11
+
12
+ ### Fixed
13
+
14
+ - Fix `Rack::MockResponse#body` when the body is a Proc. ([#2420](https://github.com/rack/rack/pull/2420), [#2423](https://github.com/rack/rack/pull/2423), [@tavianator](https://github.com/tavianator), [@ioquatix])
15
+
5
16
  ## [3.2.4] - 2025-11-03
6
17
 
7
18
  ### Fixed
@@ -17,7 +17,7 @@ module Rack
17
17
  # If +app+ is not specified, a Rack::Files of the same +root+ will be used.
18
18
 
19
19
  class Directory
20
- DIR_FILE = "<tr><td class='name'><a href='%s'>%s</a></td><td class='size'>%s</td><td class='type'>%s</td><td class='mtime'>%s</td></tr>\n"
20
+ DIR_FILE = "<tr><td class='name'><a href='./%s'>%s</a></td><td class='size'>%s</td><td class='type'>%s</td><td class='mtime'>%s</td></tr>\n"
21
21
  DIR_PAGE_HEADER = <<-PAGE
22
22
  <html><head>
23
23
  <title>%s</title>
@@ -82,6 +82,7 @@ table { width:100%%; }
82
82
  # Set the root directory and application for serving files.
83
83
  def initialize(root, app = nil)
84
84
  @root = ::File.expand_path(root)
85
+ @root_with_separator = @root.end_with?(::File::SEPARATOR) ? @root : "#{@root}#{::File::SEPARATOR}"
85
86
  @app = app || Files.new(@root)
86
87
  @head = Head.new(method(:get))
87
88
  end
@@ -118,7 +119,9 @@ table { width:100%%; }
118
119
  # Rack response to use for requests with paths outside the root, or nil if path is inside the root.
119
120
  def check_forbidden(path_info)
120
121
  return unless path_info.include? ".."
121
- return if ::File.expand_path(::File.join(@root, path_info)).start_with?(@root)
122
+
123
+ expanded_path = ::File.expand_path(::File.join(@root, path_info))
124
+ return if expanded_path == @root || expanded_path.start_with?(@root_with_separator)
122
125
 
123
126
  body = "Forbidden\n"
124
127
  [403, { CONTENT_TYPE => "text/plain",
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'stringio'
3
4
  require 'time'
4
5
 
5
6
  require_relative 'response'
@@ -82,8 +83,16 @@ module Rack
82
83
  # end
83
84
  buffer = @buffered_body = String.new
84
85
 
85
- @body.each do |chunk|
86
- buffer << chunk
86
+ begin
87
+ if @body.respond_to?(:each)
88
+ @body.each do |chunk|
89
+ buffer << chunk
90
+ end
91
+ else
92
+ @body.call(StringIO.new(buffer))
93
+ end
94
+ ensure
95
+ @body.close if @body.respond_to?(:close)
87
96
  end
88
97
 
89
98
  return buffer
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.4"
9
+ VERSION = "3.2.5"
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.4
4
+ version: 3.2.5
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: 3.6.9
159
+ rubygems_version: 4.0.3
160
160
  specification_version: 4
161
161
  summary: A modular Ruby webserver interface.
162
162
  test_files: []