puma 8.0.3 → 8.0.5

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: 96c1d48082acbb112be9621d5cd7be64ecc55077731588436e77e88c554c141f
4
- data.tar.gz: e204c15b13fa613835c65daa8cd987ded326de494b6dd227a41c1b67ebefc44d
3
+ metadata.gz: 205ef609319b117dc7a6d38197337a0ff7854c9f710f4f65a1c4d7d0d37bb63a
4
+ data.tar.gz: 582238d0708ea380001a38acd5517ea0326245025c2e09640ed2471ddbed2c30
5
5
  SHA512:
6
- metadata.gz: 1f3aee915a7b78f8aa17952b21a914e69b94345dd74e0efc19a09607ef0620e480ada8c228a1286bb625756d917c0bc7009f53a1b1f9598e5f6675de1abf374e
7
- data.tar.gz: 5ec7dec6348883b1e9f580465cce84ff91f3acbe6ea82e8b26ba5e90041ed761e5c6e755434f516905899fbcfcaf683b8e3f8bbbe6c1291c044eba72d90f5460
6
+ metadata.gz: 54a9ad2b1bec0897d69fa874fb37901831be6609f2e841cb6bd82b458cbf4992eef55f62d5a0a1709e4c84ec4ed450bb5f929ba2619a76592b1b6e54d9a96b20
7
+ data.tar.gz: 38c3cae97c7418e5d5d0dd49f32db4591046e18b86a9f86d1a5e0eac75e59a2b77bb5c0af98d7bf1c1e709fba7e9441399f8b9e62242ef824625916c290b5e83
data/History.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 8.0.5 / 2026-11-25
2
+
3
+ * Security
4
+ * Apply `verify_mode`, `ca` and the other TLS options of an `ssl://` bind when the `localhost` gem supplies the certificate; such a bind now fails at boot if those options are invalid. ([GHSA-r3wq-wqc8-m4pv](https://github.com/puma/puma/security/advisories/GHSA-r3wq-wqc8-m4pv))
5
+ * Escape control characters and invalid UTF-8 bytes in the first line of error log entries, which can include request data. ([GHSA-rhp6-mwcq-4p4c](https://github.com/puma/puma/security/advisories/GHSA-rhp6-mwcq-4p4c))
6
+ * Escape control characters and invalid UTF-8 bytes in request log lines, such as a `REMOTE_USER` with a line break. ([GHSA-9v95-fm6g-2gj5](https://github.com/puma/puma/security/advisories/GHSA-9v95-fm6g-2gj5))
7
+ * Keep the path of an absolute-form request target as the client sent it, whatever its URI scheme. ([GHSA-w67v-xw8r-x55m](https://github.com/puma/puma/security/advisories/GHSA-w67v-xw8r-x55m))
8
+ * Send error details and backtraces from the control server only in the `development` and `test` environments. ([GHSA-7q89-p6pc-544r](https://github.com/puma/puma/security/advisories/GHSA-7q89-p6pc-544r))
9
+
10
+ ## 8.0.4 / 2026-11-17
11
+
12
+ * Security
13
+ * Close a TLS connection when OpenSSL reports a fatal error reading it, rather than buffering everything the client sends until `first_data_timeout`. ([GHSA-4v6q-hvv7-49h9](https://github.com/puma/puma/security/advisories/GHSA-4v6q-hvv7-49h9))
14
+ * On JRuby, stop request headers such as `Query-String` and `Request-Path` from changing `QUERY_STRING`, `PATH_INFO` and the other env keys that come from the request line. ([GHSA-rhww-p99c-hgj9](https://github.com/puma/puma/security/advisories/GHSA-rhww-p99c-hgj9))
15
+
16
+ CVE IDs have been requested for these advisories and will be added here once assigned.
17
+
1
18
  ## 8.0.3 / 2026-11-13
2
19
 
3
20
  * Security
@@ -603,10 +603,10 @@ VALUE engine_read(VALUE self) {
603
603
  return rb_str_new(buf, bytes);
604
604
  }
605
605
 
606
- if(SSL_want_read(conn->ssl)) return Qnil;
607
-
608
606
  error = SSL_get_error(conn->ssl, bytes);
609
607
 
608
+ if(error == SSL_ERROR_WANT_READ) return Qnil;
609
+
610
610
  if(error == SSL_ERROR_ZERO_RETURN) {
611
611
  rb_eof_error();
612
612
  } else {
@@ -36,7 +36,7 @@ public enum EnvKey {
36
36
  ETAG,
37
37
  EXPECT,
38
38
  EXPIRES,
39
- FRAGMENT(true),
39
+ FRAGMENT(true, false),
40
40
  FROM,
41
41
  HOST,
42
42
  IF_MATCH,
@@ -51,15 +51,15 @@ public enum EnvKey {
51
51
  PRAGMA,
52
52
  PROXY_AUTHENTICATE,
53
53
  PROXY_AUTHORIZATION,
54
- QUERY_STRING(true),
54
+ QUERY_STRING(true, false),
55
55
  RANGE,
56
56
  REFERER,
57
- REQUEST_METHOD(true),
58
- REQUEST_PATH(true),
59
- REQUEST_URI(true),
57
+ REQUEST_METHOD(true, false),
58
+ REQUEST_PATH(true, false),
59
+ REQUEST_URI(true, false),
60
60
  RETRY_AFTER,
61
61
  SERVER,
62
- SERVER_PROTOCOL(true),
62
+ SERVER_PROTOCOL(true, false),
63
63
  TE,
64
64
  TRAILER,
65
65
  TRANSFER_ENCODING,
@@ -73,14 +73,20 @@ public enum EnvKey {
73
73
  WWW_AUTHENTICATE;
74
74
 
75
75
  final ByteList httpName;
76
+ final boolean fieldKey;
76
77
 
77
78
  EnvKey() {
78
79
  this(false);
79
80
  }
80
81
 
81
82
  EnvKey(boolean raw) {
83
+ this(raw, true);
84
+ }
85
+
86
+ EnvKey(boolean raw, boolean fieldKey) {
82
87
  String httpName = raw ? name() : "HTTP_" + name();
83
88
  this.httpName = new ByteList(ByteList.plain(httpName), false);
89
+ this.fieldKey = fieldKey;
84
90
  }
85
91
 
86
92
  /**
@@ -99,7 +105,7 @@ public enum EnvKey {
99
105
  if (key <= MAX_HASH_VALUE) {
100
106
  EnvKey match = keyList[key];
101
107
 
102
- if (match != null && equalsIgnoreCase(buffer, start, len, match.name())) {
108
+ if (match != null && match.fieldKey && equalsIgnoreCase(buffer, start, len, match.name())) {
103
109
  return match;
104
110
  }
105
111
  }
data/lib/puma/binder.rb CHANGED
@@ -236,7 +236,7 @@ module Puma
236
236
  # Load localhost authority if not loaded.
237
237
  # Ruby 3 `values_at` accepts an array, earlier do not
238
238
  if params.values_at(*cert_key).all? { |v| v.to_s.empty? }
239
- ctx = localhost_authority && localhost_authority_context
239
+ ctx = localhost_authority && localhost_authority_context(params)
240
240
  end
241
241
 
242
242
  ctx ||=
@@ -313,7 +313,7 @@ module Puma
313
313
  @localhost_authority ||= Localhost::Authority.fetch if defined?(Localhost::Authority) && !Puma::IS_JRUBY
314
314
  end
315
315
 
316
- def localhost_authority_context
316
+ def localhost_authority_context(params = {})
317
317
  return unless localhost_authority
318
318
 
319
319
  key_path, crt_path = if [:key_path, :certificate_path].all? { |m| localhost_authority.respond_to?(m) }
@@ -322,7 +322,8 @@ module Puma
322
322
  local_certificates_path = File.expand_path("~/.localhost")
323
323
  [File.join(local_certificates_path, "localhost.key"), File.join(local_certificates_path, "localhost.crt")]
324
324
  end
325
- MiniSSL::ContextBuilder.new({ "key" => key_path, "cert" => crt_path }, @log_writer).context
325
+ params = params.reject { |k, _| k.start_with?("cert", "key") }
326
+ MiniSSL::ContextBuilder.new(params.merge("key" => key_path, "cert" => crt_path), @log_writer).context
326
327
  end
327
328
 
328
329
  # Tell the server to listen on host +host+, port +port+.
@@ -38,7 +38,7 @@ module Puma
38
38
  unless @env[REQUEST_PATH]
39
39
  # it might be a dumbass full host request header
40
40
  uri = begin
41
- URI.parse(@env[REQUEST_URI])
41
+ URI::Generic.new(*URI.split(@env[REQUEST_URI]))
42
42
  rescue URI::InvalidURIError
43
43
  raise Puma::HttpParserError
44
44
  end
@@ -98,6 +98,9 @@ module Puma
98
98
  def write(msg)
99
99
  logger = @logger || env['rack.errors']
100
100
 
101
+ hex = ->(str) { str.bytes.map { |byte| "\\x%02X" % byte }.join }
102
+ msg = msg.dup.force_encoding(Encoding::UTF_8).scrub(&hex).gsub(/[\p{Cc}\u2028\u2029](?!\z)/, &hex)
103
+
101
104
  # Standard library logger doesn't support write but it supports << which actually
102
105
  # calls to write on the log device without formatting
103
106
  if logger.respond_to?(:write)
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.3"
103
+ PUMA_VERSION = VERSION = "8.0.5"
104
104
  CODE_NAME = "Into the Arena"
105
105
 
106
106
  PUMA_SERVER_STRING = ["puma", PUMA_VERSION, CODE_NAME].join(" ").freeze
@@ -67,7 +67,8 @@ module Puma
67
67
  string_block << " #{text}" if text
68
68
  string_block << " (#{request_title(req)})" if request_parsed?(req)
69
69
  string_block << ": #{error.inspect}" if error
70
- string_block.join('')
70
+ hex = ->(str) { str.bytes.map { |byte| "\\x%02X" % byte }.join }
71
+ string_block.join('').force_encoding(Encoding::UTF_8).scrub(&hex).gsub(/[\p{Cc}\u2028\u2029]/, &hex)
71
72
  end
72
73
 
73
74
  def request_dump(req)
data/lib/puma/runner.rb CHANGED
@@ -75,7 +75,8 @@ module Puma
75
75
  # A Reactor is not created and nio4r is not loaded when 'queue_requests: false'
76
76
  # Use `nil` for events, no hooks in control server
77
77
  control = Puma::Server.new app, nil,
78
- { min_threads: 0, max_threads: 1, queue_requests: false, log_writer: @log_writer }
78
+ { min_threads: 0, max_threads: 1, queue_requests: false, log_writer: @log_writer,
79
+ environment: @options[:environment] }
79
80
 
80
81
  begin
81
82
  control.binder.parse [str], nil, 'Starting control server'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.3
4
+ version: 8.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-11-24 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nio4r