actionpack 7.2.3.1 → 8.1.4.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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +606 -120
  3. data/lib/abstract_controller/asset_paths.rb +4 -2
  4. data/lib/abstract_controller/base.rb +11 -5
  5. data/lib/abstract_controller/caching.rb +6 -3
  6. data/lib/abstract_controller/callbacks.rb +6 -0
  7. data/lib/abstract_controller/logger.rb +2 -1
  8. data/lib/abstract_controller/rendering.rb +0 -1
  9. data/lib/action_controller/api.rb +1 -0
  10. data/lib/action_controller/base.rb +3 -2
  11. data/lib/action_controller/caching.rb +1 -2
  12. data/lib/action_controller/form_builder.rb +4 -4
  13. data/lib/action_controller/log_subscriber.rb +22 -3
  14. data/lib/action_controller/metal/allow_browser.rb +12 -2
  15. data/lib/action_controller/metal/conditional_get.rb +30 -1
  16. data/lib/action_controller/metal/data_streaming.rb +5 -5
  17. data/lib/action_controller/metal/exceptions.rb +5 -0
  18. data/lib/action_controller/metal/flash.rb +1 -4
  19. data/lib/action_controller/metal/head.rb +3 -1
  20. data/lib/action_controller/metal/http_authentication.rb +1 -1
  21. data/lib/action_controller/metal/instrumentation.rb +1 -2
  22. data/lib/action_controller/metal/live.rb +83 -31
  23. data/lib/action_controller/metal/permissions_policy.rb +9 -0
  24. data/lib/action_controller/metal/rate_limiting.rb +39 -9
  25. data/lib/action_controller/metal/redirecting.rb +107 -14
  26. data/lib/action_controller/metal/renderers.rb +29 -9
  27. data/lib/action_controller/metal/rendering.rb +16 -3
  28. data/lib/action_controller/metal/request_forgery_protection.rb +18 -10
  29. data/lib/action_controller/metal/rescue.rb +9 -0
  30. data/lib/action_controller/metal/streaming.rb +5 -84
  31. data/lib/action_controller/metal/strong_parameters.rb +294 -98
  32. data/lib/action_controller/railtie.rb +35 -15
  33. data/lib/action_controller/structured_event_subscriber.rb +116 -0
  34. data/lib/action_controller/test_case.rb +12 -2
  35. data/lib/action_dispatch/http/cache.rb +143 -12
  36. data/lib/action_dispatch/http/content_security_policy.rb +14 -1
  37. data/lib/action_dispatch/http/filter_parameters.rb +5 -3
  38. data/lib/action_dispatch/http/mime_negotiation.rb +66 -2
  39. data/lib/action_dispatch/http/mime_types.rb +1 -0
  40. data/lib/action_dispatch/http/param_builder.rb +187 -0
  41. data/lib/action_dispatch/http/param_error.rb +26 -0
  42. data/lib/action_dispatch/http/parameters.rb +3 -3
  43. data/lib/action_dispatch/http/permissions_policy.rb +8 -1
  44. data/lib/action_dispatch/http/query_parser.rb +55 -0
  45. data/lib/action_dispatch/http/request.rb +70 -21
  46. data/lib/action_dispatch/http/response.rb +52 -17
  47. data/lib/action_dispatch/http/url.rb +112 -16
  48. data/lib/action_dispatch/journey/formatter.rb +5 -0
  49. data/lib/action_dispatch/journey/gtg/simulator.rb +33 -12
  50. data/lib/action_dispatch/journey/gtg/transition_table.rb +33 -41
  51. data/lib/action_dispatch/journey/nodes/node.rb +2 -1
  52. data/lib/action_dispatch/journey/parser.rb +99 -196
  53. data/lib/action_dispatch/journey/route.rb +45 -31
  54. data/lib/action_dispatch/journey/router/utils.rb +9 -15
  55. data/lib/action_dispatch/journey/router.rb +59 -81
  56. data/lib/action_dispatch/journey/routes.rb +7 -0
  57. data/lib/action_dispatch/journey/scanner.rb +44 -42
  58. data/lib/action_dispatch/journey/visitors.rb +55 -23
  59. data/lib/action_dispatch/journey/visualizer/fsm.js +4 -6
  60. data/lib/action_dispatch/log_subscriber.rb +7 -3
  61. data/lib/action_dispatch/middleware/cookies.rb +24 -5
  62. data/lib/action_dispatch/middleware/debug_exceptions.rb +24 -5
  63. data/lib/action_dispatch/middleware/debug_view.rb +11 -5
  64. data/lib/action_dispatch/middleware/exception_wrapper.rb +12 -12
  65. data/lib/action_dispatch/middleware/executor.rb +12 -2
  66. data/lib/action_dispatch/middleware/host_authorization.rb +3 -2
  67. data/lib/action_dispatch/middleware/public_exceptions.rb +1 -5
  68. data/lib/action_dispatch/middleware/remote_ip.rb +61 -24
  69. data/lib/action_dispatch/middleware/request_id.rb +2 -1
  70. data/lib/action_dispatch/middleware/session/abstract_store.rb +5 -0
  71. data/lib/action_dispatch/middleware/session/cache_store.rb +44 -4
  72. data/lib/action_dispatch/middleware/session/cookie_store.rb +0 -3
  73. data/lib/action_dispatch/middleware/ssl.rb +13 -3
  74. data/lib/action_dispatch/middleware/templates/rescues/_copy_button.html.erb +1 -0
  75. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +3 -5
  76. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +9 -5
  77. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +1 -0
  78. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +1 -0
  79. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +4 -0
  80. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +3 -0
  81. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +50 -0
  82. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +1 -0
  83. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +1 -0
  84. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +7 -8
  85. data/lib/action_dispatch/middleware/templates/rescues/routing_error.text.erb +1 -1
  86. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +1 -0
  87. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +1 -0
  88. data/lib/action_dispatch/railtie.rb +21 -0
  89. data/lib/action_dispatch/request/session.rb +1 -0
  90. data/lib/action_dispatch/request/utils.rb +9 -3
  91. data/lib/action_dispatch/routing/inspector.rb +80 -57
  92. data/lib/action_dispatch/routing/mapper.rb +404 -223
  93. data/lib/action_dispatch/routing/polymorphic_routes.rb +2 -2
  94. data/lib/action_dispatch/routing/redirection.rb +10 -7
  95. data/lib/action_dispatch/routing/route_set.rb +21 -12
  96. data/lib/action_dispatch/routing/routes_proxy.rb +1 -0
  97. data/lib/action_dispatch/structured_event_subscriber.rb +20 -0
  98. data/lib/action_dispatch/system_test_case.rb +3 -3
  99. data/lib/action_dispatch/system_testing/browser.rb +15 -22
  100. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +2 -2
  101. data/lib/action_dispatch/testing/assertions/response.rb +26 -2
  102. data/lib/action_dispatch/testing/assertions/routing.rb +27 -15
  103. data/lib/action_dispatch/testing/integration.rb +18 -7
  104. data/lib/action_dispatch/testing/test_helpers/page_dump_helper.rb +1 -1
  105. data/lib/action_dispatch.rb +14 -4
  106. data/lib/action_pack/gem_version.rb +3 -3
  107. metadata +18 -48
  108. data/lib/action_dispatch/journey/parser.y +0 -50
  109. data/lib/action_dispatch/journey/parser_extras.rb +0 -33
data/CHANGELOG.md CHANGED
@@ -1,244 +1,730 @@
1
- ## Rails 7.2.3.1 (March 23, 2026) ##
1
+ ## Rails 8.1.4.1 (November 03, 2026) ##
2
2
 
3
- * No changes.
3
+ * Apply `config.action_dispatch.cookies_same_site_protection` to every session
4
+ store.
4
5
 
6
+ `ActionDispatch::Session::CacheStore`, `MemCacheStore` and third-party
7
+ stores built on `AbstractStore` or the session mixins sent session cookies
8
+ with no `SameSite` attribute. Only `CookieStore` applied the configured
9
+ default.
5
10
 
6
- ## Rails 7.2.3 (October 28, 2025) ##
11
+ [GHSA-gmj8-hvj3-49mw]
7
12
 
8
- * Submit test requests using `as: :html` with `Content-Type: x-www-form-urlencoded`
13
+ *Jean Boussier*
9
14
 
10
- *Sean Doyle*
15
+ * Prevent `ActionController::Live` streams from blocking when a full buffer is
16
+ closed or aborted.
11
17
 
12
- * Address `rack 3.2` deprecations warnings.
18
+ [GHSA-rwvh-fw6r-pwvp]
13
19
 
14
- ```
15
- warning: Status code :unprocessable_entity is deprecated and will be removed in a future version of Rack.
16
- Please use :unprocessable_content instead.
20
+ *Jeremy Daer*
21
+
22
+ * Set and extend the `Vary` header for rendered responses according to the
23
+ request headers used in format negotiation.
24
+
25
+ `Vary: Accept` was only added when the request carried a usable `Accept`
26
+ header. A response to a request without one, negotiated to HTML or
27
+ JavaScript, could be stored by a shared cache and served to later clients
28
+ that requested a different representation.
29
+
30
+ Responses now vary on `Accept` and `X-Requested-With` whenever the format is
31
+ not given by the URL. XHR requests without `Accept` also vary on
32
+ `Content-Type`, which Rails uses as a legacy format fallback. When
33
+ `config.action_dispatch.ignore_accept_header` is enabled, responses vary
34
+ only on `X-Requested-With`.
35
+
36
+ These fields are appended to an existing `Vary` value without duplicating
37
+ fields case-insensitively. `Vary: *` remains unchanged.
38
+
39
+ [GHSA-r9jg-fmfx-2gv6]
40
+
41
+ *Jeremy Daer*
42
+
43
+ * Skip writing a `CacheStore` session that another request deleted while this
44
+ one ran.
45
+
46
+ A request that loaded a session from `ActionDispatch::Session::CacheStore`
47
+ wrote it back when it finished, even after a concurrent `reset_session` or a
48
+ server-side delete had removed it, so the old session ID worked again.
49
+
50
+ [GHSA-2586-8ghr-69fj]
51
+
52
+ *Mike Dalessio*
53
+
54
+ * Don't write upgraded cookies to a response that skips the session.
55
+
56
+ Reading a signed or encrypted cookie written under a rotated secret, or in
57
+ the format a `:hybrid` serializer migrates from, writes it back in the
58
+ current format. That write ignored `request.session_options[:skip]`, so a
59
+ response that skips the session, such as the Active Storage proxy's
60
+ public, cacheable response, could still carry the session cookie in
61
+ `Set-Cookie`. Such a response now leaves the cookie unchanged, and a later
62
+ request that does not skip the session upgrades it. An application that
63
+ skips the session on every request no longer upgrades its signed or
64
+ encrypted cookies. Cookies the application sets are still written.
65
+
66
+ [GHSA-x6mj-8jx9-qhqv]
67
+
68
+ *Mike Dalessio*
69
+
70
+ * Detect conflicts between the `Forwarded` and `X-Forwarded-For` headers in
71
+ `ActionDispatch::RemoteIp`.
72
+
73
+ When `ip_spoofing_check` is enabled (the default), requests carrying both
74
+ headers with conflicting client addresses now raise
75
+ `ActionDispatch::RemoteIp::IpSpoofAttackError`.
76
+
77
+ [GHSA-2gff-2mmg-m73p]
78
+
79
+ *Gannon McGibbon*, *Mike Dalessio*
80
+
81
+ * `ActionController::Parameters#each_key` returns `self` when given a block.
82
+
83
+ It returned the internal `ActiveSupport::HashWithIndifferentAccess`, which
84
+ does not respond to `permitted?`, so passing that return value to mass
85
+ assignment skipped the Strong Parameters check. `each`, `each_pair` and
86
+ `each_value` already return `self`.
87
+
88
+ Document that `ActionController::Parameters#as_json` returns every
89
+ parameter, permitted or not, in a hash that mass assignment does not check.
90
+
91
+ [GHSA-wm3x-v3qw-4jh3]
92
+
93
+ *Mike Dalessio*
94
+
95
+ ## Rails 8.1.4 (September 24, 2026) ##
96
+
97
+ * Fix the debug error page to not attempt to read source fragments from
98
+ directory paths.
99
+
100
+ *Marco Roth*
101
+
102
+ * Apply source value mappings to dynamic Permissions Policy sources.
103
+
104
+ Dynamic Permissions Policy sources (procs) now have source mappings applied
105
+ to their resolved values, the same as static sources.
106
+
107
+ *Kenta Ishizaki*
108
+
109
+ * Allow `ActionDispatch::Http::URL.path_for` with `trailing_slash: true` and a
110
+ blank path to accept query params and an anchor.
111
+
112
+ Previously the blank path used a frozen `"/"`, which raised a `FrozenError`
113
+ when appending the query string.
114
+
115
+ *Kenta Ishizaki*
116
+
117
+ * Avoid mutating the `params` hash passed to `ActionDispatch::Http::URL.url_for`.
118
+
119
+ *Kenta Ishizaki*
120
+
121
+ * Honor falsy values (e.g. `format: false`, `anchor: false`) passed in the
122
+ deprecated positional-hash form of routing DSL methods.
123
+
124
+ Previously, `false` values were silently dropped without emitting a
125
+ deprecation warning, causing the deprecated hash form to produce different
126
+ routes than the keyword form.
127
+
128
+ *Kenta Ishizaki*
129
+
130
+ * Honor the deprecated `namespace` hash `:path`, `:shallow_path`, and
131
+ `:shallow_prefix` options when passed as `false`.
132
+
133
+ *Kenta Ishizaki*
134
+
135
+ * Fix the deprecated `scope` hash `:except` option to apply to `except`
136
+ instead of `only`.
137
+
138
+ *Kenta Ishizaki*
139
+
140
+ * Reject malformed hosts with extra ports in `ActionDispatch::HostAuthorization`.
141
+
142
+ When an allowed host is configured with an explicit port, a `Host` header
143
+ with an additional port (e.g. `www.example.com:80:80`) is no longer accepted.
144
+
145
+ *Andrii Furmanets*
146
+
147
+ * Fix `url_for` to leave out an optional part of a route when its value is a
148
+ blank string, the same way it already does for `nil`.
149
+
150
+ Before, the blank string ended up in the path, producing a URL the route
151
+ itself cannot match:
152
+
153
+ ```ruby
154
+ get "(/locale/:locale)/products(/:id)", to: "products#show"
155
+
156
+ url_for(controller: "products", action: "show", locale: "", id: 123)
157
+ # Before: "/locale//products/123"
158
+ # After: "/products/123"
17
159
  ```
18
160
 
19
- Rails API will transparently convert one into the other for the forseable future.
161
+ Blank strings for required parameters behave as before.
20
162
 
21
- *Earlopain*, *Jean Boussier*
163
+ *Carl Dawson*
22
164
 
23
- * Always return empty body for HEAD requests in `PublicExceptions` and
24
- `DebugExceptions`.
165
+ * Fix path normalization to handle mixed-case percent-encoding.
25
166
 
26
- This is required by `Rack::Lint` (per RFC9110).
167
+ *Andrii Furmanets*
27
168
 
28
- *Hartley McGuire*
169
+ * Avoid loading `ActionController::Live` early in initializer, and introduce
170
+ `action_controller_live` load hook.
29
171
 
30
- * Fix `url_for` to handle `:path_params` gracefully when it's not a `Hash`.
172
+ *Adrianna Chang*
31
173
 
32
- Prevents various security scanners from causing exceptions.
174
+ * Set the browser binary when preloading the Selenium driver for system tests.
33
175
 
34
- *Martin Emde*
176
+ Selenium 4.45 stopped setting it as a side effect of getting the driver path,
177
+ causing tests to fail with "cannot find Chrome binary".
35
178
 
36
- * Fix `ActionDispatch::Executor` to unwrap exceptions like other error reporting middlewares.
179
+ *Titus Fortner*
37
180
 
38
- *Jean Boussier*
181
+ * Fix `Session::CacheStore` to not generate a new session after dropping the current one.
182
+
183
+ *Kenta Ishizaki*
184
+
185
+ * Parse all three HTTP-date formats in the `If-Modified-Since` request header.
39
186
 
40
- * Fix NoMethodError when a non-string CSRF token is passed through headers.
187
+ `If-Modified-Since` carries an HTTP-date, which RFC 9110 allows in any of
188
+ three formats (IMF-fixdate, RFC 850, or asctime), and requires recipients to
189
+ accept all three. The header was parsed with `Time.rfc2822`, which only
190
+ accepts the IMF-fixdate format, and the parse failure was swallowed — so a
191
+ conditional `GET` using an RFC 850 or asctime date silently failed to produce
192
+ a `304 Not Modified` and re-sent the full response. It is now parsed with
193
+ `Time.httpdate`, consistent with how `Last-Modified` and `Date` are read.
41
194
 
42
- *Ryan Heneise*
195
+ *Kenta Ishizaki*
43
196
 
44
- * Fix invalid response when rescuing `ActionController::Redirecting::UnsafeRedirectError` in a controller.
197
+ * Fix response steam buffers compatibility with `IO.copy_stream`.
45
198
 
46
- *Alex Ghiculescu*
199
+ `IO.copy_stream(src, response.stream)` raised `TypeError: no implicit
200
+ conversion of Array into Integer` because `Buffer#write` returned the
201
+ buffer array instead of an Integer (bytes written). Additionally, the
202
+ written data could be silently corrupted because `IO.copy_stream`
203
+ reuses its internal string buffer after `write` returns — storing a
204
+ reference without `dup` meant the buffered content was later mutated.
47
205
 
206
+ Both `ActionDispatch::Response::Buffer#write` and
207
+ `ActionController::Live::Buffer#write` are affected.
48
208
 
49
- ## Rails 7.2.2.2 (August 13, 2025) ##
209
+ *Gabriel Quaresma*
210
+
211
+
212
+ ## Rails 8.1.3.1 (July 29, 2026) ##
50
213
 
51
214
  * No changes.
52
215
 
53
216
 
54
- ## Rails 7.2.2.1 (December 10, 2024) ##
217
+ ## Rails 8.1.3 (March 24, 2026) ##
55
218
 
56
- * Add validation to content security policies to disallow spaces and semicolons.
57
- Developers should use multiple arguments, and different directive methods instead.
219
+ * No changes.
58
220
 
59
- [CVE-2024-54133]
60
221
 
61
- *Gannon McGibbon*
222
+ ## Rails 8.1.2.1 (March 23, 2026) ##
62
223
 
224
+ * No changes.
63
225
 
64
- ## Rails 7.2.2 (October 30, 2024) ##
65
226
 
66
- * Fix non-GET requests not updating cookies in `ActionController::TestCase`.
227
+ ## Rails 8.1.2 (January 08, 2026) ##
67
228
 
68
- *Jon Moss*, *Hartley McGuire*
229
+ * Add `config.action_controller.live_streaming_excluded_keys` to control execution state sharing in ActionController::Live.
69
230
 
231
+ When using ActionController::Live, actions are executed in a separate thread that shares
232
+ state from the parent thread. This new configuration allows applications to opt-out specific
233
+ state keys that should not be shared.
70
234
 
71
- ## Rails 7.2.1.2 (October 23, 2024) ##
235
+ This is useful when streaming inside a `connected_to` block, where you may want
236
+ the streaming thread to use its own database connection context.
72
237
 
73
- * No changes.
238
+ ```ruby
239
+ # config/application.rb
240
+ config.action_controller.live_streaming_excluded_keys = [:active_record_connected_to_stack]
241
+ ```
74
242
 
243
+ By default, all keys are shared.
75
244
 
76
- ## Rails 7.2.1.1 (October 15, 2024) ##
245
+ *Eileen M. Uchitelle*
77
246
 
78
- * Avoid regex backtracking in HTTP Token authentication
247
+ * Fix `IpSpoofAttackError` message to include `Forwarded` header content.
79
248
 
80
- [CVE-2024-47887]
249
+ Without it, the error message may be misleading.
81
250
 
82
- *John Hawthorn*
251
+ *zzak*
83
252
 
84
- * Avoid regex backtracking in query parameter filtering
85
253
 
86
- [CVE-2024-41128]
254
+ ## Rails 8.1.1 (October 28, 2025) ##
87
255
 
88
- *John Hawthorn*
256
+ * Allow methods starting with underscore to be action methods.
89
257
 
258
+ Disallowing methods starting with an underscore from being action methods
259
+ was an unintended side effect of the performance optimization in
260
+ 207a254.
90
261
 
91
- ## Rails 7.2.1 (August 22, 2024) ##
262
+ Fixes #55985.
92
263
 
93
- * Fix `Request#raw_post` raising `NoMethodError` when `rack.input` is `nil`.
264
+ *Rafael Mendonça França*
94
265
 
95
- *Hartley McGuire*
96
266
 
267
+ ## Rails 8.1.0 (October 22, 2025) ##
97
268
 
98
- ## Rails 7.2.0 (August 09, 2024) ##
269
+ * Submit test requests using `as: :html` with `Content-Type: x-www-form-urlencoded`
99
270
 
100
- * Allow bots to ignore `allow_browser`.
271
+ *Sean Doyle*
272
+
273
+ * Add link-local IP ranges to `ActionDispatch::RemoteIp` default proxies.
274
+
275
+ Link-local addresses (`169.254.0.0/16` for IPv4 and `fe80::/10` for IPv6)
276
+ are now included in the default trusted proxy list, similar to private IP ranges.
277
+
278
+ *Adam Daniels*
279
+
280
+ * `remote_ip` will no longer ignore IPs in X-Forwarded-For headers if they
281
+ are accompanied by port information.
282
+
283
+ *Duncan Brown*, *Prevenios Marinos*, *Masafumi Koba*, *Adam Daniels*
284
+
285
+ * Add `action_dispatch.verbose_redirect_logs` setting that logs where redirects were called from.
101
286
 
102
- *Matthew Nguyen*
287
+ Similar to `active_record.verbose_query_logs` and `active_job.verbose_enqueue_logs`, this adds a line in your logs that shows where a redirect was called from.
103
288
 
104
- * Include the HTTP Permissions-Policy on non-HTML Content-Types
105
- [CVE-2024-28103]
289
+ Example:
106
290
 
107
- *Aaron Patterson*, *Zack Deveau*
291
+ ```
292
+ Redirected to http://localhost:3000/posts/1
293
+ ↳ app/controllers/posts_controller.rb:32:in `block (2 levels) in create'
294
+ ```
295
+
296
+ *Dennis Paagman*
297
+
298
+ * Add engine route filtering and better formatting in `bin/rails routes`.
299
+
300
+ Allow engine routes to be filterable in the routing inspector, and
301
+ improve formatting of engine routing output.
302
+
303
+ Before:
304
+ ```
305
+ > bin/rails routes -e engine_only
306
+ No routes were found for this grep pattern.
307
+ For more information about routes, see the Rails guide: https://guides.rubyonrails.org/routing.html.
308
+ ```
108
309
 
109
- * Fix `Mime::Type.parse` handling type parameters for HTTP Accept headers.
310
+ After:
311
+ ```
312
+ > bin/rails routes -e engine_only
313
+ Routes for application:
314
+ No routes were found for this grep pattern.
315
+ For more information about routes, see the Rails guide: https://guides.rubyonrails.org/routing.html.
316
+
317
+ Routes for Test::Engine:
318
+ Prefix Verb URI Pattern Controller#Action
319
+ engine GET /engine_only(.:format) a#b
320
+ ```
110
321
 
111
- *Taylor Chaparro*
322
+ *Dennis Paagman*, *Gannon McGibbon*
112
323
 
113
- * Fix the error page that is displayed when a view template is missing to account for nested controller paths in the
114
- suggested correct location for the missing template.
324
+ * Add structured events for Action Pack and Action Dispatch:
325
+ - `action_dispatch.redirect`
326
+ - `action_controller.request_started`
327
+ - `action_controller.request_completed`
328
+ - `action_controller.callback_halted`
329
+ - `action_controller.rescue_from_handled`
330
+ - `action_controller.file_sent`
331
+ - `action_controller.redirected`
332
+ - `action_controller.data_sent`
333
+ - `action_controller.unpermitted_parameters`
334
+ - `action_controller.fragment_cache`
115
335
 
116
- *Joshua Young*
336
+ *Adrianna Chang*
117
337
 
118
- * Add `save_and_open_page` helper to `IntegrationTest`.
338
+ * URL helpers for engines mounted at the application root handle `SCRIPT_NAME` correctly.
119
339
 
120
- `save_and_open_page` is a helpful helper to keep a short feedback loop when working on system tests.
121
- A similar helper with matching signature has been added to integration tests.
340
+ Fixed an issue where `SCRIPT_NAME` is not applied to paths generated for routes in an engine
341
+ mounted at "/".
122
342
 
123
- *Joé Dupuis*
343
+ *Mike Dalessio*
124
344
 
125
- * Fix a regression in 7.1.3 passing a `to:` option without a controller when the controller is already defined by a scope.
345
+ * Update `ActionController::Metal::RateLimiting` to support passing method names to `:by` and `:with`
126
346
 
127
347
  ```ruby
128
- Rails.application.routes.draw do
129
- controller :home do
130
- get "recent", to: "recent_posts"
131
- end
348
+ class SignupsController < ApplicationController
349
+ rate_limit to: 10, within: 1.minute, with: :redirect_with_flash
350
+
351
+ private
352
+ def redirect_with_flash
353
+ redirect_to root_url, alert: "Too many requests!"
354
+ end
132
355
  end
133
356
  ```
134
357
 
135
- *Étienne Barrié*
358
+ *Sean Doyle*
359
+
360
+ * Optimize `ActionDispatch::Http::URL.build_host_url` when protocol is included in host.
361
+
362
+ When using URL helpers with a host that includes the protocol (e.g., `{ host: "https://example.com" }`),
363
+ skip unnecessary protocol normalization and string duplication since the extracted protocol is already
364
+ in the correct format. This eliminates 2 string allocations per URL generation and provides a ~10%
365
+ performance improvement for this case.
366
+
367
+ *Joshua Young*, *Hartley McGuire*
368
+
369
+ * Allow `action_controller.logger` to be disabled by setting it to `nil` or `false` instead of always defaulting to `Rails.logger`.
370
+
371
+ *Roberto Miranda*
372
+
373
+ * Remove deprecated support to a route to multiple paths.
374
+
375
+ *Rafael Mendonça França*
376
+
377
+ * Remove deprecated support for using semicolons as a query string separator.
378
+
379
+ Before:
380
+
381
+ ```ruby
382
+ ActionDispatch::QueryParser.each_pair("foo=bar;baz=quux").to_a
383
+ # => [["foo", "bar"], ["baz", "quux"]]
384
+ ```
385
+
386
+ After:
387
+
388
+ ```ruby
389
+ ActionDispatch::QueryParser.each_pair("foo=bar;baz=quux").to_a
390
+ # => [["foo", "bar;baz=quux"]]
391
+ ```
392
+
393
+ *Rafael Mendonça França*
394
+
395
+ * Remove deprecated support to skipping over leading brackets in parameter names in the parameter parser.
396
+
397
+ Before:
398
+
399
+ ```ruby
400
+ ActionDispatch::ParamBuilder.from_query_string("[foo]=bar") # => { "foo" => "bar" }
401
+ ActionDispatch::ParamBuilder.from_query_string("[foo][bar]=baz") # => { "foo" => { "bar" => "baz" } }
402
+ ```
403
+
404
+ After:
405
+
406
+ ```ruby
407
+ ActionDispatch::ParamBuilder.from_query_string("[foo]=bar") # => { "[foo]" => "bar" }
408
+ ActionDispatch::ParamBuilder.from_query_string("[foo][bar]=baz") # => { "[foo]" => { "bar" => "baz" } }
409
+ ```
136
410
 
137
- * Request Forgery takes relative paths into account.
411
+ *Rafael Mendonça França*
138
412
 
139
- *Stefan Wienert*
413
+ * Deprecate `Rails.application.config.action_dispatch.ignore_leading_brackets`.
140
414
 
141
- * Add ".test" as a default allowed host in development to ensure smooth golden-path setup with puma.dev.
415
+ *Rafael Mendonça França*
416
+
417
+ * Raise `ActionController::TooManyRequests` error from `ActionController::RateLimiting`
418
+
419
+ Requests that exceed the rate limit raise an `ActionController::TooManyRequests` error.
420
+ By default, Action Dispatch rescues the error and responds with a `429 Too Many Requests` status.
421
+
422
+ *Sean Doyle*
423
+
424
+ * Add .md/.markdown as Markdown extensions and add a default `markdown:` renderer:
425
+
426
+ ```ruby
427
+ class Page
428
+ def to_markdown
429
+ body
430
+ end
431
+ end
432
+
433
+ class PagesController < ActionController::Base
434
+ def show
435
+ @page = Page.find(params[:id])
436
+
437
+ respond_to do |format|
438
+ format.html
439
+ format.md { render markdown: @page }
440
+ end
441
+ end
442
+ end
443
+ ```
142
444
 
143
445
  *DHH*
144
446
 
145
- * Add `allow_browser` to set minimum browser versions for the application.
447
+ * Add headers to engine routes inspection command
146
448
 
147
- 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".
449
+ *Petrik de Heus*
450
+
451
+ * Add "Copy as text" button to error pages
452
+
453
+ *Mikkel Malmberg*
454
+
455
+ * Add `scope:` option to `rate_limit` method.
456
+
457
+ Previously, it was not possible to share a rate limit count between several controllers, since the count was by
458
+ default separate for each controller.
459
+
460
+ Now, the `scope:` option solves this problem.
148
461
 
149
462
  ```ruby
150
- class ApplicationController < ActionController::Base
151
- # Allow only browsers natively supporting webp images, web push, badges, import maps, CSS nesting + :has
152
- allow_browser versions: :modern
463
+ class APIController < ActionController::API
464
+ rate_limit to: 2, within: 2.seconds, scope: "api"
153
465
  end
154
466
 
155
- class ApplicationController < ActionController::Base
156
- # 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+.
157
- allow_browser versions: { safari: 16.4, firefox: 121, ie: false }
467
+ class API::PostsController < APIController
468
+ # ...
158
469
  end
159
470
 
160
- class MessagesController < ApplicationController
161
- # In addition to the browsers blocked by ApplicationController, also block Opera below 104 and Chrome below 119 for the show action.
162
- allow_browser versions: { opera: 104, chrome: 119 }, only: :show
471
+ class API::UsersController < APIController
472
+ # ...
163
473
  end
164
474
  ```
165
475
 
166
- *DHH*
476
+ *ArthurPV*, *Kamil Hanus*
477
+
478
+ * Add support for `rack.response_finished` callbacks in ActionDispatch::Executor.
479
+
480
+ The executor middleware now supports deferring completion callbacks to later
481
+ in the request lifecycle by utilizing Rack's `rack.response_finished` mechanism,
482
+ when available. This enables applications to define `rack.response_finished` callbacks
483
+ that may rely on state that would be cleaned up by the executor's completion callbacks.
484
+
485
+ *Adrianna Chang*, *Hartley McGuire*
486
+
487
+ * Produce a log when `rescue_from` is invoked.
488
+
489
+ *Steven Webb*, *Jean Boussier*
490
+
491
+ * Allow hosts redirects from `hosts` Rails configuration
492
+
493
+ ```ruby
494
+ config.action_controller.allowed_redirect_hosts << "example.com"
495
+ ```
496
+
497
+ *Kevin Robatel*
498
+
499
+ * `rate_limit.action_controller` notification has additional payload
500
+
501
+ additional values: count, to, within, by, name, cache_key
502
+
503
+ *Jonathan Rochkind*
504
+
505
+ * Add JSON support to the built-in health controller.
506
+
507
+ The health controller now responds to JSON requests with a structured response
508
+ containing status and timestamp information. This makes it easier for monitoring
509
+ tools and load balancers to consume health check data programmatically.
510
+
511
+ ```ruby
512
+ # /up.json
513
+ {
514
+ "status": "up",
515
+ "timestamp": "2025-09-19T12:00:00Z"
516
+ }
517
+ ```
518
+
519
+ *Francesco Loreti*, *Juan Vásquez*
520
+
521
+ * Allow to open source file with a crash from the browser.
522
+
523
+ *Igor Kasyanchuk*
524
+
525
+ * Always check query string keys for valid encoding just like values are checked.
526
+
527
+ *Casper Smits*
528
+
529
+ * Always return empty body for HEAD requests in `PublicExceptions` and
530
+ `DebugExceptions`.
531
+
532
+ This is required by `Rack::Lint` (per RFC9110).
533
+
534
+ *Hartley McGuire*
167
535
 
168
- * Add rate limiting API.
536
+ * Add comprehensive support for HTTP Cache-Control request directives according to RFC 9111.
537
+
538
+ Provides a `request.cache_control_directives` object that gives access to request cache directives:
539
+
540
+ ```ruby
541
+ # Boolean directives
542
+ request.cache_control_directives.only_if_cached? # => true/false
543
+ request.cache_control_directives.no_cache? # => true/false
544
+ request.cache_control_directives.no_store? # => true/false
545
+ request.cache_control_directives.no_transform? # => true/false
546
+
547
+ # Value directives
548
+ request.cache_control_directives.max_age # => integer or nil
549
+ request.cache_control_directives.max_stale # => integer or nil (or true for valueless max-stale)
550
+ request.cache_control_directives.min_fresh # => integer or nil
551
+ request.cache_control_directives.stale_if_error # => integer or nil
552
+
553
+ # Special helpers for max-stale
554
+ request.cache_control_directives.max_stale? # => true if max-stale present (with or without value)
555
+ request.cache_control_directives.max_stale_unlimited? # => true only for valueless max-stale
556
+ ```
557
+
558
+ Example usage:
169
559
 
170
560
  ```ruby
171
- class SessionsController < ApplicationController
172
- rate_limit to: 10, within: 3.minutes, only: :create
561
+ def show
562
+ if request.cache_control_directives.only_if_cached?
563
+ @article = Article.find_cached(params[:id])
564
+ return head(:gateway_timeout) if @article.nil?
565
+ else
566
+ @article = Article.find(params[:id])
567
+ end
568
+
569
+ render :show
173
570
  end
571
+ ```
174
572
 
175
- class SignupsController < ApplicationController
176
- rate_limit to: 1000, within: 10.seconds,
177
- by: -> { request.domain }, with: -> { redirect_to busy_controller_url, alert: "Too many signups!" }, only: :new
573
+ *egg528*
574
+
575
+ * Add assert_in_body/assert_not_in_body as the simplest way to check if a piece of text is in the response body.
576
+
577
+ *DHH*
578
+
579
+ * Include cookie name when calculating maximum allowed size.
580
+
581
+ *Hartley McGuire*
582
+
583
+ * Implement `must-understand` directive according to RFC 9111.
584
+
585
+ The `must-understand` directive indicates that a cache must understand the semantics of the response status code, or discard the response. This directive is enforced to be used only with `no-store` to ensure proper cache behavior.
586
+
587
+ ```ruby
588
+ class ArticlesController < ApplicationController
589
+ def show
590
+ @article = Article.find(params[:id])
591
+
592
+ if @article.special_format?
593
+ must_understand
594
+ render status: 203 # Non-Authoritative Information
595
+ else
596
+ fresh_when @article
597
+ end
598
+ end
178
599
  end
179
600
  ```
180
601
 
181
- *DHH*, *Jean Boussier*
602
+ *heka1024*
603
+
604
+ * The JSON renderer doesn't escape HTML entities or Unicode line separators anymore.
605
+
606
+ Using `render json:` will no longer escape `<`, `>`, `&`, `U+2028` and `U+2029` characters that can cause errors
607
+ when the resulting JSON is embedded in JavaScript, or vulnerabilities when the resulting JSON is embedded in HTML.
182
608
 
183
- * Add `image/svg+xml` to the compressible content types of `ActionDispatch::Static`.
609
+ Since the renderer is used to return a JSON document as `application/json`, it's typically not necessary to escape
610
+ those characters, and it improves performance.
184
611
 
185
- *Georg Ledermann*
612
+ Escaping will still occur when the `:callback` option is set, since the JSON is used as JavaScript code in this
613
+ situation (JSONP).
186
614
 
187
- * Add instrumentation for `ActionController::Live#send_stream`.
615
+ You can use the `:escape` option or set `config.action_controller.escape_json_responses` to `true` to restore the
616
+ escaping behavior.
188
617
 
189
- Allows subscribing to `send_stream` events. The event payload contains the filename, disposition, and type.
618
+ ```ruby
619
+ class PostsController < ApplicationController
620
+ def index
621
+ render json: Post.last(30), escape: true
622
+ end
623
+ end
624
+ ```
190
625
 
191
- *Hannah Ramadan*
626
+ *Étienne Barrié*, *Jean Boussier*
192
627
 
193
- * Add support for `with_routing` test helper in `ActionDispatch::IntegrationTest`.
628
+ * Load lazy route sets before inserting test routes
629
+
630
+ Without loading lazy route sets early, we miss `after_routes_loaded` callbacks, or risk
631
+ invoking them with the test routes instead of the real ones if another load is triggered by an engine.
194
632
 
195
633
  *Gannon McGibbon*
196
634
 
197
- * Remove deprecated support to set `Rails.application.config.action_dispatch.show_exceptions` to `true` and `false`.
635
+ * Raise `AbstractController::DoubleRenderError` if `head` is called after rendering.
198
636
 
199
- *Rafael Mendonça França*
637
+ After this change, invoking `head` will lead to an error if response body is already set:
638
+
639
+ ```ruby
640
+ class PostController < ApplicationController
641
+ def index
642
+ render locals: {}
643
+ head :ok
644
+ end
645
+ end
646
+ ```
200
647
 
201
- * Remove deprecated `speaker`, `vibrate`, and `vr` permissions policy directives.
648
+ *Iaroslav Kurbatov*
202
649
 
203
- *Rafael Mendonça França*
650
+ * The Cookie Serializer can now serialize an Active Support SafeBuffer when using message pack.
204
651
 
205
- * Remove deprecated `Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type`.
652
+ Such code would previously produce an error if an application was using messagepack as its cookie serializer.
206
653
 
207
- *Rafael Mendonça França*
654
+ ```ruby
655
+ class PostController < ApplicationController
656
+ def index
657
+ flash.notice = t(:hello_html) # This would try to serialize a SafeBuffer, which was not possible.
658
+ end
659
+ end
660
+ ```
208
661
 
209
- * Deprecate `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
662
+ *Edouard Chin*
210
663
 
211
- *Rafael Mendonça França*
664
+ * Fix `Rails.application.reload_routes!` from clearing almost all routes.
212
665
 
213
- * Remove deprecated comparison between `ActionController::Parameters` and `Hash`.
666
+ When calling `Rails.application.reload_routes!` inside a middleware of
667
+ a Rake task, it was possible under certain conditions that all routes would be cleared.
668
+ If ran inside a middleware, this would result in getting a 404 on most page you visit.
669
+ This issue was only happening in development.
214
670
 
215
- *Rafael Mendonça França*
671
+ *Edouard Chin*
216
672
 
217
- * Remove deprecated constant `AbstractController::Helpers::MissingHelperError`.
673
+ * Add resource name to the `ArgumentError` that's raised when invalid `:only` or `:except` options are given to `#resource` or `#resources`
218
674
 
219
- *Rafael Mendonça França*
675
+ This makes it easier to locate the source of the problem, especially for routes drawn by gems.
220
676
 
221
- * Fix a race condition that could cause a `Text file busy - chromedriver`
222
- error with parallel system tests.
677
+ Before:
678
+ ```
679
+ :only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
680
+ ```
223
681
 
224
- *Matt Brictson*
682
+ After:
683
+ ```
684
+ Route `resources :products` - :only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
685
+ ```
225
686
 
226
- * Add `racc` as a dependency since it will become a bundled gem in Ruby 3.4.0
687
+ *Jeremy Green*
227
688
 
228
- *Hartley McGuire*
229
- * Remove deprecated constant `ActionDispatch::IllegalStateError`.
689
+ * A route pointing to a non-existing controller now returns a 500 instead of a 404.
230
690
 
231
- *Rafael Mendonça França*
691
+ A controller not existing isn't a routing error that should result
692
+ in a 404, but a programming error that should result in a 500 and
693
+ be reported.
694
+
695
+ Until recently, this was hard to untangle because of the support
696
+ for dynamic `:controller` segment in routes, but since this is
697
+ deprecated and will be removed in Rails 8.1, we can now easily
698
+ not consider missing controllers as routing errors.
699
+
700
+ *Jean Boussier*
232
701
 
233
- * Add parameter filter capability for redirect locations.
702
+ * Add `check_collisions` option to `ActionDispatch::Session::CacheStore`.
234
703
 
235
- It uses the `config.filter_parameters` to match what needs to be filtered.
236
- The result would be like this:
704
+ Newly generated session ids use 128 bits of randomness, which is more than
705
+ enough to ensure collisions can't happen, but if you need to harden sessions
706
+ even more, you can enable this option to check in the session store that the id
707
+ is indeed free you can enable that option. This however incurs an extra write
708
+ on session creation.
237
709
 
238
- Redirected to http://secret.foo.bar?username=roque&password=[FILTERED]
710
+ *Shia*
239
711
 
240
- Fixes #14055.
712
+ * In ExceptionWrapper, match backtrace lines with built templates more often,
713
+ allowing improved highlighting of errors within do-end blocks in templates.
714
+ Fix for Ruby 3.4 to match new method labels in backtrace.
715
+
716
+ *Martin Emde*
717
+
718
+ * Allow setting content type with a symbol of the Mime type.
719
+
720
+ ```ruby
721
+ # Before
722
+ response.content_type = "text/html"
723
+
724
+ # After
725
+ response.content_type = :html
726
+ ```
241
727
 
242
- *Roque Pinel*, *Trevor Turk*, *tonytonyjan*
728
+ *Petrik de Heus*
243
729
 
244
- Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionpack/CHANGELOG.md) for previous changes.
730
+ Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionpack/CHANGELOG.md) for previous changes.