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