puma 8.0.1-java → 8.0.2-java

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: 1a38c45e1b22ea99d68806acf6531c365c9cf133bb313519110ed89edaffe5a9
4
- data.tar.gz: 5f192c72add0cd60e50af737f6da9ef8ef8ca5562d2a0000f58a49c7200fbbd3
3
+ metadata.gz: ccf5cdd3f952f6ea55feda29b8899a36cc64ce8ecb5c79bb981f0450b7a74962
4
+ data.tar.gz: c0094d7ac6edb28c93ad7354b719fbd337278ff743f7b7ea7a4268736e12e70d
5
5
  SHA512:
6
- metadata.gz: 5145a289341bde05e061cc6cca6896aaa7ad07ed6b2f46f0c824236b1787490265d91ff84e9d1f9a701b279efac5a4345f30c912943334f831787209a72eb4cf
7
- data.tar.gz: 8d0cb9f0310aa6adbcdf5c44d3507a15e0a0dfaa4cc068decb63ff92ad95895a7cad5476a4f38f324abf0dd5e5d8496845c30b59ac1a92100e06bf60c558e0e1
6
+ metadata.gz: 6e371849168d7a0f5ba1d88c12083a7aec0c8530e518251da1d077bc90af3cccdd1fbf43c7166881a8e8a87e5b5ffdef9782cf863907bf9c2dae5ba4c6010d52
7
+ data.tar.gz: e85bb20d08fbdf474558b0abb8cead8de3e4a26373134c19872eb9eb8850ee92fd42c09987777c535cf6bcd50f1f2f7622282277ef36aaab6cce7d792a354e71
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
- if @buffer.include? "\r\n"
217
- if md = PROXY_PROTOCOL_V1_REGEX.match(@buffer)
218
- if md[1]
219
- @peerip = md[1].split(" ")[0]
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
- @buffer = md.post_match
225
+ return false
222
226
  end
223
- # if the buffer has a \r\n but doesn't have a PROXY protocol
224
- # request, this is just HTTP from a non-PROXY client; move on
227
+
225
228
  @read_proxy = false
226
- return @buffer.size > 0
227
- else
228
- return false
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.1"
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 = /^PROXY (?:TCP4|TCP6|UNKNOWN) ([^\r]+)\r\n/.freeze
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.1
4
+ version: 8.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix