puma 8.0.1 → 8.0.2
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 +4 -4
- data/History.md +7 -0
- data/lib/puma/client.rb +27 -11
- data/lib/puma/const.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c96b9615e3021ca787fdb02a91af1bcfc2c2201465efd375e94c0100d089ece
|
|
4
|
+
data.tar.gz: 620a8240509ff2acbac19e20b4d8f55aa7cef0b6fb8bef0836f31c848b9def67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88e2c0146d21143793a559dbb515ce22866266a5750acd0e55c9d84bbc41c536341e3602b34d4e192dad265102bc6bd93b0e300d1ee60806482aa9ba67e59e29
|
|
7
|
+
data.tar.gz: 6f5d132d87d2b78a3b240eec1029f7eab30ce22f5de1dfcbc1ba0bc2d253655b58594bd1104def34cb169a56aef4642666267dcadb347f2381e63179dddf1946
|
data/History.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 8.0.2 / 2026-05-27
|
|
2
|
+
|
|
3
|
+
* Bugfixes
|
|
4
|
+
* Anchor PROXY protocol v1 regex to string start and enforce max line length to prevent injection via crafted request bodies ([#3944])
|
|
5
|
+
* Parse PROXY protocol header only on the first request per connection to prevent spoofing on keep-alive connections ([#3944])
|
|
6
|
+
|
|
1
7
|
## 8.0.1 / 2026-04-27
|
|
2
8
|
|
|
3
9
|
* Bugfixes
|
|
@@ -2335,6 +2341,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
|
2335
2341
|
* Bugfixes
|
|
2336
2342
|
* Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
|
|
2337
2343
|
|
|
2344
|
+
[#3944]:https://github.com/puma/puma/pull/3944 "PR by Nate Berkopec, merged 2026-05-26"
|
|
2338
2345
|
[#3929]:https://github.com/puma/puma/pull/3929 "PR by Joshua Young, merged 2026-04-26"
|
|
2339
2346
|
[#3928]:https://github.com/puma/puma/pull/3928 "PR by Nate Berkopec, merged 2026-04-16"
|
|
2340
2347
|
[#3923]:https://github.com/puma/puma/pull/3923 "PR by Joshua Young, merged 2026-04-10"
|
data/lib/puma/client.rb
CHANGED
|
@@ -163,7 +163,7 @@ module Puma
|
|
|
163
163
|
@parser.reset
|
|
164
164
|
@io_buffer.reset
|
|
165
165
|
@read_header = true
|
|
166
|
-
@read_proxy = !!@expect_proxy_proto
|
|
166
|
+
@read_proxy = !!@expect_proxy_proto && @requests_served.zero?
|
|
167
167
|
@env = @proto_env.dup
|
|
168
168
|
@parsed_bytes = 0
|
|
169
169
|
@ready = false
|
|
@@ -213,20 +213,36 @@ module Puma
|
|
|
213
213
|
def try_to_parse_proxy_protocol
|
|
214
214
|
if @read_proxy
|
|
215
215
|
if @expect_proxy_proto == :v1
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
crlf_index = @buffer.index "\r\n"
|
|
217
|
+
|
|
218
|
+
unless crlf_index
|
|
219
|
+
if "PROXY ".start_with? @buffer
|
|
220
|
+
return false
|
|
221
|
+
elsif @buffer.start_with? "PROXY "
|
|
222
|
+
if @buffer.bytesize >= PROXY_PROTOCOL_V1_MAX_LENGTH
|
|
223
|
+
raise ConnectionError, "PROXY protocol v1 line is too long"
|
|
220
224
|
end
|
|
221
|
-
|
|
225
|
+
return false
|
|
222
226
|
end
|
|
223
|
-
|
|
224
|
-
# request, this is just HTTP from a non-PROXY client; move on
|
|
227
|
+
|
|
225
228
|
@read_proxy = false
|
|
226
|
-
return
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
return true
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
if @buffer.start_with?("PROXY ") && crlf_index + 2 > PROXY_PROTOCOL_V1_MAX_LENGTH
|
|
233
|
+
raise ConnectionError, "PROXY protocol v1 line is too long"
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
if md = PROXY_PROTOCOL_V1_REGEX.match(@buffer)
|
|
237
|
+
if md[1]
|
|
238
|
+
@peerip = md[1].split(" ")[0]
|
|
239
|
+
end
|
|
240
|
+
@buffer = md.post_match
|
|
229
241
|
end
|
|
242
|
+
# if the buffer has a \r\n but doesn't have a PROXY protocol
|
|
243
|
+
# request, this is just HTTP from a non-PROXY client; move on
|
|
244
|
+
@read_proxy = false
|
|
245
|
+
return @buffer.size > 0
|
|
230
246
|
end
|
|
231
247
|
end
|
|
232
248
|
true
|
data/lib/puma/const.rb
CHANGED
|
@@ -100,7 +100,7 @@ module Puma
|
|
|
100
100
|
# too taxing on performance.
|
|
101
101
|
module Const
|
|
102
102
|
|
|
103
|
-
PUMA_VERSION = VERSION = "8.0.
|
|
103
|
+
PUMA_VERSION = VERSION = "8.0.2"
|
|
104
104
|
CODE_NAME = "Into the Arena"
|
|
105
105
|
|
|
106
106
|
PUMA_SERVER_STRING = ["puma", PUMA_VERSION, CODE_NAME].join(" ").freeze
|
|
@@ -291,7 +291,8 @@ module Puma
|
|
|
291
291
|
# Banned keys of response header
|
|
292
292
|
BANNED_HEADER_KEY = /\A(rack\.|status\z)/.freeze
|
|
293
293
|
|
|
294
|
-
PROXY_PROTOCOL_V1_REGEX =
|
|
294
|
+
PROXY_PROTOCOL_V1_REGEX = /\APROXY (?:TCP4|TCP6|UNKNOWN) ([^\r]+)\r\n/.freeze
|
|
295
|
+
PROXY_PROTOCOL_V1_MAX_LENGTH = 107
|
|
295
296
|
|
|
296
297
|
# All constants are prefixed with `PIPE_` to avoid name collisions.
|
|
297
298
|
module PipeRequest
|