puma 6.3.0 → 6.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fee07e30f79d6f40104c1265c78bba2ba7f91cd6aff53d4df7d7bcbe62f052da
4
- data.tar.gz: 3f3d8d6107481ffc4e545c7f976ec3480c2c5876a4ba8b7c50e1f7b5a7b3d286
3
+ metadata.gz: dcbde9283993550beb848a4f777bf9d33a1e163f5356cfeeb40be3eede72e7d0
4
+ data.tar.gz: 5394fdd8307e5a1fd40c7cf560d01565a6a9d69fd0fa0006ff6b28e483e627aa
5
5
  SHA512:
6
- metadata.gz: a312fd8f5e8b8a146d40bca643fd22639bb3a67f7e2acd995e000e4c82b159c68b78547e3b48340cf747c0c2666cd3897581e19ff5a4a752dcb6c07cf8618562
7
- data.tar.gz: a8136c073d50d1c1b8f7f4ff831bcd2f2aa0cfea1a233e9c88bf4900c120f3131e61245632dd55f5357ca5217203d64d7cef4285d19adce33bff4c5e18640f05
6
+ metadata.gz: 473b3047986b69763e01fb3b3f7fc1137070cb041ae235e520216e568860295a3b0ed105e4c52ee1d3aa05353d1b247e0782a1aa7bde840a540200f21d84320b
7
+ data.tar.gz: 69e625526fcc0b7216a419326e172114ed0ba4c7842722c1f896ed4d2fd559e4b58ea31f95a7ca52d37f11b5930433cfa6faab3f510996a39b1de3d3ff46d2a7
data/History.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 6.3.1 / 2023-08-18
2
+
3
+ * Security
4
+ * Address HTTP request smuggling vulnerabilities with zero-length Content Length header and trailer fields ([GHSA-68xg-gqqm-vgj8](https://github.com/puma/puma/security/advisories/GHSA-68xg-gqqm-vgj8))
5
+
1
6
  ## 6.3.0 / 2023-05-31
2
7
 
3
8
  * Features
data/lib/puma/client.rb CHANGED
@@ -49,7 +49,8 @@ module Puma
49
49
 
50
50
  # chunked body validation
51
51
  CHUNK_SIZE_INVALID = /[^\h]/.freeze
52
- CHUNK_VALID_ENDING = "\r\n".freeze
52
+ CHUNK_VALID_ENDING = Const::LINE_END
53
+ CHUNK_VALID_ENDING_SIZE = CHUNK_VALID_ENDING.bytesize
53
54
 
54
55
  # Content-Length header value validation
55
56
  CONTENT_LENGTH_VALUE_INVALID = /[^\d]/.freeze
@@ -382,8 +383,8 @@ module Puma
382
383
  cl = @env[CONTENT_LENGTH]
383
384
 
384
385
  if cl
385
- # cannot contain characters that are not \d
386
- if CONTENT_LENGTH_VALUE_INVALID.match? cl
386
+ # cannot contain characters that are not \d, or be empty
387
+ if CONTENT_LENGTH_VALUE_INVALID.match?(cl) || cl.empty?
387
388
  raise HttpParserError, "Invalid Content-Length: #{cl.inspect}"
388
389
  end
389
390
  else
@@ -544,7 +545,7 @@ module Puma
544
545
 
545
546
  while !io.eof?
546
547
  line = io.gets
547
- if line.end_with?("\r\n")
548
+ if line.end_with?(CHUNK_VALID_ENDING)
548
549
  # Puma doesn't process chunk extensions, but should parse if they're
549
550
  # present, which is the reason for the semicolon regex
550
551
  chunk_hex = line.strip[/\A[^;]+/]
@@ -556,13 +557,19 @@ module Puma
556
557
  @in_last_chunk = true
557
558
  @body.rewind
558
559
  rest = io.read
559
- last_crlf_size = "\r\n".bytesize
560
- if rest.bytesize < last_crlf_size
560
+ if rest.bytesize < CHUNK_VALID_ENDING_SIZE
561
561
  @buffer = nil
562
- @partial_part_left = last_crlf_size - rest.bytesize
562
+ @partial_part_left = CHUNK_VALID_ENDING_SIZE - rest.bytesize
563
563
  return false
564
564
  else
565
- @buffer = rest[last_crlf_size..-1]
565
+ # if the next character is a CRLF, set buffer to everything after that CRLF
566
+ start_of_rest = if rest.start_with?(CHUNK_VALID_ENDING)
567
+ CHUNK_VALID_ENDING_SIZE
568
+ else # we have started a trailer section, which we do not support. skip it!
569
+ rest.index(CHUNK_VALID_ENDING*2) + CHUNK_VALID_ENDING_SIZE*2
570
+ end
571
+
572
+ @buffer = rest[start_of_rest..-1]
566
573
  @buffer = nil if @buffer.empty?
567
574
  set_ready
568
575
  return 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 = "6.3.0"
103
+ PUMA_VERSION = VERSION = "6.3.1"
104
104
  CODE_NAME = "Mugi No Toki Itaru"
105
105
 
106
106
  PUMA_SERVER_STRING = ["puma", PUMA_VERSION, CODE_NAME].join(" ").freeze
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: 6.3.0
4
+ version: 6.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix