rails-profiler 0.44.24 → 0.44.25

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: 1729fcad234995351945e11bd293601f63841d946c14e6e2fbc95f30f9caf2f6
4
- data.tar.gz: b823de0bc5c361f1ca33bd11e9f971f44dde64db2edaf893041a94def6afd21e
3
+ metadata.gz: 9ae9fe0ef9322cba9bf1ae8364bae2cfec9eb1ad3f11010351aa49180fcf2d89
4
+ data.tar.gz: 5cad7f44d5d1b0871a1379ffc1f95f13646a387dbf6146720c519d33a15b1752
5
5
  SHA512:
6
- metadata.gz: 9f91e65367aa8085f1c000b8c7430683adaceb4a428cf7a136cdb599495fee5a0868df4f94bfab6398b564ad9e4c0b27059ca2940cc19f9fc79ff4f96e9386d4
7
- data.tar.gz: 89e7752d3d1a346469c12ea74d1545e7c7f239a98a2b542892b3cb3962ac1b42584577f3b9aebdcc3610e16e23b4272336d42509803b01197ffa344cbe2304b9
6
+ metadata.gz: fb37b782a7e5e6fd12d77583dc625037baefb66195d6a59a7242945b0944f48d8d2f10d0cff1057cb4855ef6f4fb83773ac8c3cc00b4d8f6b4c96bb295d0f1e6
7
+ data.tar.gz: 0fde3a7cb33a929fd11caf3c93efb449db493c5e06609f46cf151a5ff7eb6a984823700614850dc9d02aa289cfd208a7ed971e97c80f10a2a8f2adb6388dc14f
data/CHANGELOG.md CHANGED
@@ -19,6 +19,14 @@ every commit of every tag interval is accounted for one way or the other.
19
19
 
20
20
  ## [Unreleased]
21
21
 
22
+ ## [0.44.25] - 2026-10-26
23
+
24
+ <!-- stamped -->
25
+
26
+ ### Security
27
+
28
+ - **Authorization:** under `authorization_mode = :allow_authorized`, the `host=` parameter of the `Forwarded` header (RFC 7239) is now checked against the allowed hosts like `Host` and `X-Forwarded-Host`, closing a DNS rebinding bypass through that header.
29
+
22
30
  ## [0.44.24] - 2026-10-26
23
31
 
24
32
  <!-- stamped -->
@@ -511,8 +511,8 @@ module Profiler
511
511
  "host name (#{e.message})"
512
512
  end
513
513
 
514
- # The DNS rebinding check for :allow_authorized: nil when the Host and X-Forwarded-Host
515
- # headers are allowed, otherwise a sentence naming the cause. A host is allowed when it is
514
+ # The DNS rebinding check for :allow_authorized: nil when the Host, X-Forwarded-Host and Forwarded host=
515
+ # values are allowed, otherwise a sentence naming the cause. A host is allowed when it is
516
516
  # local, listed in config.hosts, or listed in config.mcp_allowed_hosts: the same rule the MCP
517
517
  # HTTP transport already applies (Profiler::MCP::HttpGuard.allowed_host?), so a deployment
518
518
  # that already lists its host for MCP does not have to list it twice.
@@ -532,6 +532,10 @@ module Profiler
532
532
  return "the X-Forwarded-Host header #{remote.inspect} is not allowed: list it in config.hosts or " \
533
533
  "config.mcp_allowed_hosts" if remote
534
534
 
535
+ forwarded = LocalRequest.forwarded_hosts(request).find { |h| !MCP::HttpGuard.allowed_host?(h, self) }
536
+ return "the Forwarded header host #{forwarded.inspect} is not allowed: list it in config.hosts or " \
537
+ "config.mcp_allowed_hosts" if forwarded
538
+
535
539
  nil
536
540
  end
537
541
 
@@ -104,6 +104,12 @@ module Profiler
104
104
  allowed_host?(host_name(value))
105
105
  end
106
106
 
107
+ # Hosts named by the host= parameter of a Forwarded header (RFC 7239), for callers that
108
+ # apply their own host policy (Configuration under :allow_authorized).
109
+ def forwarded_hosts(request)
110
+ forwarded_param(request.get_header("HTTP_FORWARDED").to_s, "host")
111
+ end
112
+
107
113
  private
108
114
 
109
115
  def host_denial_reason(request)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Profiler
4
- VERSION = "0.44.24"
4
+ VERSION = "0.44.25"
5
5
 
6
6
  GEM_ROOT = File.expand_path("../..", __dir__)
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.24
4
+ version: 0.44.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Duplessy