puma 4.3.0-java → 4.3.3-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puma might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e6d09366b4b771a3942466e98d52d3af9a879420e1debed767b53eaa4edaf36
4
- data.tar.gz: 6f1ae43b69087282ec3c11519c0d64613180d4655a7f2d4c93a13a0856e2b99a
3
+ metadata.gz: 74024757af24c86b43fdd7360b8f8177fedfa1fb75b34f128175b16e12c4e20b
4
+ data.tar.gz: 708c5433d1f023d23c0eda449f62294283caafbb77fcd4250f814aa5bba1d160
5
5
  SHA512:
6
- metadata.gz: 761970dd43e44b0f58d87129eb9c94921bdc073942ab8f351de9afea5ee471daf1ff94fe101e4e04e71988738b55b56f2bc035eba9274eb763b4071c19e5514b
7
- data.tar.gz: ac47fae97e259a53e76c4153da10d2cccedee210c17bdabcffcbf585e78c8cf3eb5efcca55c87ec8218b5455a37f90421a97f8592192bbc6e4d611f90b01e082
6
+ metadata.gz: b9411791854d704f8be4f8df38b212cf021eb3e3c9c82c2ab71230271fb053c81219229fec9f4973f8d4cbd632b3ab9f7cace5e81c883147d7f823cfe59694a4
7
+ data.tar.gz: 4964f5bc6d0f921f28d7526b9313d80e7a90119fce7e74c325f3540055e7e7b797fb985d49e9a21cb8f9f04a883f0a64804e2cba364899047b261d7f55164e62
data/History.md CHANGED
@@ -6,6 +6,23 @@
6
6
  * Bugfixes
7
7
  * Your bugfix goes here (#Github Number)
8
8
 
9
+
10
+ ## 4.3.3 and 3.12.4 / 2020-02-28
11
+ * Bugfixes
12
+ * Fix: Fixes a problem where we weren't splitting headers correctly on newlines (#2132)
13
+ * Security
14
+ * Fix: Prevent HTTP Response splitting via CR in early hints.
15
+
16
+ ## 4.3.2 and 3.12.3 / 2020-02-27
17
+
18
+ * Security
19
+ * Fix: Prevent HTTP Response splitting via CR/LF in header values. CVE-2020-5247.
20
+
21
+ ## 4.3.1 and 3.12.2 / 2019-12-05
22
+
23
+ * Security
24
+ * Fix: a poorly-behaved client could use keepalive requests to monopolize Puma's reactor and create a denial of service attack. CVE-2019-16770.
25
+
9
26
  ## 4.3.0 / 2019-11-07
10
27
 
11
28
  * Features
@@ -100,7 +100,7 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "4.3.0".freeze
103
+ PUMA_VERSION = VERSION = "4.3.3".freeze
104
104
  CODE_NAME = "Mysterious Traveller".freeze
105
105
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
106
106
 
@@ -118,6 +118,13 @@ module Puma
118
118
  # sending data back
119
119
  WRITE_TIMEOUT = 10
120
120
 
121
+ # How many requests to attempt inline before sending a client back to
122
+ # the reactor to be subject to normal ordering. The idea here is that
123
+ # we amortize the cost of going back to the reactor for a well behaved
124
+ # but very "greedy" client across 10 requests. This prevents a not
125
+ # well behaved client from monopolizing the thread forever.
126
+ MAX_FAST_INLINE = 10
127
+
121
128
  # The original URI requested by the client.
122
129
  REQUEST_URI= 'REQUEST_URI'.freeze
123
130
  REQUEST_PATH = 'REQUEST_PATH'.freeze
@@ -221,6 +228,7 @@ module Puma
221
228
  COLON = ": ".freeze
222
229
 
223
230
  NEWLINE = "\n".freeze
231
+ HTTP_INJECTION_REGEX = /[\r\n]/.freeze
224
232
 
225
233
  HIJACK_P = "rack.hijack?".freeze
226
234
  HIJACK = "rack.hijack".freeze
Binary file
@@ -466,6 +466,8 @@ module Puma
466
466
  clean_thread_locals = @options[:clean_thread_locals]
467
467
  close_socket = true
468
468
 
469
+ requests = 0
470
+
469
471
  while true
470
472
  case handle_request(client, buffer)
471
473
  when false
@@ -479,7 +481,19 @@ module Puma
479
481
 
480
482
  ThreadPool.clean_thread_locals if clean_thread_locals
481
483
 
482
- unless client.reset(@status == :run)
484
+ requests += 1
485
+
486
+ check_for_more_data = @status == :run
487
+
488
+ if requests >= MAX_FAST_INLINE
489
+ # This will mean that reset will only try to use the data it already
490
+ # has buffered and won't try to read more data. What this means is that
491
+ # every client, independent of their request speed, gets treated like a slow
492
+ # one once every MAX_FAST_INLINE requests.
493
+ check_for_more_data = false
494
+ end
495
+
496
+ unless client.reset(check_for_more_data)
483
497
  close_socket = false
484
498
  client.set_timeout @persistent_timeout
485
499
  @reactor.add client
@@ -643,6 +657,7 @@ module Puma
643
657
  headers.each_pair do |k, vs|
644
658
  if vs.respond_to?(:to_s) && !vs.to_s.empty?
645
659
  vs.to_s.split(NEWLINE).each do |v|
660
+ next if possible_header_injection?(v)
646
661
  fast_write client, "#{k}: #{v}\r\n"
647
662
  end
648
663
  else
@@ -744,6 +759,7 @@ module Puma
744
759
  headers.each do |k, vs|
745
760
  case k.downcase
746
761
  when CONTENT_LENGTH2
762
+ next if possible_header_injection?(vs)
747
763
  content_length = vs
748
764
  next
749
765
  when TRANSFER_ENCODING
@@ -756,6 +772,7 @@ module Puma
756
772
 
757
773
  if vs.respond_to?(:to_s) && !vs.to_s.empty?
758
774
  vs.to_s.split(NEWLINE).each do |v|
775
+ next if possible_header_injection?(v)
759
776
  lines.append k, colon, v, line_ending
760
777
  end
761
778
  else
@@ -1026,5 +1043,10 @@ module Puma
1026
1043
  def shutting_down?
1027
1044
  @status == :stop || @status == :restart
1028
1045
  end
1046
+
1047
+ def possible_header_injection?(header_value)
1048
+ HTTP_INJECTION_REGEX =~ header_value.to_s
1049
+ end
1050
+ private :possible_header_injection?
1029
1051
  end
1030
1052
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.3.3
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-07 00:00:00.000000000 Z
11
+ date: 2020-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -17,8 +17,8 @@ dependencies:
17
17
  - !ruby/object:Gem::Version
18
18
  version: '2.0'
19
19
  name: nio4r
20
- prerelease: false
21
20
  type: :runtime
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"