hanami-webconsole 3.0.0 → 3.0.1

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: 6433aacf048bd0ad35a8a2e7486171f0e944950be78ce30e43732721305e0c05
4
- data.tar.gz: b55ee415ccd46aec0bee0a9158367035023f35734db2ee17bca1d66a75d465bd
3
+ metadata.gz: da5c6cfe03eb08f1a9150feed8b9a19ded65ef96f34e316f40bc8cdb1566433e
4
+ data.tar.gz: 0da8fb0995ea0a1ec08942463e4ca3db07eec08ba00a4835062d0a00653134cc
5
5
  SHA512:
6
- metadata.gz: 746ed2fecc7a822c0964095cc4d01b5a288cde953f459f6379110c9727d9595537c35b9b703377daa5a3dd710011d5d7f7032bae50648329d3983f48886ded1b
7
- data.tar.gz: 3592d24e98f787a5d1433d088b7330849774c08297125a6a984c8d03821c2b655a40b2bdea5234af06d99098962e4cc4656a1c5cbacf73bd0c61b58ff2dc7f26
6
+ metadata.gz: ff5ff81939bbd22592fb190b8ae32b948e0749264e8a99fc523935d54778ba85a3518d9875fcd080a68dd2ccbe2991db0297ad3dfe98112438327f936cc3936e
7
+ data.tar.gz: e5d1a07594a44acb90b5ff9d2ec06b332896cc93703866552d67d70bc32156783b17e4363e5ee033b516df8ca69b5c85fa25ea8daea589b48582b6ee5300388a
data/CHANGELOG.md CHANGED
@@ -19,7 +19,15 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
19
19
 
20
20
  ### Security
21
21
 
22
- [Unreleased]: https://github.com/hanami/hanami-webconsole/compare/v3.0.0...HEAD
22
+ [Unreleased]: https://github.com/hanami/hanami-webconsole/compare/v3.0.1...HEAD
23
+
24
+ ## [3.0.1] - 2026-11-24
25
+
26
+ ### Security
27
+
28
+ - Decide whether a request may reach the console from `REMOTE_ADDR` alone, overriding BetterErrors' check. Previously, `X-Forwarded-For`, `Client-IP` and `Forwarded` headers were trusted from peers on private networks, so anyone on the same network could claim a loopback address and run code in the app. Requests without a `REMOTE_ADDR` are now denied. (@parndt in GHSA-qxv3-3w54-whwp)
29
+
30
+ [3.0.1]: https://github.com/hanami/hanami-webconsole/compare/v3.0.0...v3.0.1
23
31
 
24
32
  ## [3.0.0] - 2026-06-30
25
33
 
@@ -35,6 +35,22 @@ module Hanami
35
35
 
36
36
  super
37
37
  end
38
+
39
+ private
40
+
41
+ # Reads `REMOTE_ADDR` rather than `Rack::Request#ip`, which trusts `X-Forwarded-For` and
42
+ # `Forwarded` from private-network peers, so any host on the same network could claim to be
43
+ # 127.0.0.1. A missing or blank address is denied, unlike in BetterErrors. An IPv6 zone id
44
+ # is stripped before parsing, and an unparseable address is denied rather than raised.
45
+ def allow_ip?(env)
46
+ ip = env["REMOTE_ADDR"]
47
+ return false if ip.nil? || ip.strip.empty?
48
+
49
+ address = IPAddr.new(ip.split("%").first)
50
+ BetterErrors::Middleware::ALLOWED_IPS.any? { |subnet| subnet.include?(address) }
51
+ rescue IPAddr::InvalidAddressError
52
+ false
53
+ end
38
54
  end
39
55
  BetterErrors::Middleware.prepend(BetterErrorsExtension)
40
56
 
@@ -3,6 +3,6 @@
3
3
  module Hanami
4
4
  module Webconsole
5
5
  # @since 0.1.0
6
- VERSION = "3.0.0"
6
+ VERSION = "3.0.1"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-webconsole
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanakai team