hanami-action 3.0.1 → 3.0.2

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: 8ca2d8098c5bfeaaf4d1422c04eb56980cda8bc806b03f327f4ecf19d82a7ff3
4
- data.tar.gz: f9f4e24aa1bac023962e562b1dcba5c232dfa3c7dc74610c983108b3f7eaa0f7
3
+ metadata.gz: ead66d07305c1ab423774ef35b1aba0d6f280aa0d0921299f8daca4e4130e09e
4
+ data.tar.gz: 0ce91d088d253b5daa993c768ecb633bf128e411fb0257b2594dd8cefdd80b23
5
5
  SHA512:
6
- metadata.gz: 5377fc1b6c6cf1c5b1be0832ba55e388cf47d8ad07dc3e4a594a506a080c32e641f1cd01685a370b9a9dbab61143e6ecac8b96646ccb77c821da57e43e9e8478
7
- data.tar.gz: 50b96bbc3419ca3727708944e4f7d5e35b8de9d81ecb340ada4162c72d15114b3330cc22f03990f73bb3e4757f16b25283c93b7b48a43906baa2000de6859c37
6
+ metadata.gz: a48f8dac73391046b11a1236b98020c555f49d73251af2bb34a84198709e8e9365d80f1044a2f5089d9ba7656d479627a187fabaf094c045bb4325cad5d9e09a
7
+ data.tar.gz: a09c190e05396f4cf7ca9747109f961714ca164ff1cb7594319ff28b014278152ae0ac1ae319ca26e1726a7fb1abcaa8bbf355df24afc9eada5b453bb96a62a6
data/CHANGELOG.md CHANGED
@@ -9,12 +9,8 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
9
9
 
10
10
  ### Added
11
11
 
12
- - Support additional `Cache-Control` directives in `response.cache_control`: `:immutable`, `:must_understand`, `stale_while_revalidate:` (requires a duration) and `stale_if_error:` (requires a duration). (@timriley in #522)
13
-
14
12
  ### Changed
15
13
 
16
- - `response.cache_control` raises `ArgumentError` for unknown directives instead of silently dropping them. (@timriley in #522)
17
-
18
14
  ### Deprecated
19
15
 
20
16
  ### Removed
@@ -23,7 +19,15 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
23
19
 
24
20
  ### Security
25
21
 
26
- [Unreleased]: https://github.com/hanami/hanami-action/compare/v3.0.1...HEAD
22
+ [Unreleased]: https://github.com/hanami/hanami-action/compare/v3.0.2...HEAD
23
+
24
+ ## [3.0.2] - 2026-11-24
25
+
26
+ ### Security
27
+
28
+ - Give route params precedence over query string and form body params with the same name in actions with a contract. Route params have Symbol keys and the others have String keys, so both were kept and the contract read the query or form value, letting `?id=2` override the `:id` in `/users/1`. (@parndt in GHSA-55j2-5pph-56mv)
29
+
30
+ [3.0.2]: https://github.com/hanami/hanami-action/compare/v3.0.1...v3.0.2
27
31
 
28
32
  ## [3.0.1] - 2026-07-03
29
33
 
@@ -324,14 +324,29 @@ module Hanami
324
324
  result = {}
325
325
  rack_request = ::Rack::Request.new(env) if has_query || has_form_body
326
326
 
327
- result.merge!(rack_request.GET) if has_query
328
- result.merge!(rack_request.POST) if has_form_body
329
- result.merge!(env[ROUTER_PARAMS]) if has_router_params
330
- result.merge!(env[ACTION_BODY_PARAMS]) if has_body_params
327
+ _merge_params(result, rack_request.GET) if has_query
328
+ _merge_params(result, rack_request.POST) if has_form_body
329
+ _merge_params(result, env[ROUTER_PARAMS]) if has_router_params
330
+ _merge_params(result, env[ACTION_BODY_PARAMS]) if has_body_params
331
331
 
332
332
  result
333
333
  end
334
334
 
335
+ # Merges params, replacing any existing value for the same key, whether it was stored with
336
+ # a String or a Symbol key. Route params have Symbol keys while the others have String keys,
337
+ # so without this a query or form param could sit alongside the route param it was meant to
338
+ # be overridden by, and a contract would read the query or form value instead.
339
+ def _merge_params(result, params)
340
+ params.each do |key, value|
341
+ if key.is_a?(Symbol)
342
+ result.delete(key.name)
343
+ elsif key.valid_encoding?
344
+ result.delete(key.to_sym)
345
+ end
346
+ result[key] = value
347
+ end
348
+ end
349
+
335
350
  def _form_content_type?(content_type)
336
351
  return false unless content_type
337
352
 
@@ -8,6 +8,6 @@ module Hanami
8
8
  #
9
9
  # @since 3.0.0
10
10
  # @api public
11
- VERSION = "3.0.1"
11
+ VERSION = "3.0.2"
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-action
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanakai team