hanami 3.0.1 → 3.0.3

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: 29601a37b77928f8529277ff1cb0c15f052b3928bead0a3e445d658639ad37a6
4
- data.tar.gz: d2ac2933b70202b2dafb0ac670bc6955d5fbb93e8158f872c287062b42e2f9de
3
+ metadata.gz: 9dbb1ebacb660f43098b4425fbddb02d6a11468630d5f957a330f833898c4b93
4
+ data.tar.gz: 2ff5577f0daceaea82862975775cd4b3ceb396aafb3991e6137d56a4f34555c6
5
5
  SHA512:
6
- metadata.gz: 8589c6729cd7c3040c3da48b2c4e7ae962143d8fab1d3414a5fa22775ea5570f5f5571f8f7e3ba24b7c9250bd094aa8c81305e8fd4bab41e469eee543ffcca91
7
- data.tar.gz: 02db55cd27edfe98fb4be41bd98617a89a39c29164a3d98e56e49c0439a5caddaef601e63b788ccdede92ad0c1f8f4bb8126b2bb9b4c51b874b9f408863ad0b5
6
+ metadata.gz: ae2910675eecf1cb423b18685dc925f56b8b0775ca0b576c017e83f2ef2d8fb09c753fde3d25b7d73b336bb136f7b2496f81edfade59b6e2d9de70743db84d72
7
+ data.tar.gz: 866750e0d3e5a8148426a7d13c007757497d051b12cd7ea4cec1db063feb7df4cb2cfac3dec73a8f923d972b52659e63267cfa29f88d35d060a13bd3478bf8a0
data/CHANGELOG.md CHANGED
@@ -35,11 +35,27 @@ A complete Hanami app is composed of multiple gems. For a complete overview of c
35
35
 
36
36
  ### Fixed
37
37
 
38
- - Don't attempt to inherit mailer template when `hanami-view` if not bundled (@katafrakt in #1611)
38
+ ### Security
39
+
40
+ [unreleased]: https://github.com/hanami/hanami/compare/v3.0.3...HEAD
41
+
42
+ ## [3.0.3] - 2026-11-24
39
43
 
40
44
  ### Security
41
45
 
42
- [unreleased]: https://github.com/hanami/hanami/compare/v3.0.1...HEAD
46
+ - Change the default `config.logger.filters` to `["passw", "secret", "token", "_key", "crypt"]`. With the substring matching in dry-logger 1.3, these filter any key containing these words, ignoring case, such as `password_confirmation`, `client_secret`, `_csrf_token`, `api_key` and `encrypted_password`. To filter more keys, append to `config.logger.filters`. To match a short key exactly, use a regexp such as `/\Apin\z/`. (@timriley in #1657)
47
+ - Require dry-logger 1.3 or later, which the new default log filters depend on. To keep the previous defaults, set `config.logger.filters = %w[_csrf password password_confirmation]`. (@parndt in GHSA-2v2m-5qwc-qhpw)
48
+ - Escape every non-numeric interpolation value in HTML translations. Previously only Strings were escaped, so Arrays and Hashes from request params, Symbols, and view parts were inserted unescaped. (@parndt in GHSA-gc77-6753-x6mr)
49
+
50
+ [3.0.3]: https://github.com/hanami/hanami/compare/v3.0.2...v3.0.3
51
+
52
+ ## [3.0.2] - 2026-08-21
53
+
54
+ ### Fixed
55
+
56
+ - Prefer response exposures over request params when preparing input for the view as part of an action auto-rendering. (@timriley in #1620)
57
+
58
+ [3.0.2]: https://github.com/hanami/hanami/compare/v3.0.1...v3.0.2
43
59
 
44
60
  ## [3.0.1] - 2026-07-03
45
61
 
data/hanami.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency "dry-inflector", "~> 1.0", ">= 1.1.0", "< 2"
37
37
  spec.add_runtime_dependency "dry-monitor", "~> 1.0", ">= 1.0.1", "< 2"
38
38
  spec.add_runtime_dependency "dry-system", "~> 1.1"
39
- spec.add_runtime_dependency "dry-logger", "~> 1.2", "< 2"
39
+ spec.add_runtime_dependency "dry-logger", "~> 1.3", ">= 1.3.1"
40
40
  spec.add_runtime_dependency "hanami-cli", ">= 2.3.1"
41
41
  spec.add_runtime_dependency "hanami-utils", "~> 3.0.0"
42
42
  spec.add_runtime_dependency "json", ">= 2.7.2"
@@ -78,16 +78,23 @@ module Hanami
78
78
  setting :template, default: :details
79
79
 
80
80
  # @!attribute [rw] filters
81
- # Sets or returns an array of attribute names to filter from logs.
81
+ # Sets or returns an array of filters for values to hide from logs.
82
82
  #
83
- # Defaults to `["_csrf", "password", "password_confirmation"]`. If you want to preserve
84
- # these defaults, append to this array rather than reassigning it.
83
+ # A string filter matches any key that contains it, ignoring case. For example, `"passw"`
84
+ # matches `password`, `password_confirmation` and `new_password`. A string filter containing
85
+ # dots matches against the key's full dotted path, such as `"user.pin"`.
85
86
  #
86
- # @return [Array<String>]
87
+ # A regexp filter matches against each key and its full dotted path, ignoring case. Use a
88
+ # regexp to match a short key exactly, such as `/\Apin\z/`.
89
+ #
90
+ # Defaults to `["_key", "crypt", "passw", "secret", "token"]`. If you want to preserve these
91
+ # defaults, append to this array rather than reassigning it.
92
+ #
93
+ # @return [Array<String, Regexp>]
87
94
  #
88
95
  # @api public
89
96
  # @since 2.0.0
90
- setting :filters, default: %w[_csrf password password_confirmation].freeze
97
+ setting :filters, default: %w[_key crypt passw secret token].freeze
91
98
 
92
99
  # @!attribute [rw] logger_constructor
93
100
  # Sets or returns the constructor proc to use for the logger instantiation.
@@ -37,6 +37,12 @@ module Hanami
37
37
  #
38
38
  # @since 2.0.0
39
39
  module InstanceMethods
40
+ # Options accepted by `Hanami::View#call` itself, which must never be given from request
41
+ # params.
42
+ #
43
+ # @api private
44
+ VIEW_RESERVED_KEYS = %i[format context layout].freeze
45
+
40
46
  # @api private
41
47
  attr_reader :view
42
48
 
@@ -89,18 +95,27 @@ module Hanami
89
95
 
90
96
  private
91
97
 
92
- # @api private
93
98
  def build_response(**options)
94
99
  options = options.merge(view_options: method(:view_options))
95
100
  super(**options)
96
101
  end
97
102
 
98
- # @api private
99
103
  def finish(req, res, halted)
100
- res.render(view, **req.params) if !halted && auto_render?(res)
104
+ res.render(view, **view_input(req, res)) if !halted && auto_render?(res)
101
105
  super
102
106
  end
103
107
 
108
+ # Returns the input for the automatically rendered view.
109
+ #
110
+ # Includes response exposures as well as request params. Exposures are given precedence;
111
+ # these are server-set and should not be overridden by the client.
112
+ #
113
+ # Drops any keys matching the keywords for `Hanami::View#call` itself, since these are
114
+ # behavioral controls and the client should have no say over how the view renders.
115
+ def view_input(req, res)
116
+ {**req.params.to_h.except(*VIEW_RESERVED_KEYS), **res.exposures}
117
+ end
118
+
104
119
  # @api private
105
120
  def _handle_exception(request, _response, _exception)
106
121
  super
@@ -174,10 +174,10 @@ module Hanami
174
174
  def _escape_translation_options(options)
175
175
  options.each_with_object({}) do |(key, value), result|
176
176
  result[key] =
177
- if ::I18n::RESERVED_KEYS.include?(key) || !value.is_a?(String) || _i18n_html_safe?(value)
177
+ if ::I18n::RESERVED_KEYS.include?(key) || value.is_a?(Numeric) || _i18n_html_safe?(value)
178
178
  value
179
179
  else
180
- _i18n_html_escape(value)
180
+ _i18n_html_escape(value.to_s)
181
181
  end
182
182
  end
183
183
  end
@@ -7,7 +7,7 @@ module Hanami
7
7
  # @api private
8
8
  module Version
9
9
  # @api public
10
- VERSION = "3.0.1"
10
+ VERSION = "3.0.3"
11
11
 
12
12
  # @since 0.9.0
13
13
  # @api private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanakai team
@@ -141,20 +141,20 @@ dependencies:
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '1.2'
145
- - - "<"
144
+ version: '1.3'
145
+ - - ">="
146
146
  - !ruby/object:Gem::Version
147
- version: '2'
147
+ version: 1.3.1
148
148
  type: :runtime
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - "~>"
153
153
  - !ruby/object:Gem::Version
154
- version: '1.2'
155
- - - "<"
154
+ version: '1.3'
155
+ - - ">="
156
156
  - !ruby/object:Gem::Version
157
- version: '2'
157
+ version: 1.3.1
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: hanami-cli
160
160
  requirement: !ruby/object:Gem::Requirement