ransack 6.0.0 → 6.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: ab7bd0c932988849a454c8178e7676022783c3bddb36f8e8d951c11aaf24de7c
4
- data.tar.gz: c076572a9ea5b4084fe9754bfc53cdcfa33667f8b2837ed1880fc11c1b855345
3
+ metadata.gz: 9940472d0658f87581dd23a9668c17b557806f72735ed8e66ceef5332c099d8b
4
+ data.tar.gz: 576b1c827db6b63a08d980c91fd063eee4b5bbdb359503a9c4af0bacfc134cfe
5
5
  SHA512:
6
- metadata.gz: 01de2b357a7c9f782d5e3ca9fb705ef4ccbd0b01a291fd90537903f2d514b4da3734fc6fba0425e9b908b78d2c073ba1cfde886c22f55432c68b739b14dc7336
7
- data.tar.gz: e3f13fdd795a2bfd0b37a4d7788ea9437f445c05a25185bc22e1e85efa84e0bbe47d63613d09f9d7b3690a75e9ccf05bcec63944e3804436de97247c230b3834
6
+ metadata.gz: 173aab57088df1db09eff37d4e3098ebbb18042fe387ab151958d7d5a892481bbfffc2cd35b1934f87e015c79bdd60f53d3be6a1828e9d541cda76725947a19e
7
+ data.tar.gz: 759843af14c0312b0167661a6e650bf933da0cb8ee652ad381452b7509f9e348f59c4a45fa274f6f0364bb78e48a142e171788039fd8f9690e50200108f8c1f3
@@ -162,6 +162,17 @@ module Ransack
162
162
  end
163
163
 
164
164
  class SortLink
165
+ # Keys url_for reads as instructions for building the link, not as
166
+ # query params. The request's params are carried over into the link,
167
+ # so a crafted query string could otherwise change its scheme, host,
168
+ # port, path prefix or route (GHSA-58rx-96gf-w92x). Userinfo needs
169
+ # :user and :password together, so dropping :password is enough to
170
+ # keep a ?user= filter.
171
+ RESERVED_URL_OPTIONS = (
172
+ ActionDispatch::Routing::RouteSet::RESERVED_OPTIONS +
173
+ %i[password use_route _recall]
174
+ ).freeze
175
+
165
176
  def initialize(search, attribute, args, params)
166
177
  @search = search
167
178
  @params = parameters_hash(params)
@@ -195,7 +206,7 @@ module Ransack
195
206
  end
196
207
 
197
208
  def url_options
198
- @params.except(:host).merge(
209
+ @params.except(*RESERVED_URL_OPTIONS).merge(
199
210
  @options.except(:class, :data, :host).merge(
200
211
  @search.context.search_key => search_and_sort_params))
201
212
  end
@@ -218,12 +229,11 @@ module Ransack
218
229
 
219
230
  private
220
231
 
232
+ # Indifferent access, so RESERVED_URL_OPTIONS also matches the string
233
+ # keys of a plain Hash.
221
234
  def parameters_hash(params)
222
- if params.respond_to?(:to_unsafe_h)
223
- params.to_unsafe_h
224
- else
225
- params
226
- end
235
+ params = params.to_unsafe_h if params.respond_to?(:to_unsafe_h)
236
+ params.with_indifferent_access
227
237
  end
228
238
 
229
239
  def extract_sort_fields_and_mutate_args!(args)
@@ -1,3 +1,3 @@
1
1
  module Ransack
2
- VERSION = '6.0.0'
2
+ VERSION = '6.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransack
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernie Miller