actionpack 4.2.10 → 7.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

Files changed (202) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +86 -600
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +13 -14
  5. data/lib/abstract_controller/asset_paths.rb +5 -1
  6. data/lib/abstract_controller/base.rb +166 -136
  7. data/lib/abstract_controller/caching/fragments.rb +149 -0
  8. data/lib/abstract_controller/caching.rb +68 -0
  9. data/lib/abstract_controller/callbacks.rb +126 -57
  10. data/lib/abstract_controller/collector.rb +13 -15
  11. data/lib/abstract_controller/deprecator.rb +9 -0
  12. data/lib/abstract_controller/error.rb +8 -0
  13. data/lib/abstract_controller/helpers.rb +181 -132
  14. data/lib/abstract_controller/logger.rb +5 -1
  15. data/lib/abstract_controller/railties/routes_helpers.rb +10 -3
  16. data/lib/abstract_controller/rendering.rb +56 -56
  17. data/lib/abstract_controller/translation.rb +29 -15
  18. data/lib/abstract_controller/url_for.rb +15 -11
  19. data/lib/abstract_controller.rb +21 -5
  20. data/lib/action_controller/api/api_rendering.rb +18 -0
  21. data/lib/action_controller/api.rb +154 -0
  22. data/lib/action_controller/base.rb +219 -155
  23. data/lib/action_controller/caching.rb +28 -68
  24. data/lib/action_controller/deprecator.rb +9 -0
  25. data/lib/action_controller/form_builder.rb +55 -0
  26. data/lib/action_controller/log_subscriber.rb +35 -22
  27. data/lib/action_controller/metal/allow_browser.rb +119 -0
  28. data/lib/action_controller/metal/basic_implicit_render.rb +17 -0
  29. data/lib/action_controller/metal/conditional_get.rb +259 -122
  30. data/lib/action_controller/metal/content_security_policy.rb +86 -0
  31. data/lib/action_controller/metal/cookies.rb +9 -5
  32. data/lib/action_controller/metal/data_streaming.rb +87 -104
  33. data/lib/action_controller/metal/default_headers.rb +21 -0
  34. data/lib/action_controller/metal/etag_with_flash.rb +22 -0
  35. data/lib/action_controller/metal/etag_with_template_digest.rb +35 -26
  36. data/lib/action_controller/metal/exceptions.rb +71 -24
  37. data/lib/action_controller/metal/flash.rb +26 -19
  38. data/lib/action_controller/metal/head.rb +45 -36
  39. data/lib/action_controller/metal/helpers.rb +80 -64
  40. data/lib/action_controller/metal/http_authentication.rb +297 -244
  41. data/lib/action_controller/metal/implicit_render.rb +57 -9
  42. data/lib/action_controller/metal/instrumentation.rb +76 -64
  43. data/lib/action_controller/metal/live.rb +238 -176
  44. data/lib/action_controller/metal/logging.rb +22 -0
  45. data/lib/action_controller/metal/mime_responds.rb +177 -166
  46. data/lib/action_controller/metal/parameter_encoding.rb +84 -0
  47. data/lib/action_controller/metal/params_wrapper.rb +145 -118
  48. data/lib/action_controller/metal/permissions_policy.rb +38 -0
  49. data/lib/action_controller/metal/rate_limiting.rb +62 -0
  50. data/lib/action_controller/metal/redirecting.rb +203 -64
  51. data/lib/action_controller/metal/renderers.rb +108 -65
  52. data/lib/action_controller/metal/rendering.rb +216 -56
  53. data/lib/action_controller/metal/request_forgery_protection.rb +496 -163
  54. data/lib/action_controller/metal/rescue.rb +19 -21
  55. data/lib/action_controller/metal/streaming.rb +179 -138
  56. data/lib/action_controller/metal/strong_parameters.rb +1058 -382
  57. data/lib/action_controller/metal/testing.rb +11 -17
  58. data/lib/action_controller/metal/url_for.rb +37 -21
  59. data/lib/action_controller/metal.rb +236 -138
  60. data/lib/action_controller/railtie.rb +89 -11
  61. data/lib/action_controller/railties/helpers.rb +5 -1
  62. data/lib/action_controller/renderer.rb +161 -0
  63. data/lib/action_controller/template_assertions.rb +13 -0
  64. data/lib/action_controller/test_case.rb +425 -497
  65. data/lib/action_controller.rb +44 -22
  66. data/lib/action_dispatch/constants.rb +34 -0
  67. data/lib/action_dispatch/deprecator.rb +9 -0
  68. data/lib/action_dispatch/http/cache.rb +119 -63
  69. data/lib/action_dispatch/http/content_disposition.rb +47 -0
  70. data/lib/action_dispatch/http/content_security_policy.rb +364 -0
  71. data/lib/action_dispatch/http/filter_parameters.rb +36 -34
  72. data/lib/action_dispatch/http/filter_redirect.rb +24 -12
  73. data/lib/action_dispatch/http/headers.rb +66 -31
  74. data/lib/action_dispatch/http/mime_negotiation.rb +106 -75
  75. data/lib/action_dispatch/http/mime_type.rb +196 -136
  76. data/lib/action_dispatch/http/mime_types.rb +25 -7
  77. data/lib/action_dispatch/http/parameters.rb +97 -45
  78. data/lib/action_dispatch/http/permissions_policy.rb +187 -0
  79. data/lib/action_dispatch/http/rack_cache.rb +6 -0
  80. data/lib/action_dispatch/http/request.rb +299 -170
  81. data/lib/action_dispatch/http/response.rb +311 -160
  82. data/lib/action_dispatch/http/upload.rb +52 -23
  83. data/lib/action_dispatch/http/url.rb +201 -125
  84. data/lib/action_dispatch/journey/formatter.rb +110 -50
  85. data/lib/action_dispatch/journey/gtg/builder.rb +37 -50
  86. data/lib/action_dispatch/journey/gtg/simulator.rb +20 -17
  87. data/lib/action_dispatch/journey/gtg/transition_table.rb +96 -36
  88. data/lib/action_dispatch/journey/nfa/dot.rb +5 -14
  89. data/lib/action_dispatch/journey/nodes/node.rb +100 -20
  90. data/lib/action_dispatch/journey/parser.rb +19 -17
  91. data/lib/action_dispatch/journey/parser.y +4 -3
  92. data/lib/action_dispatch/journey/parser_extras.rb +14 -4
  93. data/lib/action_dispatch/journey/path/pattern.rb +79 -63
  94. data/lib/action_dispatch/journey/route.rb +108 -44
  95. data/lib/action_dispatch/journey/router/utils.rb +41 -29
  96. data/lib/action_dispatch/journey/router.rb +64 -57
  97. data/lib/action_dispatch/journey/routes.rb +23 -21
  98. data/lib/action_dispatch/journey/scanner.rb +28 -17
  99. data/lib/action_dispatch/journey/visitors.rb +100 -54
  100. data/lib/action_dispatch/journey/visualizer/fsm.js +49 -24
  101. data/lib/action_dispatch/journey/visualizer/index.html.erb +1 -1
  102. data/lib/action_dispatch/journey.rb +7 -5
  103. data/lib/action_dispatch/log_subscriber.rb +25 -0
  104. data/lib/action_dispatch/middleware/actionable_exceptions.rb +46 -0
  105. data/lib/action_dispatch/middleware/assume_ssl.rb +27 -0
  106. data/lib/action_dispatch/middleware/callbacks.rb +7 -6
  107. data/lib/action_dispatch/middleware/cookies.rb +471 -328
  108. data/lib/action_dispatch/middleware/debug_exceptions.rb +149 -66
  109. data/lib/action_dispatch/middleware/debug_locks.rb +129 -0
  110. data/lib/action_dispatch/middleware/debug_view.rb +73 -0
  111. data/lib/action_dispatch/middleware/exception_wrapper.rb +275 -73
  112. data/lib/action_dispatch/middleware/executor.rb +32 -0
  113. data/lib/action_dispatch/middleware/flash.rb +143 -101
  114. data/lib/action_dispatch/middleware/host_authorization.rb +171 -0
  115. data/lib/action_dispatch/middleware/public_exceptions.rb +36 -27
  116. data/lib/action_dispatch/middleware/reloader.rb +10 -92
  117. data/lib/action_dispatch/middleware/remote_ip.rb +133 -107
  118. data/lib/action_dispatch/middleware/request_id.rb +29 -15
  119. data/lib/action_dispatch/middleware/server_timing.rb +78 -0
  120. data/lib/action_dispatch/middleware/session/abstract_store.rb +49 -27
  121. data/lib/action_dispatch/middleware/session/cache_store.rb +33 -16
  122. data/lib/action_dispatch/middleware/session/cookie_store.rb +86 -80
  123. data/lib/action_dispatch/middleware/session/mem_cache_store.rb +15 -3
  124. data/lib/action_dispatch/middleware/show_exceptions.rb +66 -36
  125. data/lib/action_dispatch/middleware/ssl.rb +134 -36
  126. data/lib/action_dispatch/middleware/stack.rb +109 -44
  127. data/lib/action_dispatch/middleware/static.rb +159 -90
  128. data/lib/action_dispatch/middleware/templates/rescues/_actions.html.erb +13 -0
  129. data/lib/action_dispatch/middleware/templates/rescues/_actions.text.erb +0 -0
  130. data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +22 -0
  131. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +7 -24
  132. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +1 -1
  133. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +36 -0
  134. data/lib/action_dispatch/middleware/templates/rescues/_source.text.erb +8 -0
  135. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +46 -36
  136. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +12 -0
  137. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +9 -0
  138. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +26 -7
  139. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +3 -3
  140. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +24 -0
  141. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +16 -0
  142. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +139 -15
  143. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +23 -0
  144. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.text.erb +3 -0
  145. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +6 -6
  146. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +7 -7
  147. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +9 -9
  148. data/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +1 -1
  149. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +4 -4
  150. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +1 -1
  151. data/lib/action_dispatch/middleware/templates/routes/_route.html.erb +7 -4
  152. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +125 -93
  153. data/lib/action_dispatch/railtie.rb +44 -16
  154. data/lib/action_dispatch/request/session.rb +159 -69
  155. data/lib/action_dispatch/request/utils.rb +97 -23
  156. data/lib/action_dispatch/routing/endpoint.rb +11 -2
  157. data/lib/action_dispatch/routing/inspector.rb +195 -106
  158. data/lib/action_dispatch/routing/mapper.rb +1338 -955
  159. data/lib/action_dispatch/routing/polymorphic_routes.rb +234 -201
  160. data/lib/action_dispatch/routing/redirection.rb +78 -51
  161. data/lib/action_dispatch/routing/route_set.rb +460 -374
  162. data/lib/action_dispatch/routing/routes_proxy.rb +36 -12
  163. data/lib/action_dispatch/routing/url_for.rb +172 -124
  164. data/lib/action_dispatch/routing.rb +159 -158
  165. data/lib/action_dispatch/system_test_case.rb +206 -0
  166. data/lib/action_dispatch/system_testing/browser.rb +84 -0
  167. data/lib/action_dispatch/system_testing/driver.rb +85 -0
  168. data/lib/action_dispatch/system_testing/server.rb +33 -0
  169. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +164 -0
  170. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +23 -0
  171. data/lib/action_dispatch/testing/assertion_response.rb +48 -0
  172. data/lib/action_dispatch/testing/assertions/response.rb +71 -39
  173. data/lib/action_dispatch/testing/assertions/routing.rb +228 -103
  174. data/lib/action_dispatch/testing/assertions.rb +9 -6
  175. data/lib/action_dispatch/testing/integration.rb +486 -306
  176. data/lib/action_dispatch/testing/request_encoder.rb +60 -0
  177. data/lib/action_dispatch/testing/test_helpers/page_dump_helper.rb +35 -0
  178. data/lib/action_dispatch/testing/test_process.rb +35 -22
  179. data/lib/action_dispatch/testing/test_request.rb +29 -34
  180. data/lib/action_dispatch/testing/test_response.rb +48 -15
  181. data/lib/action_dispatch.rb +82 -40
  182. data/lib/action_pack/gem_version.rb +8 -4
  183. data/lib/action_pack/version.rb +6 -2
  184. data/lib/action_pack.rb +21 -18
  185. metadata +146 -56
  186. data/lib/action_controller/caching/fragments.rb +0 -103
  187. data/lib/action_controller/metal/force_ssl.rb +0 -97
  188. data/lib/action_controller/metal/hide_actions.rb +0 -40
  189. data/lib/action_controller/metal/rack_delegation.rb +0 -32
  190. data/lib/action_controller/middleware.rb +0 -39
  191. data/lib/action_controller/model_naming.rb +0 -12
  192. data/lib/action_dispatch/http/parameter_filter.rb +0 -72
  193. data/lib/action_dispatch/journey/backwards.rb +0 -5
  194. data/lib/action_dispatch/journey/nfa/builder.rb +0 -76
  195. data/lib/action_dispatch/journey/nfa/simulator.rb +0 -47
  196. data/lib/action_dispatch/journey/nfa/transition_table.rb +0 -163
  197. data/lib/action_dispatch/journey/router/strexp.rb +0 -27
  198. data/lib/action_dispatch/middleware/params_parser.rb +0 -60
  199. data/lib/action_dispatch/middleware/templates/rescues/_source.erb +0 -27
  200. data/lib/action_dispatch/testing/assertions/dom.rb +0 -3
  201. data/lib/action_dispatch/testing/assertions/selector.rb +0 -3
  202. data/lib/action_dispatch/testing/assertions/tag.rb +0 -3
data/CHANGELOG.md CHANGED
@@ -1,670 +1,156 @@
1
- ## Rails 4.2.10 (September 27, 2017) ##
2
-
3
- * Fix regression in behavior of `normalize_path`.
4
-
5
- In Rails 5 there was a change to ensure the encoding of the original string
6
- in a path was maintained. This was incorrectly backported to Rails 4.2 which
7
- caused a regression.
8
-
9
- *Eileen M. Uchitelle*
10
-
11
- ## Rails 4.2.9 (June 26, 2017) ##
12
-
13
- * Use more specific check for :format in route path
14
-
15
- The current check for whether to add an optional format to the path is very lax
16
- and will match things like `:format_id` where there are nested resources, e.g:
17
-
18
- ``` ruby
19
- resources :formats do
20
- resources :items
21
- end
22
- ```
23
-
24
- Fix this by using a more restrictive regex pattern that looks for the patterns
25
- `(.:format)`, `.:format` or `/` at the end of the path. Note that we need to
26
- allow for multiple closing parenthesis since the route may be of this form:
27
-
28
- ``` ruby
29
- get "/books(/:action(.:format))", controller: "books"
30
- ```
31
-
32
- This probably isn't what's intended since it means that the default index action
33
- route doesn't support a format but we have a test for it so we need to allow it.
34
-
35
- Fixes #28517.
36
-
37
- *Andrew White*
38
-
39
-
40
- ## Rails 4.2.8 (February 21, 2017) ##
41
-
42
- * No changes.
43
-
44
-
45
- ## Rails 4.2.7 (July 12, 2016) ##
1
+ ## Rails 7.2.0.rc1 (August 06, 2024) ##
46
2
 
47
3
  * No changes.
48
4
 
49
5
 
50
- ## Rails 4.2.6 (March 07, 2016) ##
6
+ ## Rails 7.2.0.beta3 (July 11, 2024) ##
51
7
 
52
8
  * No changes.
53
9
 
54
10
 
55
- ## Rails 4.2.5.2 (February 26, 2016) ##
56
-
57
- * Do not allow render with unpermitted parameter.
58
-
59
- Fixes CVE-2016-2098.
60
-
61
- *Arthur Neves*
62
-
63
-
64
- ## Rails 4.2.5.1 (January 25, 2015) ##
65
-
66
- * No changes.
67
-
68
-
69
- ## Rails 4.2.5 (November 12, 2015) ##
70
-
71
- * `ActionController::TestCase` can teardown gracefully if an error is raised
72
- early in the `setup` chain.
73
-
74
- *Yves Senn*
75
-
76
- * Parse RSS/ATOM responses as XML, not HTML.
77
-
78
- *Alexander Kaupanin*
79
-
80
- * Fix regression in mounted engine named routes generation for app deployed to
81
- a subdirectory. `relative_url_root` was prepended to the path twice (e.g.
82
- "/subdir/subdir/engine_path" instead of "/subdir/engine_path")
83
-
84
- Fixes #20920. Fixes #21459.
85
-
86
- *Matthew Erhard*
87
-
88
- * `url_for` does not modify its arguments when generating polymorphic URLs.
89
-
90
- *Bernerd Schaefer*
91
-
92
- * Update `ActionController::TestSession#fetch` to behave more like
93
- `ActionDispatch::Request::Session#fetch` when using non-string keys.
94
-
95
- *Jeremy Friesen*
96
-
97
-
98
- ## Rails 4.2.4 (August 24, 2015) ##
99
-
100
- * ActionController::TestSession now accepts a default value as well as
101
- a block for generating a default value based off the key provided.
102
-
103
- This fixes calls to session#fetch in ApplicationController instances that
104
- take more two arguments or a block from raising `ArgumentError: wrong
105
- number of arguments (2 for 1)` when performing controller tests.
106
-
107
- *Matthew Gerrior*
108
-
109
- * Fix to keep original header instance in `ActionDispatch::SSL`
110
-
111
- `ActionDispatch::SSL` changes headers to `Hash`.
112
- So some headers will be broken if there are some middlewares
113
- on `ActionDispatch::SSL` and if it uses `Rack::Utils::HeaderHash`.
114
-
115
- *Fumiaki Matsushima*
116
-
117
-
118
- ## Rails 4.2.3 (June 25, 2015) ##
119
-
120
- * Fix rake routes not showing the right format when
121
- nesting multiple routes.
122
-
123
- See #18373.
124
-
125
- *Ravil Bayramgalin*
126
-
127
- * Fix regression where a gzip file response would have a Content-type,
128
- even when it was a 304 status code.
11
+ ## Rails 7.2.0.beta2 (June 04, 2024) ##
129
12
 
130
- See #19271.
13
+ * Include the HTTP Permissions-Policy on non-HTML Content-Types
14
+ [CVE-2024-28103]
131
15
 
132
- *Kohei Suzuki*
16
+ *Aaron Patterson*, *Zack Deveau*
133
17
 
134
- * Fix handling of empty X_FORWARDED_HOST header in raw_host_with_port
135
18
 
136
- Previously, an empty X_FORWARDED_HOST header would cause
137
- Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
138
- Actiondispatch::Http:URL.host to raise a NoMethodError.
19
+ ## Rails 7.2.0.beta1 (May 29, 2024) ##
139
20
 
140
- *Adam Forsyth*
21
+ * Fix `Mime::Type.parse` handling type parameters for HTTP Accept headers.
141
22
 
142
- * Fallback to `ENV['RAILS_RELATIVE_URL_ROOT']` in `url_for`.
23
+ *Taylor Chaparro*
143
24
 
144
- Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment variable is not
145
- prepended to the path when `url_for` is called. If `SCRIPT_NAME` (used by Rack)
146
- is set, it takes precedence.
25
+ * Fix the error page that is displayed when a view template is missing to account for nested controller paths in the
26
+ suggested correct location for the missing template.
147
27
 
148
- Fixes #5122.
28
+ *Joshua Young*
149
29
 
150
- *Yasyf Mohamedali*
30
+ * Add `save_and_open_page` helper to `IntegrationTest`.
151
31
 
152
- * Fix regression in functional tests. Responses should have default headers
153
- assigned.
32
+ `save_and_open_page` is a helpful helper to keep a short feedback loop when working on system tests.
33
+ A similar helper with matching signature has been added to integration tests.
154
34
 
155
- See #18423.
35
+ *Joé Dupuis*
156
36
 
157
- *Jeremy Kemper*, *Yves Senn*
37
+ * Fix a regression in 7.1.3 passing a `to:` option without a controller when the controller is already defined by a scope.
158
38
 
159
-
160
- ## Rails 4.2.2 (June 16, 2015) ##
161
-
162
- * No Changes *
163
-
164
-
165
- ## Rails 4.2.1 (March 19, 2015) ##
166
-
167
- * Non-string authenticity tokens do not raise NoMethodError when decoding
168
- the masked token.
169
-
170
- *Ville Lautanala*
171
-
172
- * Explicitly ignored wildcard verbs when searching for HEAD routes before fallback
173
-
174
- Fixes an issue where a mounted rack app at root would intercept the HEAD
175
- request causing an incorrect behavior during the fall back to GET requests.
176
-
177
- Example:
178
39
  ```ruby
179
- draw do
180
- get '/home' => 'test#index'
181
- mount rack_app, at: '/'
40
+ Rails.application.routes.draw do
41
+ controller :home do
42
+ get "recent", to: "recent_posts"
43
+ end
182
44
  end
183
- head '/home'
184
- assert_response :success
185
45
  ```
186
- In this case, a HEAD request runs through the routes the first time and fails
187
- to match anything. Then, it runs through the list with the fallback and matches
188
- `get '/home'`. The original behavior would match the rack app in the first pass.
189
-
190
- *Terence Sun*
191
-
192
- * Preserve default format when generating URLs
193
-
194
- Fixes an issue that would cause the format set in default_url_options to be
195
- lost when generating URLs with fewer positional arguments than parameters in
196
- the route definition.
197
-
198
- Backport of #18627
199
-
200
- *Tekin Suleyman*, *Dominic Baggott*
201
-
202
- * Default headers, removed in controller actions, are no longer reapplied on
203
- the test response.
204
-
205
- *Jonas Baumann*
206
-
207
- * Ensure `append_info_to_payload` is called even if an exception is raised.
208
-
209
- Fixes an issue where when an exception is raised in the request the additonal
210
- payload data is not available.
211
-
212
- See:
213
- * #14903
214
- * https://github.com/roidrage/lograge/issues/37
215
-
216
- *Dieter Komendera*, *Margus Pärt*
217
-
218
- * Correctly rely on the response's status code to handle calls to `head`.
219
-
220
- *Robin Dupret*
221
-
222
- * Using `head` method returns empty response_body instead
223
- of returning a single space " ".
224
-
225
- The old behavior was added as a workaround for a bug in an early
226
- version of Safari, where the HTTP headers are not returned correctly
227
- if the response body has a 0-length. This is been fixed since and
228
- the workaround is no longer necessary.
229
-
230
- Fixes #18253.
231
-
232
- *Prathamesh Sonpatki*
233
-
234
- * Fix how polymorphic routes works with objects that implement `to_model`.
235
-
236
- *Travis Grathwell*
237
-
238
- * Fixed handling of positional url helper arguments when `format: false`.
239
-
240
- Fixes #17819.
241
-
242
- *Andrew White*, *Tatiana Soukiassian*
243
-
244
- * Fixed usage of optional scopes in URL helpers.
245
-
246
- *Alex Robbin*
247
-
248
-
249
- ## Rails 4.2.0 (December 20, 2014) ##
250
-
251
- * Add `ActionController::Parameters#to_unsafe_h` to return an unfiltered
252
- `Hash` representation of Parameters object. This is now a preferred way to
253
- retrieve unfiltered parameters as we will stop inheriting `AC::Parameters`
254
- object in Rails 5.0.
255
-
256
- *Prem Sichanugrist*
257
-
258
- * Restore handling of a bare `Authorization` header, without `token=`
259
- prefix.
260
-
261
- Fixes #17108.
262
-
263
- *Guo Xiang Tan*
264
-
265
- * Deprecate use of string keys in URL helpers.
266
-
267
- Use symbols instead.
268
- Fixes #16958.
269
-
270
- *Byron Bischoff*, *Melanie Gilman*
271
-
272
- * Deprecate the `only_path` option on `*_path` helpers.
273
-
274
- In cases where this option is set to `true`, the option is redundant and can
275
- be safely removed; otherwise, the corresponding `*_url` helper should be
276
- used instead.
277
-
278
- Fixes #17294.
279
-
280
- *Dan Olson*, *Godfrey Chan*
281
-
282
- * Improve Journey compliance to RFC 3986.
283
-
284
- The scanner in Journey failed to recognize routes that use literals
285
- from the sub-delims section of RFC 3986. It's now able to parse those
286
- authorized delimiters and route as expected.
287
-
288
- Fixes #17212.
289
-
290
- *Nicolas Cavigneaux*
291
-
292
- * Deprecate implicit Array conversion for Response objects. It was added
293
- (using `#to_ary`) so we could conveniently use implicit splatting:
294
-
295
- status, headers, body = response
296
-
297
- But it also means `response + response` works and `[response].flatten`
298
- cascades down to the Rack body. Nonsense behavior. Instead, rely on
299
- explicit conversion and splatting with `#to_a`:
300
-
301
- status, header, body = *response
302
46
 
303
- *Jeremy Kemper*
47
+ *Étienne Barrié*
304
48
 
305
- * Don't rescue `IPAddr::InvalidAddressError`.
49
+ * Request Forgery takes relative paths into account.
306
50
 
307
- `IPAddr::InvalidAddressError` does not exist in Ruby 1.9.3
308
- and fails for JRuby in 1.9 mode.
51
+ *Stefan Wienert*
309
52
 
310
- *Peter Suschlik*
53
+ * Add ".test" as a default allowed host in development to ensure smooth golden-path setup with puma.dev.
311
54
 
312
- * Fix bug where the router would ignore any constraints added to redirect
313
- routes.
55
+ *DHH*
314
56
 
315
- Fixes #16605.
57
+ * Add `allow_browser` to set minimum browser versions for the application.
316
58
 
317
- *Agis Anastasopoulos*
59
+ A browser that's blocked will by default be served the file in `public/406-unsupported-browser.html` with a HTTP status code of "406 Not Acceptable".
318
60
 
319
- * Allow `config.action_dispatch.trusted_proxies` to accept an IPAddr object.
320
-
321
- Example:
322
-
323
- # config/environments/production.rb
324
- config.action_dispatch.trusted_proxies = IPAddr.new('4.8.15.0/16')
325
-
326
- *Sam Aarons*
327
-
328
- * Avoid duplicating routes for HEAD requests.
329
-
330
- Instead of duplicating the routes, we will first match the HEAD request to
331
- HEAD routes. If no match is found, we will then map the HEAD request to
332
- GET routes.
333
-
334
- *Guo Xiang Tan*, *Andrew White*
335
-
336
- * Requests that hit `ActionDispatch::Static` can now take advantage
337
- of gzipped assets on disk. By default a gzip asset will be served if
338
- the client supports gzip and a compressed file is on disk.
339
-
340
- *Richard Schneeman*
341
-
342
- * `ActionController::Parameters` will stop inheriting from `Hash` and
343
- `HashWithIndifferentAccess` in the next major release. If you use any method
344
- that is not available on `ActionController::Parameters` you should consider
345
- calling `#to_h` to convert it to a `Hash` first before calling that method.
346
-
347
- *Prem Sichanugrist*
348
-
349
- * `ActionController::Parameters#to_h` now returns a `Hash` with unpermitted
350
- keys removed. This change is to reflect on a security concern where some
351
- method performed on an `ActionController::Parameters` may yield a `Hash`
352
- object which does not maintain `permitted?` status. If you would like to
353
- get a `Hash` with all the keys intact, duplicate and mark it as permitted
354
- before calling `#to_h`.
355
-
356
- params = ActionController::Parameters.new({
357
- name: 'Senjougahara Hitagi',
358
- oddity: 'Heavy stone crab'
359
- })
360
- params.to_h
361
- # => {}
362
-
363
- unsafe_params = params.dup.permit!
364
- unsafe_params.to_h
365
- # => {"name"=>"Senjougahara Hitagi", "oddity"=>"Heavy stone crab"}
366
-
367
- safe_params = params.permit(:name)
368
- safe_params.to_h
369
- # => {"name"=>"Senjougahara Hitagi"}
370
-
371
- This change is consider a stopgap as we cannot change the code to stop
372
- `ActionController::Parameters` to inherit from `HashWithIndifferentAccess`
373
- in the next minor release.
374
-
375
- *Prem Sichanugrist*
376
-
377
- * Deprecated `TagAssertions`.
378
-
379
- *Kasper Timm Hansen*
380
-
381
- * Use the Active Support JSON encoder for cookie jars using the `:json` or
382
- `:hybrid` serializer. This allows you to serialize custom Ruby objects into
383
- cookies by defining the `#as_json` hook on such objects.
384
-
385
- Fixes #16520.
386
-
387
- *Godfrey Chan*
388
-
389
- * Add `config.action_dispatch.cookies_digest` option for setting custom
390
- digest. The default remains the same - 'SHA1'.
391
-
392
- *Łukasz Strzałkowski*
393
-
394
- * Move `respond_with` (and the class-level `respond_to`) to
395
- the `responders` gem.
396
-
397
- *José Valim*
398
-
399
- * When your templates change, browser caches bust automatically.
400
-
401
- New default: the template digest is automatically included in your ETags.
402
- When you call `fresh_when @post`, the digest for `posts/show.html.erb`
403
- is mixed in so future changes to the HTML will blow HTTP caches for you.
404
- This makes it easy to HTTP-cache many more of your actions.
405
-
406
- If you render a different template, you can now pass the `:template`
407
- option to include its digest instead:
408
-
409
- fresh_when @post, template: 'widgets/show'
410
-
411
- Pass `template: false` to skip the lookup. To turn this off entirely, set:
412
-
413
- config.action_controller.etag_with_template_digest = false
414
-
415
- *Jeremy Kemper*
416
-
417
- * Remove deprecated `AbstractController::Helpers::ClassMethods::MissingHelperError`
418
- in favor of `AbstractController::Helpers::MissingHelperError`.
419
-
420
- *Yves Senn*
421
-
422
- * Fix `assert_template` not being able to assert that no files were rendered.
423
-
424
- *Guo Xiang Tan*
425
-
426
- * Extract source code for the entire exception stack trace for
427
- better debugging and diagnosis.
428
-
429
- *Ryan Dao*
430
-
431
- * Allows ActionDispatch::Request::LOCALHOST to match any IPv4 127.0.0.0/8
432
- loopback address.
433
-
434
- *Earl St Sauver*, *Sven Riedel*
435
-
436
- * Preserve original path in `ShowExceptions` middleware by stashing it as
437
- `env["action_dispatch.original_path"]`
438
-
439
- `ActionDispatch::ShowExceptions` overwrites `PATH_INFO` with the status code
440
- for the exception defined in `ExceptionWrapper`, so the path
441
- the user was visiting when an exception occurred was not previously
442
- available to any custom exceptions_app. The original `PATH_INFO` is now
443
- stashed in `env["action_dispatch.original_path"]`.
444
-
445
- *Grey Baker*
446
-
447
- * Use `String#bytesize` instead of `String#size` when checking for cookie
448
- overflow.
449
-
450
- *Agis Anastasopoulos*
451
-
452
- * `render nothing: true` or rendering a `nil` body no longer add a single
453
- space to the response body.
454
-
455
- The old behavior was added as a workaround for a bug in an early version of
456
- Safari, where the HTTP headers are not returned correctly if the response
457
- body has a 0-length. This is been fixed since and the workaround is no
458
- longer necessary.
459
-
460
- Use `render body: ' '` if the old behavior is desired.
461
-
462
- See #14883 for details.
463
-
464
- *Godfrey Chan*
465
-
466
- * Prepend a JS comment to JSONP callbacks. Addresses CVE-2014-4671
467
- ("Rosetta Flash").
468
-
469
- *Greg Campbell*
470
-
471
- * Because URI paths may contain non US-ASCII characters we need to force
472
- the encoding of any unescaped URIs to UTF-8 if they are US-ASCII.
473
- This essentially replicates the functionality of the monkey patch to
474
- URI.parser.unescape in active_support/core_ext/uri.rb.
475
-
476
- Fixes #16104.
477
-
478
- *Karl Entwistle*
479
-
480
- * Generate shallow paths for all children of shallow resources.
481
-
482
- Fixes #15783.
483
-
484
- *Seb Jacobs*
485
-
486
- * JSONP responses are now rendered with the `text/javascript` content type
487
- when rendering through a `respond_to` block.
488
-
489
- Fixes #15081.
490
-
491
- *Lucas Mazza*
492
-
493
- * Add `config.action_controller.always_permitted_parameters` to configure which
494
- parameters are permitted globally. The default value of this configuration is
495
- `['controller', 'action']`.
496
-
497
- *Gary S. Weaver*, *Rafael Chacon*
498
-
499
- * Fix env['PATH_INFO'] missing leading slash when a rack app mounted at '/'.
500
-
501
- Fixes #15511.
502
-
503
- *Larry Lv*
504
-
505
- * ActionController::Parameters#require now accepts `false` values.
506
-
507
- Fixes #15685.
508
-
509
- *Sergio Romano*
510
-
511
- * With authorization header `Authorization: Token token=`, `authenticate` now
512
- recognize token as nil, instead of "token".
513
-
514
- Fixes #14846.
515
-
516
- *Larry Lv*
517
-
518
- * Ensure the controller is always notified as soon as the client disconnects
519
- during live streaming, even when the controller is blocked on a write.
520
-
521
- *Nicholas Jakobsen*, *Matthew Draper*
522
-
523
- * Routes specifying 'to:' must be a string that contains a "#" or a rack
524
- application. Use of a symbol should be replaced with `action: symbol`.
525
- Use of a string without a "#" should be replaced with `controller: string`.
526
-
527
- *Aaron Patterson*
528
-
529
- * Fix URL generation with `:trailing_slash` such that it does not add
530
- a trailing slash after `.:format`
531
-
532
- *Dan Langevin*
533
-
534
- * Build full URI as string when processing path in integration tests for
535
- performance reasons. One consequence of this is that the leading slash
536
- is now required in integration test `process` helpers, whereas previously
537
- it could be omitted. The fact that this worked was a unintended consequence
538
- of the implementation and was never an intentional feature.
539
-
540
- *Guo Xiang Tan*
541
-
542
- * Fix `'Stack level too deep'` when rendering `head :ok` in an action method
543
- called 'status' in a controller.
544
-
545
- Fixes #13905.
546
-
547
- *Christiaan Van den Poel*
548
-
549
- * Add MKCALENDAR HTTP method (RFC 4791).
550
-
551
- *Sergey Karpesh*
552
-
553
- * Instrument fragment cache metrics.
554
-
555
- Adds `:controller`: and `:action` keys to the instrumentation payload
556
- for the `*_fragment.action_controller` notifications. This allows tracking
557
- e.g. the fragment cache hit rates for each controller action.
558
-
559
- *Daniel Schierbeck*
560
-
561
- * Always use the provided port if the protocol is relative.
562
-
563
- Fixes #15043.
564
-
565
- *Guilherme Cavalcanti*, *Andrew White*
566
-
567
- * Moved `params[request_forgery_protection_token]` into its own method
568
- and improved tests.
569
-
570
- Fixes #11316.
571
-
572
- *Tom Kadwill*
61
+ ```ruby
62
+ class ApplicationController < ActionController::Base
63
+ # Allow only browsers natively supporting webp images, web push, badges, import maps, CSS nesting + :has
64
+ allow_browser versions: :modern
65
+ end
573
66
 
574
- * Added verification of route constraints given as a Proc or an object responding
575
- to `:matches?`. Previously, when given an non-complying object, it would just
576
- silently fail to enforce the constraint. It will now raise an `ArgumentError`
577
- when setting up the routes.
67
+ class ApplicationController < ActionController::Base
68
+ # All versions of Chrome and Opera will be allowed, but no versions of "internet explorer" (ie). Safari needs to be 16.4+ and Firefox 121+.
69
+ allow_browser versions: { safari: 16.4, firefox: 121, ie: false }
70
+ end
578
71
 
579
- *Xavier Defrang*
72
+ class MessagesController < ApplicationController
73
+ # In addition to the browsers blocked by ApplicationController, also block Opera below 104 and Chrome below 119 for the show action.
74
+ allow_browser versions: { opera: 104, chrome: 119 }, only: :show
75
+ end
76
+ ```
580
77
 
581
- * Properly treat the entire IPv6 User Local Address space as private for
582
- purposes of remote IP detection. Also handle uppercase private IPv6
583
- addresses.
78
+ *DHH*
584
79
 
585
- Fixes #12638.
80
+ * Add rate limiting API.
586
81
 
587
- *Caleb Spare*
82
+ ```ruby
83
+ class SessionsController < ApplicationController
84
+ rate_limit to: 10, within: 3.minutes, only: :create
85
+ end
588
86
 
589
- * Fixed an issue with migrating legacy json cookies.
87
+ class SignupsController < ApplicationController
88
+ rate_limit to: 1000, within: 10.seconds,
89
+ by: -> { request.domain }, with: -> { redirect_to busy_controller_url, alert: "Too many signups!" }, only: :new
90
+ end
91
+ ```
590
92
 
591
- Previously, the `VerifyAndUpgradeLegacySignedMessage` assumes all incoming
592
- cookies are marshal-encoded. This is not the case when `secret_token` is
593
- used in conjunction with the `:json` or `:hybrid` serializer.
93
+ *DHH*, *Jean Boussier*
594
94
 
595
- In those case, when upgrading to use `secret_key_base`, this would cause a
596
- `TypeError: incompatible marshal file format` and a 500 error for the user.
95
+ * Add `image/svg+xml` to the compressible content types of `ActionDispatch::Static`.
597
96
 
598
- Fixes #14774.
97
+ *Georg Ledermann*
599
98
 
600
- *Godfrey Chan*
99
+ * Add instrumentation for `ActionController::Live#send_stream`.
601
100
 
602
- * Make URL escaping more consistent:
101
+ Allows subscribing to `send_stream` events. The event payload contains the filename, disposition, and type.
603
102
 
604
- 1. Escape '%' characters in URLs - only unescaped data should be passed to URL helpers
605
- 2. Add an `escape_segment` helper to `Router::Utils` that escapes '/' characters
606
- 3. Use `escape_segment` rather than `escape_fragment` in optimized URL generation
607
- 4. Use `escape_segment` rather than `escape_path` in URL generation
103
+ *Hannah Ramadan*
608
104
 
609
- For point 4 there are two exceptions. Firstly, when a route uses wildcard segments
610
- (e.g. `*foo`) then we use `escape_path` as the value may contain '/' characters. This
611
- means that wildcard routes can't be optimized. Secondly, if a `:controller` segment
612
- is used in the path then this uses `escape_path` as the controller may be namespaced.
105
+ * Add support for `with_routing` test helper in `ActionDispatch::IntegrationTest`.
613
106
 
614
- Fixes #14629, #14636 and #14070.
107
+ *Gannon McGibbon*
615
108
 
616
- *Andrew White*, *Edho Arief*
109
+ * Remove deprecated support to set `Rails.application.config.action_dispatch.show_exceptions` to `true` and `false`.
617
110
 
618
- * Add alias `ActionDispatch::Http::UploadedFile#to_io` to
619
- `ActionDispatch::Http::UploadedFile#tempfile`.
111
+ *Rafael Mendonça França*
620
112
 
621
- *Tim Linquist*
113
+ * Remove deprecated `speaker`, `vibrate`, and `vr` permissions policy directives.
622
114
 
623
- * Returns null type format when format is not know and controller is using `any`
624
- format block.
115
+ *Rafael Mendonça França*
625
116
 
626
- Fixes #14462.
117
+ * Remove deprecated `Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type`.
627
118
 
628
119
  *Rafael Mendonça França*
629
120
 
630
- * Improve routing error page with fuzzy matching search.
631
-
632
- *Winston*
121
+ * Deprecate `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
633
122
 
634
- * Only make deeply nested routes shallow when parent is shallow.
123
+ *Rafael Mendonça França*
635
124
 
636
- Fixes #14684.
125
+ * Remove deprecated comparison between `ActionController::Parameters` and `Hash`.
637
126
 
638
- *Andrew White*, *James Coglan*
127
+ *Rafael Mendonça França*
639
128
 
640
- * Append link to bad code to backtrace when exception is `SyntaxError`.
129
+ * Remove deprecated constant `AbstractController::Helpers::MissingHelperError`.
641
130
 
642
- *Boris Kuznetsov*
131
+ *Rafael Mendonça França*
643
132
 
644
- * Swapped the parameters of assert_equal in `assert_select` so that the
645
- proper values were printed correctly.
133
+ * Fix a race condition that could cause a `Text file busy - chromedriver`
134
+ error with parallel system tests.
646
135
 
647
- Fixes #14422.
136
+ *Matt Brictson*
648
137
 
649
- *Vishal Lal*
138
+ * Add `racc` as a dependency since it will become a bundled gem in Ruby 3.4.0
650
139
 
651
- * The method `shallow?` returns false if the parent resource is a singleton so
652
- we need to check if we're not inside a nested scope before copying the :path
653
- and :as options to their shallow equivalents.
140
+ *Hartley McGuire*
141
+ * Remove deprecated constant `ActionDispatch::IllegalStateError`.
654
142
 
655
- Fixes #14388.
143
+ *Rafael Mendonça França*
656
144
 
657
- *Andrew White*
145
+ * Add parameter filter capability for redirect locations.
658
146
 
659
- * Make logging of CSRF failures optional (but on by default) with the
660
- `log_warning_on_csrf_failure` configuration setting in
661
- `ActionController::RequestForgeryProtection`.
147
+ It uses the `config.filter_parameters` to match what needs to be filtered.
148
+ The result would be like this:
662
149
 
663
- *John Barton*
150
+ Redirected to http://secret.foo.bar?username=roque&password=[FILTERED]
664
151
 
665
- * Fix URL generation in controller tests with request-dependent
666
- `default_url_options` methods.
152
+ Fixes #14055.
667
153
 
668
- *Tony Wooster*
154
+ *Roque Pinel*, *Trevor Turk*, *tonytonyjan*
669
155
 
670
- Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/actionpack/CHANGELOG.md) for previous changes.
156
+ Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionpack/CHANGELOG.md) for previous changes.