actionpack 7.0.8.7 → 7.2.2.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.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +90 -537
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +2 -2
  5. data/lib/abstract_controller/asset_paths.rb +2 -0
  6. data/lib/abstract_controller/base.rb +119 -106
  7. data/lib/abstract_controller/caching/fragments.rb +51 -52
  8. data/lib/abstract_controller/caching.rb +2 -0
  9. data/lib/abstract_controller/callbacks.rb +94 -67
  10. data/lib/abstract_controller/collector.rb +6 -6
  11. data/lib/abstract_controller/deprecator.rb +9 -0
  12. data/lib/abstract_controller/error.rb +2 -0
  13. data/lib/abstract_controller/helpers.rb +121 -91
  14. data/lib/abstract_controller/logger.rb +2 -0
  15. data/lib/abstract_controller/railties/routes_helpers.rb +3 -16
  16. data/lib/abstract_controller/rendering.rb +14 -13
  17. data/lib/abstract_controller/translation.rb +12 -30
  18. data/lib/abstract_controller/url_for.rb +9 -5
  19. data/lib/abstract_controller.rb +8 -0
  20. data/lib/action_controller/api/api_rendering.rb +2 -0
  21. data/lib/action_controller/api.rb +78 -73
  22. data/lib/action_controller/base.rb +199 -141
  23. data/lib/action_controller/caching.rb +16 -11
  24. data/lib/action_controller/deprecator.rb +9 -0
  25. data/lib/action_controller/form_builder.rb +21 -16
  26. data/lib/action_controller/log_subscriber.rb +19 -5
  27. data/lib/action_controller/metal/allow_browser.rb +123 -0
  28. data/lib/action_controller/metal/basic_implicit_render.rb +2 -0
  29. data/lib/action_controller/metal/conditional_get.rb +187 -174
  30. data/lib/action_controller/metal/content_security_policy.rb +26 -25
  31. data/lib/action_controller/metal/cookies.rb +4 -2
  32. data/lib/action_controller/metal/data_streaming.rb +65 -54
  33. data/lib/action_controller/metal/default_headers.rb +6 -2
  34. data/lib/action_controller/metal/etag_with_flash.rb +4 -0
  35. data/lib/action_controller/metal/etag_with_template_digest.rb +18 -14
  36. data/lib/action_controller/metal/exceptions.rb +19 -9
  37. data/lib/action_controller/metal/flash.rb +12 -10
  38. data/lib/action_controller/metal/head.rb +20 -16
  39. data/lib/action_controller/metal/helpers.rb +64 -67
  40. data/lib/action_controller/metal/http_authentication.rb +212 -199
  41. data/lib/action_controller/metal/implicit_render.rb +21 -17
  42. data/lib/action_controller/metal/instrumentation.rb +22 -12
  43. data/lib/action_controller/metal/live.rb +125 -92
  44. data/lib/action_controller/metal/logging.rb +6 -4
  45. data/lib/action_controller/metal/mime_responds.rb +151 -142
  46. data/lib/action_controller/metal/parameter_encoding.rb +34 -32
  47. data/lib/action_controller/metal/params_wrapper.rb +58 -58
  48. data/lib/action_controller/metal/permissions_policy.rb +14 -13
  49. data/lib/action_controller/metal/rate_limiting.rb +62 -0
  50. data/lib/action_controller/metal/redirecting.rb +110 -84
  51. data/lib/action_controller/metal/renderers.rb +50 -49
  52. data/lib/action_controller/metal/rendering.rb +103 -82
  53. data/lib/action_controller/metal/request_forgery_protection.rb +279 -161
  54. data/lib/action_controller/metal/rescue.rb +12 -8
  55. data/lib/action_controller/metal/streaming.rb +174 -132
  56. data/lib/action_controller/metal/strong_parameters.rb +598 -473
  57. data/lib/action_controller/metal/testing.rb +2 -0
  58. data/lib/action_controller/metal/url_for.rb +23 -14
  59. data/lib/action_controller/metal.rb +145 -61
  60. data/lib/action_controller/railtie.rb +25 -9
  61. data/lib/action_controller/railties/helpers.rb +2 -0
  62. data/lib/action_controller/renderer.rb +105 -66
  63. data/lib/action_controller/template_assertions.rb +4 -2
  64. data/lib/action_controller/test_case.rb +157 -128
  65. data/lib/action_controller.rb +17 -3
  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 +28 -29
  69. data/lib/action_dispatch/http/content_disposition.rb +2 -0
  70. data/lib/action_dispatch/http/content_security_policy.rb +48 -45
  71. data/lib/action_dispatch/http/filter_parameters.rb +18 -8
  72. data/lib/action_dispatch/http/filter_redirect.rb +22 -1
  73. data/lib/action_dispatch/http/headers.rb +23 -21
  74. data/lib/action_dispatch/http/mime_negotiation.rb +37 -48
  75. data/lib/action_dispatch/http/mime_type.rb +60 -30
  76. data/lib/action_dispatch/http/mime_types.rb +5 -1
  77. data/lib/action_dispatch/http/parameters.rb +12 -10
  78. data/lib/action_dispatch/http/permissions_policy.rb +32 -27
  79. data/lib/action_dispatch/http/rack_cache.rb +4 -0
  80. data/lib/action_dispatch/http/request.rb +132 -79
  81. data/lib/action_dispatch/http/response.rb +136 -103
  82. data/lib/action_dispatch/http/upload.rb +19 -15
  83. data/lib/action_dispatch/http/url.rb +75 -73
  84. data/lib/action_dispatch/journey/formatter.rb +19 -6
  85. data/lib/action_dispatch/journey/gtg/builder.rb +4 -3
  86. data/lib/action_dispatch/journey/gtg/simulator.rb +2 -0
  87. data/lib/action_dispatch/journey/gtg/transition_table.rb +10 -8
  88. data/lib/action_dispatch/journey/nfa/dot.rb +2 -0
  89. data/lib/action_dispatch/journey/nodes/node.rb +6 -5
  90. data/lib/action_dispatch/journey/parser.rb +4 -3
  91. data/lib/action_dispatch/journey/parser_extras.rb +2 -0
  92. data/lib/action_dispatch/journey/path/pattern.rb +18 -15
  93. data/lib/action_dispatch/journey/route.rb +12 -9
  94. data/lib/action_dispatch/journey/router/utils.rb +16 -15
  95. data/lib/action_dispatch/journey/router.rb +13 -10
  96. data/lib/action_dispatch/journey/routes.rb +6 -4
  97. data/lib/action_dispatch/journey/scanner.rb +4 -2
  98. data/lib/action_dispatch/journey/visitors.rb +2 -0
  99. data/lib/action_dispatch/journey.rb +2 -0
  100. data/lib/action_dispatch/log_subscriber.rb +25 -0
  101. data/lib/action_dispatch/middleware/actionable_exceptions.rb +7 -6
  102. data/lib/action_dispatch/middleware/assume_ssl.rb +27 -0
  103. data/lib/action_dispatch/middleware/callbacks.rb +4 -0
  104. data/lib/action_dispatch/middleware/cookies.rb +192 -194
  105. data/lib/action_dispatch/middleware/debug_exceptions.rb +36 -27
  106. data/lib/action_dispatch/middleware/debug_locks.rb +18 -13
  107. data/lib/action_dispatch/middleware/debug_view.rb +9 -2
  108. data/lib/action_dispatch/middleware/exception_wrapper.rb +181 -27
  109. data/lib/action_dispatch/middleware/executor.rb +9 -1
  110. data/lib/action_dispatch/middleware/flash.rb +65 -46
  111. data/lib/action_dispatch/middleware/host_authorization.rb +22 -17
  112. data/lib/action_dispatch/middleware/public_exceptions.rb +12 -8
  113. data/lib/action_dispatch/middleware/reloader.rb +9 -5
  114. data/lib/action_dispatch/middleware/remote_ip.rb +88 -83
  115. data/lib/action_dispatch/middleware/request_id.rb +15 -8
  116. data/lib/action_dispatch/middleware/server_timing.rb +8 -6
  117. data/lib/action_dispatch/middleware/session/abstract_store.rb +7 -0
  118. data/lib/action_dispatch/middleware/session/cache_store.rb +14 -7
  119. data/lib/action_dispatch/middleware/session/cookie_store.rb +32 -25
  120. data/lib/action_dispatch/middleware/session/mem_cache_store.rb +9 -3
  121. data/lib/action_dispatch/middleware/show_exceptions.rb +42 -28
  122. data/lib/action_dispatch/middleware/ssl.rb +60 -45
  123. data/lib/action_dispatch/middleware/stack.rb +15 -9
  124. data/lib/action_dispatch/middleware/static.rb +40 -34
  125. data/lib/action_dispatch/middleware/templates/rescues/_actions.html.erb +2 -2
  126. data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +4 -4
  127. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +8 -1
  128. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +7 -7
  129. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +2 -2
  130. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +17 -0
  131. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +16 -12
  132. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +1 -1
  133. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +3 -3
  134. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +4 -4
  135. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +1 -1
  136. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +1 -1
  137. data/lib/action_dispatch/middleware/templates/routes/_route.html.erb +3 -0
  138. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +47 -38
  139. data/lib/action_dispatch/railtie.rb +12 -4
  140. data/lib/action_dispatch/request/session.rb +39 -27
  141. data/lib/action_dispatch/request/utils.rb +10 -3
  142. data/lib/action_dispatch/routing/endpoint.rb +2 -0
  143. data/lib/action_dispatch/routing/inspector.rb +59 -9
  144. data/lib/action_dispatch/routing/mapper.rb +686 -639
  145. data/lib/action_dispatch/routing/polymorphic_routes.rb +70 -61
  146. data/lib/action_dispatch/routing/redirection.rb +52 -38
  147. data/lib/action_dispatch/routing/route_set.rb +106 -62
  148. data/lib/action_dispatch/routing/routes_proxy.rb +16 -19
  149. data/lib/action_dispatch/routing/url_for.rb +131 -122
  150. data/lib/action_dispatch/routing.rb +152 -150
  151. data/lib/action_dispatch/system_test_case.rb +91 -81
  152. data/lib/action_dispatch/system_testing/browser.rb +27 -19
  153. data/lib/action_dispatch/system_testing/driver.rb +16 -22
  154. data/lib/action_dispatch/system_testing/server.rb +2 -0
  155. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +53 -31
  156. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +2 -0
  157. data/lib/action_dispatch/testing/assertion_response.rb +9 -7
  158. data/lib/action_dispatch/testing/assertions/response.rb +36 -26
  159. data/lib/action_dispatch/testing/assertions/routing.rb +203 -95
  160. data/lib/action_dispatch/testing/assertions.rb +5 -1
  161. data/lib/action_dispatch/testing/integration.rb +240 -229
  162. data/lib/action_dispatch/testing/request_encoder.rb +6 -1
  163. data/lib/action_dispatch/testing/test_helpers/page_dump_helper.rb +35 -0
  164. data/lib/action_dispatch/testing/test_process.rb +14 -9
  165. data/lib/action_dispatch/testing/test_request.rb +4 -2
  166. data/lib/action_dispatch/testing/test_response.rb +34 -19
  167. data/lib/action_dispatch.rb +52 -21
  168. data/lib/action_pack/gem_version.rb +6 -4
  169. data/lib/action_pack/version.rb +3 -1
  170. data/lib/action_pack.rb +18 -17
  171. metadata +86 -27
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Rails 7.0.8.7 (December 10, 2024) ##
1
+ ## Rails 7.2.2.1 (December 10, 2024) ##
2
2
 
3
3
  * Add validation to content security policies to disallow spaces and semicolons.
4
4
  Developers should use multiple arguments, and different directive methods instead.
@@ -7,632 +7,185 @@
7
7
 
8
8
  *Gannon McGibbon*
9
9
 
10
- ## Rails 7.0.8.6 (October 23, 2024) ##
11
10
 
12
- * No changes.
13
-
14
-
15
- ## Rails 7.0.8.5 (October 15, 2024) ##
16
-
17
- * Avoid regex backtracking in HTTP Token authentication
18
-
19
- [CVE-2024-47887]
20
-
21
- * Avoid regex backtracking in query parameter filtering
22
-
23
- [CVE-2024-41128]
24
-
25
-
26
- ## Rails 7.0.8.4 (June 04, 2024) ##
27
-
28
- * Include the HTTP Permissions-Policy on non-HTML Content-Types
29
- [CVE-2024-28103]
30
-
31
-
32
- ## Rails 7.0.8.3 (May 17, 2024) ##
33
-
34
- * No changes.
35
-
36
-
37
- ## Rails 7.0.8.2 (May 16, 2024) ##
38
-
39
- * No changes.
40
-
41
-
42
- ## Rails 7.0.8.1 (February 21, 2024) ##
43
-
44
- * Fix possible XSS vulnerability with the `translate` method in controllers
45
-
46
- CVE-2024-26143
47
-
48
- ## Rails 7.0.8 (September 09, 2023) ##
49
-
50
- * Fix `HostAuthorization` potentially displaying the value of the
51
- X_FORWARDED_HOST header when the HTTP_HOST header is being blocked.
52
-
53
- *Hartley McGuire*, *Daniel Schlosser*
54
-
55
-
56
- ## Rails 7.0.7.2 (August 22, 2023) ##
57
-
58
- * No changes.
11
+ ## Rails 7.2.2 (October 30, 2024) ##
59
12
 
13
+ * Fix non-GET requests not updating cookies in `ActionController::TestCase`.
60
14
 
61
- ## Rails 7.0.7.1 (August 22, 2023) ##
15
+ *Jon Moss*, *Hartley McGuire*
62
16
 
63
- * No changes.
64
17
 
65
-
66
- ## Rails 7.0.7 (August 09, 2023) ##
18
+ ## Rails 7.2.1.2 (October 23, 2024) ##
67
19
 
68
20
  * No changes.
69
21
 
70
22
 
71
- ## Rails 7.0.6 (June 29, 2023) ##
72
-
73
- * No changes.
74
-
75
-
76
- ## Rails 7.0.5.1 (June 26, 2023) ##
77
-
78
- * Raise an exception if illegal characters are provide to redirect_to
79
- [CVE-2023-28362]
80
-
81
- *Zack Deveau*
82
-
83
- ## Rails 7.0.5 (May 24, 2023) ##
84
-
85
- * Do not return CSP headers for 304 Not Modified responses.
86
-
87
- *Tobias Kraze*
88
-
89
- * Fix `EtagWithFlash` when there is no `Flash` middleware available.
90
-
91
- *fatkodima*
92
-
93
- * Fix content-type header with `send_stream`.
94
-
95
- *Elliot Crosby-McCullough*
23
+ ## Rails 7.2.1.1 (October 15, 2024) ##
96
24
 
97
- * Address Selenium `:capabilities` deprecation warning.
98
-
99
- *Ron Shinall*
25
+ * Avoid regex backtracking in HTTP Token authentication
100
26
 
101
- * Fix cookie domain for domain: all on two letter single level TLD.
27
+ [CVE-2024-47887]
102
28
 
103
29
  *John Hawthorn*
104
30
 
105
- * Don't double log the `controller`, `action`, or `namespaced_controller` when using `ActiveRecord::QueryLog`
106
-
107
- Previously if you set `config.active_record.query_log_tags` to an array that included
108
- `:controller`, `:namespaced_controller`, or `:action`, that item would get logged twice.
109
- This bug has been fixed.
110
-
111
- *Alex Ghiculescu*
112
-
113
- * Rescue `EOFError` exception from `rack` on a multipart request.
114
-
115
- *Nikita Vasilevsky*
116
-
117
- * Rescue `JSON::ParserError` in Cookies json deserializer to discards marshal dumps:
118
-
119
- Without this change, if `action_dispatch.cookies_serializer` is set to `:json` and
120
- the app tries to read a `:marshal` serialized cookie, it would error out which wouldn't
121
- clear the cookie and force app users to manually clear it in their browser.
122
-
123
- (See #45127 for original bug discussion)
124
-
125
- *Nathan Bardoux*
126
-
127
- ## Rails 7.0.4.3 (March 13, 2023) ##
128
-
129
- * No changes.
130
-
131
-
132
- ## Rails 7.0.4.2 (January 24, 2023) ##
133
-
134
- * Fix `domain: :all` for two letter TLD
135
-
136
- This fixes a compatibility issue introduced in our previous security
137
- release when using `domain: :all` with a two letter but single level top
138
- level domain domain (like `.ca`, rather than `.co.uk`).
139
-
31
+ * Avoid regex backtracking in query parameter filtering
140
32
 
141
- ## Rails 7.0.4.1 (January 17, 2023) ##
33
+ [CVE-2024-41128]
142
34
 
143
- * Fix sec issue with _url_host_allowed?
35
+ *John Hawthorn*
144
36
 
145
- Disallow certain strings from `_url_host_allowed?` to avoid a redirect
146
- to malicious sites.
147
37
 
148
- [CVE-2023-22797]
38
+ ## Rails 7.2.1 (August 22, 2024) ##
149
39
 
150
- * Avoid regex backtracking on If-None-Match header
40
+ * Fix `Request#raw_post` raising `NoMethodError` when `rack.input` is `nil`.
151
41
 
152
- [CVE-2023-22795]
42
+ *Hartley McGuire*
153
43
 
154
- * Use string#split instead of regex for domain parts
155
44
 
156
- [CVE-2023-22792]
45
+ ## Rails 7.2.0 (August 09, 2024) ##
157
46
 
158
- ## Rails 7.0.4 (September 09, 2022) ##
47
+ * Allow bots to ignore `allow_browser`.
159
48
 
160
- * Prevent `ActionDispatch::ServerTiming` from overwriting existing values in `Server-Timing`.
49
+ *Matthew Nguyen*
161
50
 
162
- Previously, if another middleware down the chain set `Server-Timing` header,
163
- it would overwritten by `ActionDispatch::ServerTiming`.
51
+ * Include the HTTP Permissions-Policy on non-HTML Content-Types
52
+ [CVE-2024-28103]
164
53
 
165
- *Jakub Malinowski*
54
+ *Aaron Patterson*, *Zack Deveau*
166
55
 
56
+ * Fix `Mime::Type.parse` handling type parameters for HTTP Accept headers.
167
57
 
168
- ## Rails 7.0.3.1 (July 12, 2022) ##
58
+ *Taylor Chaparro*
169
59
 
170
- * No changes.
60
+ * Fix the error page that is displayed when a view template is missing to account for nested controller paths in the
61
+ suggested correct location for the missing template.
171
62
 
63
+ *Joshua Young*
172
64
 
173
- ## Rails 7.0.3 (May 09, 2022) ##
65
+ * Add `save_and_open_page` helper to `IntegrationTest`.
174
66
 
175
- * Allow relative redirects when `raise_on_open_redirects` is enabled.
67
+ `save_and_open_page` is a helpful helper to keep a short feedback loop when working on system tests.
68
+ A similar helper with matching signature has been added to integration tests.
176
69
 
177
- *Tom Hughes*
70
+ *Joé Dupuis*
178
71
 
179
- * Fix `authenticate_with_http_basic` to allow for missing password.
180
-
181
- Before Rails 7.0 it was possible to handle basic authentication with only a username.
72
+ * Fix a regression in 7.1.3 passing a `to:` option without a controller when the controller is already defined by a scope.
182
73
 
183
74
  ```ruby
184
- authenticate_with_http_basic do |token, _|
185
- ApiClient.authenticate(token)
186
- end
187
- ```
188
-
189
- This ability is restored.
190
-
191
- *Jean Boussier*
192
-
193
- * Fix `content_security_policy` returning invalid directives.
194
-
195
- Directives such as `self`, `unsafe-eval` and few others were not
196
- single quoted when the directive was the result of calling a lambda
197
- returning an array.
198
-
199
- ```ruby
200
- content_security_policy do |policy|
201
- policy.frame_ancestors lambda { [:self, "https://example.com"] }
75
+ Rails.application.routes.draw do
76
+ controller :home do
77
+ get "recent", to: "recent_posts"
78
+ end
202
79
  end
203
80
  ```
204
81
 
205
- With this fix the policy generated from above will now be valid.
206
-
207
- *Edouard Chin*
208
-
209
- * Fix `skip_forgery_protection` to run without raising an error if forgery
210
- protection has not been enabled / `verify_authenticity_token` is not a
211
- defined callback.
212
-
213
- This fix prevents the Rails 7.0 Welcome Page (`/`) from raising an
214
- `ArgumentError` if `default_protect_from_forgery` is false.
215
-
216
- *Brad Trick*
217
-
218
- * Fix `ActionController::Live` to copy the IsolatedExecutionState in the ephemeral thread.
219
-
220
- Since its inception `ActionController::Live` has been copying thread local variables
221
- to keep things such as `CurrentAttributes` set from middlewares working in the controller action.
222
-
223
- With the introduction of `IsolatedExecutionState` in 7.0, some of that global state was lost in
224
- `ActionController::Live` controllers.
225
-
226
- *Jean Boussier*
227
-
228
- * Fix setting `trailing_slash: true` in route definition.
229
-
230
- ```ruby
231
- get '/test' => "test#index", as: :test, trailing_slash: true
232
-
233
- test_path() # => "/test/"
234
- ```
235
-
236
- *Jean Boussier*
237
-
238
- ## Rails 7.0.2.4 (April 26, 2022) ##
239
-
240
- * Allow Content Security Policy DSL to generate for API responses.
241
-
242
- *Tim Wade*
243
-
244
- ## Rails 7.0.2.3 (March 08, 2022) ##
245
-
246
- * No changes.
247
-
248
-
249
- ## Rails 7.0.2.2 (February 11, 2022) ##
250
-
251
- * No changes.
252
-
253
-
254
- ## Rails 7.0.2.1 (February 11, 2022) ##
255
-
256
- * Under certain circumstances, the middleware isn't informed that the
257
- response body has been fully closed which result in request state not
258
- being fully reset before the next request
259
-
260
- [CVE-2022-23633]
261
-
262
-
263
- ## Rails 7.0.2 (February 08, 2022) ##
264
-
265
- * No changes.
266
-
267
-
268
- ## Rails 7.0.1 (January 06, 2022) ##
269
-
270
- * Fix `ActionController::Parameters` methods to keep the original logger context when creating a new copy
271
- of the original object.
272
-
273
- *Yutaka Kamei*
274
-
275
-
276
- ## Rails 7.0.0 (December 15, 2021) ##
277
-
278
- * Deprecate `Rails.application.config.action_controller.urlsafe_csrf_tokens`. This config is now always enabled.
279
-
280
82
  *Étienne Barrié*
281
83
 
282
- * Instance variables set in requests in a `ActionController::TestCase` are now cleared before the next request
283
-
284
- This means if you make multiple requests in the same test, instance variables set in the first request will
285
- not persist into the second one. (It's not recommended to make multiple requests in the same test.)
286
-
287
- *Alex Ghiculescu*
288
-
289
-
290
- ## Rails 7.0.0.rc3 (December 14, 2021) ##
291
-
292
- * No changes.
293
-
84
+ * Request Forgery takes relative paths into account.
294
85
 
295
- ## Rails 7.0.0.rc2 (December 14, 2021) ##
86
+ *Stefan Wienert*
296
87
 
297
- * Fix X_FORWARDED_HOST protection. [CVE-2021-44528]
88
+ * Add ".test" as a default allowed host in development to ensure smooth golden-path setup with puma.dev.
298
89
 
90
+ *DHH*
299
91
 
300
- ## Rails 7.0.0.rc1 (December 06, 2021) ##
301
-
302
- * `Rails.application.executor` hooks can now be called around every request in a `ActionController::TestCase`
303
-
304
- This helps to better simulate request or job local state being reset between requests and prevent state
305
- leaking from one request to another.
306
-
307
- To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
308
-
309
- *Alex Ghiculescu*
310
-
311
- * Consider onion services secure for cookies.
312
-
313
- *Justin Tracey*
314
-
315
- * Remove deprecated `Rails.config.action_view.raise_on_missing_translations`.
316
-
317
- *Rafael Mendonça França*
318
-
319
- * Remove deprecated support to passing a path to `fixture_file_upload` relative to `fixture_path`.
320
-
321
- *Rafael Mendonça França*
322
-
323
- * Remove deprecated `ActionDispatch::SystemTestCase#host!`.
324
-
325
- *Rafael Mendonça França*
326
-
327
- * Remove deprecated `Rails.config.action_dispatch.hosts_response_app`.
328
-
329
- *Rafael Mendonça França*
330
-
331
- * Remove deprecated `ActionDispatch::Response.return_only_media_type_on_content_type`.
332
-
333
- *Rafael Mendonça França*
334
-
335
- * Raise `ActionController::Redirecting::UnsafeRedirectError` for unsafe `redirect_to` redirects.
92
+ * Add `allow_browser` to set minimum browser versions for the application.
336
93
 
337
- This allows `rescue_from` to be used to add a default fallback route:
94
+ 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".
338
95
 
339
96
  ```ruby
340
- rescue_from ActionController::Redirecting::UnsafeRedirectError do
341
- redirect_to root_url
97
+ class ApplicationController < ActionController::Base
98
+ # Allow only browsers natively supporting webp images, web push, badges, import maps, CSS nesting + :has
99
+ allow_browser versions: :modern
342
100
  end
343
- ```
344
-
345
- *Kasper Timm Hansen*, *Chris Oliver*
346
101
 
347
- * Add `url_from` to verify a redirect location is internal.
348
-
349
- Takes the open redirect protection from `redirect_to` so users can wrap a
350
- param, and fall back to an alternate redirect URL when the param provided
351
- one is unsafe.
102
+ class ApplicationController < ActionController::Base
103
+ # 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+.
104
+ allow_browser versions: { safari: 16.4, firefox: 121, ie: false }
105
+ end
352
106
 
353
- ```ruby
354
- def create
355
- redirect_to url_from(params[:redirect_url]) || root_url
107
+ class MessagesController < ApplicationController
108
+ # In addition to the browsers blocked by ApplicationController, also block Opera below 104 and Chrome below 119 for the show action.
109
+ allow_browser versions: { opera: 104, chrome: 119 }, only: :show
356
110
  end
357
111
  ```
358
112
 
359
- *dmcge*, *Kasper Timm Hansen*
360
-
361
- * Allow Capybara driver name overrides in `SystemTestCase::driven_by`
362
-
363
- Allow users to prevent conflicts among drivers that use the same driver
364
- type (selenium, poltergeist, webkit, rack test).
365
-
366
- Fixes #42502
367
-
368
- *Chris LaRose*
369
-
370
- * Allow multiline to be passed in routes when using wildcard segments.
113
+ *DHH*
371
114
 
372
- Previously routes with newlines weren't detected when using wildcard segments, returning
373
- a `No route matches` error.
374
- After this change, routes with newlines are detected on wildcard segments. Example
115
+ * Add rate limiting API.
375
116
 
376
117
  ```ruby
377
- draw do
378
- get "/wildcard/*wildcard_segment", to: SimpleApp.new("foo#index"), as: :wildcard
379
- end
380
-
381
- # After the change, the path matches.
382
- assert_equal "/wildcard/a%0Anewline", url_helpers.wildcard_path(wildcard_segment: "a\nnewline")
383
- ```
384
-
385
- Fixes #39103
386
-
387
- *Ignacio Chiazzo*
388
-
389
- * Treat html suffix in controller translation.
390
-
391
- *Rui Onodera*, *Gavin Miller*
392
-
393
- * Allow permitting numeric params.
118
+ class SessionsController < ApplicationController
119
+ rate_limit to: 10, within: 3.minutes, only: :create
120
+ end
394
121
 
395
- Previously it was impossible to permit different fields on numeric parameters.
396
- After this change you can specify different fields for each numbered parameter.
397
- For example params like,
398
- ```ruby
399
- book: {
400
- authors_attributes: {
401
- '0': { name: "William Shakespeare", age_of_death: "52" },
402
- '1': { name: "Unattributed Assistant" },
403
- '2': "Not a hash",
404
- 'new_record': { name: "Some name" }
405
- }
406
- }
122
+ class SignupsController < ApplicationController
123
+ rate_limit to: 1000, within: 10.seconds,
124
+ by: -> { request.domain }, with: -> { redirect_to busy_controller_url, alert: "Too many signups!" }, only: :new
125
+ end
407
126
  ```
408
127
 
409
- Before you could permit name on each author with,
410
- `permit book: { authors_attributes: [ :name ] }`
411
-
412
- After this change you can permit different keys on each numbered element,
413
- `permit book: { authors_attributes: { '1': [ :name ], '0': [ :name, :age_of_death ] } }`
414
-
415
- Fixes #41625
416
-
417
- *Adam Hess*
418
-
419
- * Update `HostAuthorization` middleware to render debug info only
420
- when `config.consider_all_requests_local` is set to true.
421
-
422
- Also, blocked host info is always logged with level `error`.
423
-
424
- Fixes #42813
425
-
426
- *Nikita Vyrko*
427
-
428
- * Add Server-Timing middleware
429
-
430
- Server-Timing specification defines how the server can communicate to browsers performance metrics
431
- about the request it is responding to.
432
-
433
- The ServerTiming middleware is enabled by default on `development` environment by default using the
434
- `config.server_timing` setting and set the relevant duration metrics in the `Server-Timing` header
435
-
436
- The full specification for Server-Timing header can be found in: https://www.w3.org/TR/server-timing/#dfn-server-timing-header-field
437
-
438
- *Sebastian Sogamoso*, *Guillermo Iguaran*
439
-
440
-
441
- ## Rails 7.0.0.alpha2 (September 15, 2021) ##
442
-
443
- * No changes.
444
-
445
-
446
- ## Rails 7.0.0.alpha1 (September 15, 2021) ##
447
-
448
- * Use a static error message when raising `ActionDispatch::Http::Parameters::ParseError`
449
- to avoid inadvertently logging the HTTP request body at the `fatal` level when it contains
450
- malformed JSON.
451
-
452
- Fixes #41145
453
-
454
- *Aaron Lahey*
128
+ *DHH*, *Jean Boussier*
455
129
 
456
- * Add `Middleware#delete!` to delete middleware or raise if not found.
130
+ * Add `image/svg+xml` to the compressible content types of `ActionDispatch::Static`.
457
131
 
458
- `Middleware#delete!` works just like `Middleware#delete` but will
459
- raise an error if the middleware isn't found.
132
+ *Georg Ledermann*
460
133
 
461
- *Alex Ghiculescu*, *Petrik de Heus*, *Junichi Sato*
134
+ * Add instrumentation for `ActionController::Live#send_stream`.
462
135
 
463
- * Raise error on unpermitted open redirects.
136
+ Allows subscribing to `send_stream` events. The event payload contains the filename, disposition, and type.
464
137
 
465
- Add `allow_other_host` options to `redirect_to`.
466
- Opt in to this behaviour with `ActionController::Base.raise_on_open_redirects = true`.
138
+ *Hannah Ramadan*
467
139
 
468
- *Gannon McGibbon*
469
-
470
- * Deprecate `poltergeist` and `webkit` (capybara-webkit) driver registration for system testing (they will be removed in Rails 7.1). Add `cuprite` instead.
471
-
472
- [Poltergeist](https://github.com/teampoltergeist/poltergeist) and [capybara-webkit](https://github.com/thoughtbot/capybara-webkit) are already not maintained. These usage in Rails are removed for avoiding confusing users.
473
-
474
- [Cuprite](https://github.com/rubycdp/cuprite) is a good alternative to Poltergeist. Some guide descriptions are replaced from Poltergeist to Cuprite.
475
-
476
- *Yusuke Iwaki*
477
-
478
- * Exclude additional flash types from `ActionController::Base.action_methods`.
479
-
480
- Ensures that additional flash types defined on ActionController::Base subclasses
481
- are not listed as actions on that controller.
482
-
483
- class MyController < ApplicationController
484
- add_flash_types :hype
485
- end
486
-
487
- MyController.action_methods.include?('hype') # => false
488
-
489
- *Gavin Morrice*
490
-
491
- * OpenSSL constants are now used for Digest computations.
492
-
493
- *Dirkjan Bussink*
494
-
495
- * Remove IE6-7-8 file download related hack/fix from ActionController::DataStreaming module.
496
-
497
- Due to the age of those versions of IE this fix is no longer relevant, more importantly it creates an edge-case for unexpected Cache-Control headers.
498
-
499
- *Tadas Sasnauskas*
500
-
501
- * Configuration setting to skip logging an uncaught exception backtrace when the exception is
502
- present in `rescued_responses`.
503
-
504
- It may be too noisy to get all backtraces logged for applications that manage uncaught
505
- exceptions via `rescued_responses` and `exceptions_app`.
506
- `config.action_dispatch.log_rescued_responses` (defaults to `true`) can be set to `false` in
507
- this case, so that only exceptions not found in `rescued_responses` will be logged.
508
-
509
- *Alexander Azarov*, *Mike Dalessio*
510
-
511
- * Ignore file fixtures on `db:fixtures:load`.
512
-
513
- *Kevin Sjöberg*
514
-
515
- * Fix ActionController::Live controller test deadlocks by removing the body buffer size limit for tests.
516
-
517
- *Dylan Thacker-Smith*
518
-
519
- * New `ActionController::ConditionalGet#no_store` method to set HTTP cache control `no-store` directive.
520
-
521
- *Tadas Sasnauskas*
522
-
523
- * Drop support for the `SERVER_ADDR` header.
524
-
525
- Following up https://github.com/rack/rack/pull/1573 and https://github.com/rails/rails/pull/42349.
526
-
527
- *Ricardo Díaz*
528
-
529
- * Set session options when initializing a basic session.
140
+ * Add support for `with_routing` test helper in `ActionDispatch::IntegrationTest`.
530
141
 
531
142
  *Gannon McGibbon*
532
143
 
533
- * Add `cache_control: {}` option to `fresh_when` and `stale?`.
534
-
535
- Works as a shortcut to set `response.cache_control` with the above methods.
536
-
537
- *Jacopo Beschi*
538
-
539
- * Writing into a disabled session will now raise an error.
540
-
541
- Previously when no session store was set, writing into the session would silently fail.
542
-
543
- *Jean Boussier*
144
+ * Remove deprecated support to set `Rails.application.config.action_dispatch.show_exceptions` to `true` and `false`.
544
145
 
545
- * Add support for 'require-trusted-types-for' and 'trusted-types' headers.
546
-
547
- Fixes #42034.
548
-
549
- *lfalcao*
550
-
551
- * Remove inline styles and address basic accessibility issues on rescue templates.
552
-
553
- *Jacob Herrington*
554
-
555
- * Add support for 'private, no-store' Cache-Control headers.
556
-
557
- Previously, 'no-store' was exclusive; no other directives could be specified.
558
-
559
- *Alex Smith*
560
-
561
- * Expand payload of `unpermitted_parameters.action_controller` instrumentation to allow subscribers to
562
- know which controller action received unpermitted parameters.
563
-
564
- *bbuchalter*
565
-
566
- * Add `ActionController::Live#send_stream` that makes it more convenient to send generated streams:
567
-
568
- ```ruby
569
- send_stream(filename: "subscribers.csv") do |stream|
570
- stream.writeln "email_address,updated_at"
571
-
572
- @subscribers.find_each do |subscriber|
573
- stream.writeln [ subscriber.email_address, subscriber.updated_at ].join(",")
574
- end
575
- end
576
- ```
577
-
578
- *DHH*
579
-
580
- * Add `ActionController::Live::Buffer#writeln` to write a line to the stream with a newline included.
581
-
582
- *DHH*
583
-
584
- * `ActionDispatch::Request#content_type` now returned Content-Type header as it is.
585
-
586
- Previously, `ActionDispatch::Request#content_type` returned value does NOT contain charset part.
587
- This behavior changed to returned Content-Type header containing charset part as it is.
146
+ *Rafael Mendonça França*
588
147
 
589
- If you want just MIME type, please use `ActionDispatch::Request#media_type` instead.
148
+ * Remove deprecated `speaker`, `vibrate`, and `vr` permissions policy directives.
590
149
 
591
- Before:
150
+ *Rafael Mendonça França*
592
151
 
593
- ```ruby
594
- request = ActionDispatch::Request.new("CONTENT_TYPE" => "text/csv; header=present; charset=utf-16", "REQUEST_METHOD" => "GET")
595
- request.content_type #=> "text/csv"
596
- ```
152
+ * Remove deprecated `Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type`.
597
153
 
598
- After:
154
+ *Rafael Mendonça França*
599
155
 
600
- ```ruby
601
- request = ActionDispatch::Request.new("Content-Type" => "text/csv; header=present; charset=utf-16", "REQUEST_METHOD" => "GET")
602
- request.content_type #=> "text/csv; header=present; charset=utf-16"
603
- request.media_type #=> "text/csv"
604
- ```
156
+ * Deprecate `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
605
157
 
606
158
  *Rafael Mendonça França*
607
159
 
608
- * Change `ActionDispatch::Request#media_type` to return `nil` when the request don't have a `Content-Type` header.
160
+ * Remove deprecated comparison between `ActionController::Parameters` and `Hash`.
609
161
 
610
162
  *Rafael Mendonça França*
611
163
 
612
- * Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
164
+ * Remove deprecated constant `AbstractController::Helpers::MissingHelperError`.
613
165
 
614
- *Janko Marohnić*
166
+ *Rafael Mendonça França*
615
167
 
616
- * Allow anything with `#to_str` (like `Addressable::URI`) as a `redirect_to` location.
168
+ * Fix a race condition that could cause a `Text file busy - chromedriver`
169
+ error with parallel system tests.
617
170
 
618
- *ojab*
171
+ *Matt Brictson*
619
172
 
620
- * Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
173
+ * Add `racc` as a dependency since it will become a bundled gem in Ruby 3.4.0
621
174
 
622
- *Alex Robbin*
175
+ *Hartley McGuire*
176
+ * Remove deprecated constant `ActionDispatch::IllegalStateError`.
623
177
 
624
- * Deprecate the ability to assign a single value to `config.action_dispatch.trusted_proxies`
625
- as `RemoteIp` middleware behaves inconsistently depending on whether this is configured
626
- with a single value or an enumerable.
178
+ *Rafael Mendonça França*
627
179
 
628
- Fixes #40772.
180
+ * Add parameter filter capability for redirect locations.
629
181
 
630
- *Christian Sutter*
182
+ It uses the `config.filter_parameters` to match what needs to be filtered.
183
+ The result would be like this:
631
184
 
632
- * Add `redirect_back_or_to(fallback_location, **)` as a more aesthetically pleasing version of `redirect_back fallback_location:, **`.
633
- The old method name is retained without explicit deprecation.
185
+ Redirected to http://secret.foo.bar?username=roque&password=[FILTERED]
634
186
 
635
- *DHH*
187
+ Fixes #14055.
636
188
 
189
+ *Roque Pinel*, *Trevor Turk*, *tonytonyjan*
637
190
 
638
- Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionpack/CHANGELOG.md) for previous changes.
191
+ Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionpack/CHANGELOG.md) for previous changes.