rails-profiler 0.44.24 → 0.44.26

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: 21bc2d1a836ed387db93a03b924c8af44d69d0d6f8d9d50e6ebf2ca9117d038f
4
+ data.tar.gz: 4afb33c62cc46edae07feb0c3e9fc825f26451b430f3888ae7a71915ece91749
5
5
  SHA512:
6
- metadata.gz: 9f91e65367aa8085f1c000b8c7430683adaceb4a428cf7a136cdb599495fee5a0868df4f94bfab6398b564ad9e4c0b27059ca2940cc19f9fc79ff4f96e9386d4
7
- data.tar.gz: 89e7752d3d1a346469c12ea74d1545e7c7f239a98a2b542892b3cb3962ac1b42584577f3b9aebdcc3610e16e23b4272336d42509803b01197ffa344cbe2304b9
6
+ metadata.gz: 0b048545adaa158803c1beb9d2c8eff6adcd42ab7fc2722dd918a4887096c75cc3ece99ec56b2b5d140323efbdb67fa4b9e16cbdac1734bfe732cdce7cd4db31
7
+ data.tar.gz: 2a933760b94b6bc7e2890a69b00431bb013feeb8138ccf0f2827ac9d222de066a340ea2bac2fdafbf0bb3bb1a2d7e5b2648fe6ddd80dfb17a2473105c61f9d75
data/CHANGELOG.md CHANGED
@@ -19,6 +19,22 @@ every commit of every tag interval is accounted for one way or the other.
19
19
 
20
20
  ## [Unreleased]
21
21
 
22
+ ## [0.44.26] - 2026-10-26
23
+
24
+ <!-- stamped -->
25
+
26
+ ### Fixed
27
+
28
+ - **MCP:** Reading an unknown resource URI now raises `MCP::Server::ResourceNotFoundError` (JSON-RPC error) instead of returning a success response with nil contents. Refs #73
29
+
30
+ ## [0.44.25] - 2026-10-26
31
+
32
+ <!-- stamped -->
33
+
34
+ ### Security
35
+
36
+ - **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.
37
+
22
38
  ## [0.44.24] - 2026-10-26
23
39
 
24
40
  <!-- 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)
@@ -55,7 +55,11 @@ module Profiler
55
55
  @server.resources_read_handler do |params|
56
56
  uri = params[:uri]
57
57
  handler = @resource_handlers[uri]
58
- next nil unless handler
58
+ unless handler
59
+ next nil unless defined?(::MCP::Server::ResourceNotFoundError)
60
+
61
+ raise ::MCP::Server::ResourceNotFoundError.new(uri, params)
62
+ end
59
63
 
60
64
  begin
61
65
  result = handler.call
@@ -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.26"
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.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Duplessy