rack 2.2.8.1 → 2.2.13

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: 7707e75748cda81d20950b3a934018fdc136c5e4c9b551911bdb993418adf31c
4
- data.tar.gz: 7a87520904eb86c7e1761d2895e0ed3c11bb2bded7cbd7d716e75488e27f9b37
3
+ metadata.gz: '09a6d038df42d0af44940110fca3a8f9eb37a56a2acea9f1ad02f6fc39c685a9'
4
+ data.tar.gz: d4a25103cf82081f357f621ee9a44027a799cda9c566f1ad4ffff3ec9d45a603
5
5
  SHA512:
6
- metadata.gz: c38c9c18ec842262eeb25e1c06bbfe0c6b7ef5f74ee43f9952105a53e96d9dfaead4c0786a0a9f2bb999004d45d738e05104b9e3c612f16b35a30b6441afa2e6
7
- data.tar.gz: 890b77739013bc80a83a74c2ecc112dfdd8a68a090d831f7ca3ea5106cf5cad1d61baf4df0c2d39bef3cb3b37e1bb30f44109d8e85ceded57345611090f85a75
6
+ metadata.gz: 6324e627506aa9605cab9ad4778303ccb24dffa41d2877e5a9008813556f84cc4660f2638fa00431b36a23cac528c81fa23884d21e907f56370634a67f94070c
7
+ data.tar.gz: bc7cabae2f718457165de32fa8905028d0cbb85bcfe150ac2a7871e78ad57b3651d1881aedfc9a366fb9aa11ca009a1344e180ad2c470f1792b4e2befb629034
data/CHANGELOG.md CHANGED
@@ -2,6 +2,38 @@
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.13] - 2025-03-11
6
+
7
+ ### Security
8
+
9
+ - [CVE-2025-27610](https://github.com/rack/rack/security/advisories/GHSA-7wqh-767x-r66v) Local file inclusion in `Rack::Static`.
10
+
11
+ ## [2.2.12] - 2025-03-04
12
+
13
+ ### Security
14
+
15
+ - [CVE-2025-27111](https://github.com/rack/rack/security/advisories/GHSA-8cgq-6mh2-7j6v) Possible Log Injection in `Rack::Sendfile`.
16
+
17
+ ## [2.2.11] - 2025-02-12
18
+
19
+ ### Security
20
+
21
+ - [CVE-2025-25184](https://github.com/rack/rack/security/advisories/GHSA-7g2v-jj9q-g3rg) Possible Log Injection in `Rack::CommonLogger`.
22
+
23
+ ## [2.2.10] - 2024-10-14
24
+
25
+ - Fix compatibility issues with Ruby v3.4.0. ([#2248](https://github.com/rack/rack/pull/2248), [@byroot](https://github.com/byroot))
26
+
27
+ ## [2.2.9] - 2023-03-21
28
+
29
+ - Return empty when parsing a multi-part POST with only one end delimiter. ([#2104](https://github.com/rack/rack/pull/2104), [@alpaca-tc])
30
+
31
+ ## [2.2.8] - 2023-07-31
32
+
33
+ - Regenerate SPEC ([#2102](https://github.com/rack/rack/pull/2102), [@skipkayhil](https://github.com/skipkayhil))
34
+ - Limit file extension length of multipart tempfiles ([#2015](https://github.com/rack/rack/pull/2015), [@dentarg](https://github.com/dentarg))
35
+ - Fix "undefined method DelegateClass for Rack::Session::Cookie:Class" ([#2092](https://github.com/rack/rack/pull/2092), [@onigra](https://github.com/onigra) [@dchandekstark](https://github.com/dchandekstark))
36
+
5
37
  ## [2.2.7] - 2023-03-13
6
38
 
7
39
  - Correct the year number in the changelog ([#2015](https://github.com/rack/rack/pull/2015), [@kimulab](https://github.com/kimulab))
@@ -2,7 +2,6 @@
2
2
 
3
3
  require_relative 'abstract/handler'
4
4
  require_relative 'abstract/request'
5
- require 'base64'
6
5
 
7
6
  module Rack
8
7
  module Auth
@@ -48,7 +47,7 @@ module Rack
48
47
  end
49
48
 
50
49
  def credentials
51
- @credentials ||= Base64.decode64(params).split(':', 2)
50
+ @credentials ||= params.unpack("m").first.split(':', 2)
52
51
  end
53
52
 
54
53
  def username
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'digest/md5'
4
- require 'base64'
5
4
 
6
5
  module Rack
7
6
  module Auth
@@ -21,7 +20,7 @@ module Rack
21
20
  end
22
21
 
23
22
  def self.parse(string)
24
- new(*Base64.decode64(string).split(' ', 2))
23
+ new(*string.unpack("m").first.split(' ', 2))
25
24
  end
26
25
 
27
26
  def initialize(timestamp = Time.now, given_digest = nil)
@@ -29,7 +28,7 @@ module Rack
29
28
  end
30
29
 
31
30
  def to_s
32
- Base64.encode64("#{@timestamp} #{digest}").strip
31
+ ["#{@timestamp} #{digest}"].pack("m").strip
33
32
  end
34
33
 
35
34
  def digest
@@ -15,7 +15,7 @@ module Rack
15
15
  # The actual format is slightly different than the above due to the
16
16
  # separation of SCRIPT_NAME and PATH_INFO, and because the elapsed
17
17
  # time in seconds is included at the end.
18
- FORMAT = %{%s - %s [%s] "%s %s%s%s %s" %d %s %0.4f\n}
18
+ FORMAT = %{%s - %s [%s] "%s %s%s%s %s" %d %s %0.4f }
19
19
 
20
20
  # +logger+ can be any object that supports the +write+ or +<<+ methods,
21
21
  # which includes the standard library Logger. These methods are called
@@ -60,7 +60,8 @@ module Rack
60
60
  length,
61
61
  Utils.clock_time - began_at ]
62
62
 
63
- msg.gsub!(/[^[:print:]\n]/) { |c| "\\x#{c.ord}" }
63
+ msg.gsub!(/[^[:print:]]/) { |c| sprintf("\\x%x", c.ord) }
64
+ msg[-1] = "\n"
64
65
 
65
66
  logger = @logger || env[RACK_ERRORS]
66
67
 
@@ -191,6 +191,7 @@ module Rack
191
191
 
192
192
  @sbuf = StringScanner.new("".dup)
193
193
  @body_regex = /(?:#{EOL})?#{Regexp.quote(@boundary)}(?:#{EOL}|--)/m
194
+ @end_boundary_size = boundary.bytesize + 6 # (-- at start, -- at finish, EOL at end)
194
195
  @rx_max_size = EOL.size + @boundary.bytesize + [EOL.size, '--'.size].max
195
196
  @head_regex = /(.*?#{EOL})#{EOL}/m
196
197
  end
@@ -231,7 +232,12 @@ module Rack
231
232
  end
232
233
 
233
234
  def handle_fast_forward
234
- if consume_boundary
235
+ tok = consume_boundary
236
+
237
+ if tok == :END_BOUNDARY && @sbuf.pos == @end_boundary_size && @sbuf.eos?
238
+ # stop parsing a buffer if a buffer is only an end boundary.
239
+ @state = :DONE
240
+ elsif tok
235
241
  @state = :MIME_HEAD
236
242
  else
237
243
  raise EOFError, "bad content body" if @sbuf.rest_size >= @bufsize
data/lib/rack/sendfile.rb CHANGED
@@ -133,7 +133,7 @@ module Rack
133
133
  end
134
134
  when '', nil
135
135
  else
136
- env[RACK_ERRORS].puts "Unknown x-sendfile variation: '#{type}'.\n"
136
+ env[RACK_ERRORS].puts "Unknown x-sendfile variation: #{type.inspect}"
137
137
  end
138
138
  end
139
139
  [status, headers, body]
@@ -4,7 +4,6 @@ require 'openssl'
4
4
  require 'zlib'
5
5
  require_relative 'abstract/id'
6
6
  require 'json'
7
- require 'base64'
8
7
  require 'delegate'
9
8
 
10
9
  module Rack
@@ -51,11 +50,11 @@ module Rack
51
50
  # Encode session cookies as Base64
52
51
  class Base64
53
52
  def encode(str)
54
- ::Base64.strict_encode64(str)
53
+ [str].pack("m0")
55
54
  end
56
55
 
57
56
  def decode(str)
58
- ::Base64.decode64(str)
57
+ str.unpack("m").first
59
58
  end
60
59
 
61
60
  # Encode session cookies as Marshaled Base64 data
data/lib/rack/static.rb CHANGED
@@ -122,8 +122,9 @@ module Rack
122
122
 
123
123
  def call(env)
124
124
  path = env[PATH_INFO]
125
+ actual_path = Utils.clean_path_info(Utils.unescape_path(path))
125
126
 
126
- if can_serve(path)
127
+ if can_serve(actual_path)
127
128
  if overwrite_file_path(path)
128
129
  env[PATH_INFO] = (add_index_root?(path) ? path + @index : @urls[path])
129
130
  elsif @gzip && env['HTTP_ACCEPT_ENCODING'] && /\bgzip\b/.match?(env['HTTP_ACCEPT_ENCODING'])
data/lib/rack/utils.rb CHANGED
@@ -24,6 +24,7 @@ module Rack
24
24
 
25
25
  RFC2822_DAY_NAME = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
26
26
  RFC2822_MONTH_NAME = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
27
+ RFC2396_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
27
28
 
28
29
  class << self
29
30
  attr_accessor :default_query_parser
@@ -42,13 +43,13 @@ module Rack
42
43
  # Like URI escaping, but with %20 instead of +. Strictly speaking this is
43
44
  # true URI escaping.
44
45
  def escape_path(s)
45
- ::URI::DEFAULT_PARSER.escape s
46
+ RFC2396_PARSER.escape s
46
47
  end
47
48
 
48
49
  # Unescapes the **path** component of a URI. See Rack::Utils.unescape for
49
50
  # unescaping query parameters or form components.
50
51
  def unescape_path(s)
51
- ::URI::DEFAULT_PARSER.unescape s
52
+ RFC2396_PARSER.unescape s
52
53
  end
53
54
 
54
55
  # Unescapes a URI escaped string with +encoding+. +encoding+ will be the
@@ -381,7 +382,7 @@ module Rack
381
382
  ranges << (r0..r1) if r0 <= r1
382
383
  end
383
384
 
384
- return [] if ranges.map(&:size).sum > size
385
+ return [] if ranges.map(&:size).inject(0, :+) > size
385
386
 
386
387
  ranges
387
388
  end
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.8.1"
23
+ RELEASE = "2.2.13"
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.8.1
4
+ version: 2.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-02-21 00:00:00.000000000 Z
10
+ date: 2025-03-10 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: minitest
@@ -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.4.10
188
- signing_key:
185
+ rubygems_version: 3.6.2
189
186
  specification_version: 4
190
187
  summary: A modular Ruby webserver interface.
191
188
  test_files: []