rack 2.2.7 → 2.2.17

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: 9f923ec1a763c61e0a56fd1e54a81e588f0fc397c59d14c8b671f95280072f41
4
- data.tar.gz: 6fdfe8427a897c706fe136e1428e984a8c0997ad08134ebc5a8f81ee3156b614
3
+ metadata.gz: e5a64927e310e6bb3eff5b74ae3894d9c4592333d48615103e2dba14738ddc0a
4
+ data.tar.gz: 956fac8fbd0b4fb46777d005f853219651c5b19f12679c2a64545f62508f60e1
5
5
  SHA512:
6
- metadata.gz: 3365984fb627b727ccb7915037604aa22dca0d1bc5df50f9c58e58bf2e4849217ad0adb1c890332cc2b228c77ca466dc1c802eab89204859c4b7e4aa3d244c32
7
- data.tar.gz: 0f3f0d1ae09128f7f3c589978cdefc0ff614d07b4a10ce1748d9311cd62c3b9ce4ebb754084aa16900e052d98474be8479a76d56700edc3c17ac7d61562ee4b1
6
+ metadata.gz: f9a8fbea5c3a62dd839da7c022f78d5dc7e198f0de0a91b9efab5453e3124ecbe9cd802c14e88f2a92c217d7ffab9ca5afcd3a7ff09fee24e9576d3f9973b3b2
7
+ data.tar.gz: 6c3bb1fe9b3f8082af8d0d4def0d4237991008358a88832e8b0cd5216a688643e9f5013494d2dbd6634b6e1d3e63cf24266de6320f1e6cc292d79f1f6f58dc22
data/CHANGELOG.md CHANGED
@@ -2,6 +2,62 @@
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.17] - 2025-06-03
6
+
7
+ - Backport `Rack::MediaType#params` now handles parameters without values. ([#2263](https://github.com/rack/rack/pull/2263), [@AllyMarthaJ](https://github.com/AllyMarthaJ))
8
+
9
+ ## [2.2.16] - 2025-05-22
10
+
11
+ - Fix incorrect backport of optional `CGI::Cookie` support. ([#2335](https://github.com/rack/rack/pull/2335), [@jeremyevans])
12
+
13
+ ## [2.2.15] - 2025-05-18
14
+
15
+ - Optional support for `CGI::Cookie` if not available. ([#2327](https://github.com/rack/rack/pull/2327), [#2333](https://github.com/rack/rack/pull/2333), [@earlopain])
16
+
17
+ ## [2.2.14] - 2025-05-06
18
+
19
+ ### Security
20
+
21
+ - [CVE-2025-32441](https://github.com/rack/rack/security/advisories/GHSA-vpfw-47h7-xj4g) Rack session can be restored after deletion.
22
+ - [CVE-2025-46727](https://github.com/rack/rack/security/advisories/GHSA-gjh7-p2fx-99vx) Unbounded parameter parsing in `Rack::QueryParser` can lead to memory exhaustion.
23
+
24
+ ## [2.2.13] - 2025-03-11
25
+
26
+ ### Security
27
+
28
+ - [CVE-2025-27610](https://github.com/rack/rack/security/advisories/GHSA-7wqh-767x-r66v) Local file inclusion in `Rack::Static`.
29
+
30
+ ## [2.2.12] - 2025-03-04
31
+
32
+ ### Security
33
+
34
+ - [CVE-2025-27111](https://github.com/rack/rack/security/advisories/GHSA-8cgq-6mh2-7j6v) Possible Log Injection in `Rack::Sendfile`.
35
+
36
+ ## [2.2.11] - 2025-02-12
37
+
38
+ ### Security
39
+
40
+ - [CVE-2025-25184](https://github.com/rack/rack/security/advisories/GHSA-7g2v-jj9q-g3rg) Possible Log Injection in `Rack::CommonLogger`.
41
+
42
+ ## [2.2.10] - 2024-10-14
43
+
44
+ - Fix compatibility issues with Ruby v3.4.0. ([#2248](https://github.com/rack/rack/pull/2248), [@byroot](https://github.com/byroot))
45
+
46
+ ## [2.2.9] - 2023-03-21
47
+
48
+ - Return empty when parsing a multi-part POST with only one end delimiter. ([#2104](https://github.com/rack/rack/pull/2104), [@alpaca-tc])
49
+
50
+ ## [2.2.8] - 2023-07-31
51
+
52
+ - Regenerate SPEC ([#2102](https://github.com/rack/rack/pull/2102), [@skipkayhil](https://github.com/skipkayhil))
53
+ - Limit file extension length of multipart tempfiles ([#2015](https://github.com/rack/rack/pull/2015), [@dentarg](https://github.com/dentarg))
54
+ - 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))
55
+
56
+ ## [2.2.7] - 2023-03-13
57
+
58
+ - Correct the year number in the changelog ([#2015](https://github.com/rack/rack/pull/2015), [@kimulab](https://github.com/kimulab))
59
+ - Support underscore in host names for Rack 2.2 (Fixes [#2070](https://github.com/rack/rack/issues/2070)) ([#2015](https://github.com/rack/rack/pull/2071), [@jeremyevans](https://github.com/jeremyevans))
60
+
5
61
  ## [2.2.6.4] - 2023-03-13
6
62
 
7
63
  - [CVE-2023-27539] Avoid ReDoS in header parsing
@@ -733,3 +789,7 @@ Items below this line are from the previously maintained HISTORY.md and NEWS.md
733
789
  - Removed Rails adapter, was too alpha.
734
790
 
735
791
  ## [0.1] 2007-03-03
792
+
793
+ [@ioquatix]: https://github.com/ioquatix "Samuel Williams"
794
+ [@jeremyevans]: https://github.com/jeremyevans "Jeremy Evans"
795
+ [@earlopain]: https://github.com/earlopain "Earlopain"
data/README.rdoc CHANGED
@@ -179,6 +179,33 @@ e.g:
179
179
 
180
180
  Rack::Utils.key_space_limit = 128
181
181
 
182
+ === `RACK_QUERY_PARSER_BYTESIZE_LIMIT`
183
+
184
+ This environment variable sets the default for the maximum query string bytesize
185
+ that `Rack::QueryParser` will attempt to parse. Attempts to use a query string
186
+ that exceeds this number of bytes will result in a
187
+ `Rack::QueryParser::QueryLimitError` exception. If this enviroment variable is
188
+ provided, it must be an integer, or `Rack::QueryParser` will raise an exception.
189
+
190
+ The default limit can be overridden on a per-`Rack::QueryParser` basis using
191
+ the `bytesize_limit` keyword argument when creating the `Rack::QueryParser`.
192
+
193
+ === `RACK_QUERY_PARSER_PARAMS_LIMIT`
194
+
195
+ This environment variable sets the default for the maximum number of query
196
+ parameters that `Rack::QueryParser` will attempt to parse. Attempts to use a
197
+ query string with more than this many query parameters will result in a
198
+ `Rack::QueryParser::QueryLimitError` exception. If this enviroment variable is
199
+ provided, it must be an integer, or `Rack::QueryParser` will raise an exception.
200
+
201
+ The default limit can be overridden on a per-`Rack::QueryParser` basis using
202
+ the `params_limit` keyword argument when creating the `Rack::QueryParser`.
203
+
204
+ This is implemented by counting the number of parameter separators in the
205
+ query string, before attempting parsing, so if the same parameter key is
206
+ used multiple times in the query, each counts as a separate parameter for
207
+ this check.
208
+
182
209
  === key_space_limit
183
210
 
184
211
  The default number of bytes to allow all parameters keys in a given parameter hash to take up.
data/SPEC.rdoc CHANGED
@@ -42,17 +42,18 @@ below.
42
42
  <tt>QUERY_STRING</tt>:: The portion of the request URL that
43
43
  follows the <tt>?</tt>, if any. May be
44
44
  empty, but is always required!
45
- <tt>SERVER_NAME</tt>, <tt>SERVER_PORT</tt>::
46
- When combined with <tt>SCRIPT_NAME</tt> and
45
+ <tt>SERVER_NAME</tt>:: When combined with <tt>SCRIPT_NAME</tt> and
47
46
  <tt>PATH_INFO</tt>, these variables can be
48
47
  used to complete the URL. Note, however,
49
48
  that <tt>HTTP_HOST</tt>, if present,
50
49
  should be used in preference to
51
50
  <tt>SERVER_NAME</tt> for reconstructing
52
51
  the request URL.
53
- <tt>SERVER_NAME</tt> and <tt>SERVER_PORT</tt>
54
- can never be empty strings, and so
55
- are always required.
52
+ <tt>SERVER_NAME</tt> can never be an empty
53
+ string, and so is always required.
54
+ <tt>SERVER_PORT</tt>:: An optional +Integer+ which is the port the
55
+ server is running on. Should be specified if
56
+ the server is running on a non-standard port.
56
57
  <tt>HTTP_</tt> Variables:: Variables corresponding to the
57
58
  client-supplied HTTP request
58
59
  headers (i.e., variables whose
@@ -122,6 +123,9 @@ and should be prefixed uniquely. The prefix <tt>rack.</tt>
122
123
  is reserved for use with the Rack core distribution and other
123
124
  accepted specifications and must not be used otherwise.
124
125
 
126
+ The <tt>SERVER_PORT</tt> must be an Integer if set.
127
+ The <tt>SERVER_NAME</tt> must be a valid authority as defined by RFC7540.
128
+ The <tt>HTTP_HOST</tt> must be a valid authority as defined by RFC7540.
125
129
  The environment must not contain the keys
126
130
  <tt>HTTP_CONTENT_TYPE</tt> or <tt>HTTP_CONTENT_LENGTH</tt>
127
131
  (use the versions without <tt>HTTP_</tt>).
@@ -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