actionpack 6.1.7 → 7.0.0.alpha1

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

Potentially problematic release.


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

Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +99 -542
  3. data/MIT-LICENSE +2 -1
  4. data/README.rdoc +2 -3
  5. data/lib/abstract_controller/asset_paths.rb +1 -1
  6. data/lib/abstract_controller/base.rb +7 -21
  7. data/lib/abstract_controller/caching/fragments.rb +2 -2
  8. data/lib/abstract_controller/caching.rb +1 -1
  9. data/lib/abstract_controller/callbacks.rb +9 -8
  10. data/lib/abstract_controller/collector.rb +2 -2
  11. data/lib/abstract_controller/error.rb +1 -1
  12. data/lib/abstract_controller/helpers.rb +3 -2
  13. data/lib/abstract_controller/logger.rb +1 -1
  14. data/lib/abstract_controller/railties/routes_helpers.rb +2 -0
  15. data/lib/abstract_controller/translation.rb +0 -2
  16. data/lib/abstract_controller/url_for.rb +4 -6
  17. data/lib/action_controller/api.rb +1 -1
  18. data/lib/action_controller/log_subscriber.rb +3 -1
  19. data/lib/action_controller/metal/conditional_get.rb +38 -1
  20. data/lib/action_controller/metal/content_security_policy.rb +1 -1
  21. data/lib/action_controller/metal/cookies.rb +1 -1
  22. data/lib/action_controller/metal/data_streaming.rb +5 -13
  23. data/lib/action_controller/metal/exceptions.rb +19 -30
  24. data/lib/action_controller/metal/flash.rb +6 -2
  25. data/lib/action_controller/metal/http_authentication.rb +15 -16
  26. data/lib/action_controller/metal/instrumentation.rb +55 -52
  27. data/lib/action_controller/metal/live.rb +42 -2
  28. data/lib/action_controller/metal/mime_responds.rb +3 -3
  29. data/lib/action_controller/metal/params_wrapper.rb +7 -7
  30. data/lib/action_controller/metal/permissions_policy.rb +1 -1
  31. data/lib/action_controller/metal/query_tags.rb +16 -0
  32. data/lib/action_controller/metal/redirecting.rb +50 -16
  33. data/lib/action_controller/metal/rendering.rb +9 -9
  34. data/lib/action_controller/metal/request_forgery_protection.rb +64 -20
  35. data/lib/action_controller/metal/rescue.rb +1 -1
  36. data/lib/action_controller/metal/streaming.rb +1 -3
  37. data/lib/action_controller/metal/strong_parameters.rb +25 -29
  38. data/lib/action_controller/metal/testing.rb +0 -2
  39. data/lib/action_controller/metal.rb +7 -10
  40. data/lib/action_controller/railtie.rb +42 -5
  41. data/lib/action_controller/test_case.rb +6 -2
  42. data/lib/action_controller.rb +2 -5
  43. data/lib/action_dispatch/http/cache.rb +13 -6
  44. data/lib/action_dispatch/http/content_security_policy.rb +47 -37
  45. data/lib/action_dispatch/http/filter_parameters.rb +5 -0
  46. data/lib/action_dispatch/http/mime_negotiation.rb +13 -3
  47. data/lib/action_dispatch/http/mime_type.rb +9 -11
  48. data/lib/action_dispatch/http/parameters.rb +4 -4
  49. data/lib/action_dispatch/http/permissions_policy.rb +1 -1
  50. data/lib/action_dispatch/http/request.rb +10 -19
  51. data/lib/action_dispatch/http/response.rb +3 -3
  52. data/lib/action_dispatch/http/url.rb +9 -10
  53. data/lib/action_dispatch/journey/gtg/builder.rb +11 -12
  54. data/lib/action_dispatch/journey/gtg/simulator.rb +10 -4
  55. data/lib/action_dispatch/journey/gtg/transition_table.rb +77 -21
  56. data/lib/action_dispatch/journey/nodes/node.rb +70 -5
  57. data/lib/action_dispatch/journey/path/pattern.rb +22 -13
  58. data/lib/action_dispatch/journey/route.rb +5 -12
  59. data/lib/action_dispatch/journey/router/utils.rb +2 -2
  60. data/lib/action_dispatch/journey/router.rb +1 -1
  61. data/lib/action_dispatch/journey/routes.rb +3 -3
  62. data/lib/action_dispatch/journey/visualizer/fsm.js +49 -24
  63. data/lib/action_dispatch/journey/visualizer/index.html.erb +1 -1
  64. data/lib/action_dispatch/middleware/actionable_exceptions.rb +0 -1
  65. data/lib/action_dispatch/middleware/cookies.rb +7 -3
  66. data/lib/action_dispatch/middleware/debug_exceptions.rb +6 -4
  67. data/lib/action_dispatch/middleware/debug_locks.rb +3 -3
  68. data/lib/action_dispatch/middleware/exception_wrapper.rb +4 -0
  69. data/lib/action_dispatch/middleware/executor.rb +1 -1
  70. data/lib/action_dispatch/middleware/flash.rb +9 -11
  71. data/lib/action_dispatch/middleware/host_authorization.rb +25 -73
  72. data/lib/action_dispatch/middleware/remote_ip.rb +16 -4
  73. data/lib/action_dispatch/middleware/session/abstract_store.rb +1 -1
  74. data/lib/action_dispatch/middleware/show_exceptions.rb +6 -18
  75. data/lib/action_dispatch/middleware/stack.rb +50 -9
  76. data/lib/action_dispatch/middleware/static.rb +2 -5
  77. data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +1 -1
  78. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +4 -11
  79. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +2 -2
  80. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +2 -2
  81. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +4 -4
  82. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +3 -3
  83. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +28 -18
  84. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +3 -3
  85. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +3 -3
  86. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +3 -3
  87. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +3 -3
  88. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +3 -3
  89. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +5 -14
  90. data/lib/action_dispatch/railtie.rb +8 -2
  91. data/lib/action_dispatch/request/session.rb +43 -13
  92. data/lib/action_dispatch/routing/mapper.rb +44 -72
  93. data/lib/action_dispatch/routing/redirection.rb +0 -2
  94. data/lib/action_dispatch/routing/route_set.rb +7 -4
  95. data/lib/action_dispatch/routing/routes_proxy.rb +1 -1
  96. data/lib/action_dispatch/routing/url_for.rb +1 -2
  97. data/lib/action_dispatch/routing.rb +2 -2
  98. data/lib/action_dispatch/system_test_case.rb +6 -12
  99. data/lib/action_dispatch/system_testing/driver.rb +24 -4
  100. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +10 -6
  101. data/lib/action_dispatch/testing/assertions.rb +2 -5
  102. data/lib/action_dispatch/testing/integration.rb +6 -8
  103. data/lib/action_dispatch/testing/test_process.rb +2 -2
  104. data/lib/action_dispatch.rb +1 -1
  105. data/lib/action_pack/gem_version.rb +4 -4
  106. data/lib/action_pack.rb +1 -1
  107. metadata +21 -21
data/CHANGELOG.md CHANGED
@@ -1,122 +1,69 @@
1
- ## Rails 6.1.7 (September 09, 2022) ##
1
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
2
2
 
3
- * No changes.
3
+ * Use a static error message when raising `ActionDispatch::Http::Parameters::ParseError`
4
+ to avoid inadvertently logging the HTTP request body at the `fatal` level when it contains
5
+ malformed JSON.
4
6
 
7
+ Fixes #41145
5
8
 
6
- ## Rails 6.1.6.1 (July 12, 2022) ##
9
+ *Aaron Lahey*
7
10
 
8
- * No changes.
11
+ * Add `Middleware#delete!` to delete middleware or raise if not found.
9
12
 
13
+ `Middleware#delete!` works just like `Middleware#delete` but will
14
+ raise an error if the middleware isn't found.
10
15
 
11
- ## Rails 6.1.6 (May 09, 2022) ##
16
+ *Alex Ghiculescu*, *Petrik de Heus*, *Junichi Sato*
12
17
 
13
- * No changes.
18
+ * Raise error on unpermitted open redirects.
14
19
 
20
+ Add `allow_other_host` options to `redirect_to`.
21
+ Opt in to this behaviour with `ActionController::Base.raise_on_open_redirects = true`.
15
22
 
16
- ## Rails 6.1.5.1 (April 26, 2022) ##
17
-
18
- * Allow Content Security Policy DSL to generate for API responses.
19
-
20
- *Tim Wade*
21
-
22
- ## Rails 6.1.5 (March 09, 2022) ##
23
-
24
- * Fix `content_security_policy` returning invalid directives.
25
-
26
- Directives such as `self`, `unsafe-eval` and few others were not
27
- single quoted when the directive was the result of calling a lambda
28
- returning an array.
29
-
30
- ```ruby
31
- content_security_policy do |policy|
32
- policy.frame_ancestors lambda { [:self, "https://example.com"] }
33
- end
34
- ```
35
-
36
- With this fix the policy generated from above will now be valid.
37
-
38
- *Edouard Chin*
39
-
40
- * Update `HostAuthorization` middleware to render debug info only
41
- when `config.consider_all_requests_local` is set to true.
42
-
43
- Also, blocked host info is always logged with level `error`.
44
-
45
- Fixes #42813.
46
-
47
- *Nikita Vyrko*
48
-
49
- * Dup arrays that get "converted".
50
-
51
- Fixes #43681.
52
-
53
- *Aaron Patterson*
54
-
55
- * Don't show deprecation warning for equal paths.
56
-
57
- *Anton Rieder*
58
-
59
- * Fix crash in `ActionController::Instrumentation` with invalid HTTP formats.
60
-
61
- Fixes #43094.
62
-
63
- *Alex Ghiculescu*
64
-
65
- * Add fallback host for SystemTestCase driven by RackTest.
66
-
67
- Fixes #42780.
68
-
69
- *Petrik de Heus*
70
-
71
- * Add more detail about what hosts are allowed.
72
-
73
- *Alex Ghiculescu*
74
-
75
-
76
- ## Rails 6.1.4.7 (March 08, 2022) ##
77
-
78
- * No changes.
79
-
80
-
81
- ## Rails 6.1.4.6 (February 11, 2022) ##
82
-
83
- * No changes.
23
+ *Gannon McGibbon*
84
24
 
25
+ * Deprecate `poltergeist` and `webkit` (capybara-webkit) driver registration for system testing (they will be removed in Rails 7.1). Add `cuprite` instead.
85
26
 
86
- ## Rails 6.1.4.5 (February 11, 2022) ##
27
+ [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.
87
28
 
88
- * Under certain circumstances, the middleware isn't informed that the
89
- response body has been fully closed which result in request state not
90
- being fully reset before the next request
29
+ [Cuprite](https://github.com/rubycdp/cuprite) is a good alternative to Poltergeist. Some guide descriptions are replaced from Poltergeist to Cuprite.
91
30
 
92
- [CVE-2022-23633]
31
+ *Yusuke Iwaki*
93
32
 
33
+ * Exclude additional flash types from `ActionController::Base.action_methods`.
94
34
 
95
- ## Rails 6.1.4.4 (December 15, 2021) ##
35
+ Ensures that additional flash types defined on ActionController::Base subclasses
36
+ are not listed as actions on that controller.
96
37
 
97
- * Fix issue with host protection not allowing host with port in development.
38
+ class MyController < ApplicationController
39
+ add_flash_types :hype
40
+ end
98
41
 
42
+ MyController.action_methods.include?('hype') # => false
99
43
 
100
- ## Rails 6.1.4.3 (December 14, 2021) ##
44
+ *Gavin Morrice*
101
45
 
102
- * Fix issue with host protection not allowing localhost in development.
46
+ * OpenSSL constants are now used for Digest computations.
103
47
 
48
+ *Dirkjan Bussink*
104
49
 
105
- ## Rails 6.1.4.2 (December 14, 2021) ##
50
+ * Remove IE6-7-8 file download related hack/fix from ActionController::DataStreaming module.
106
51
 
107
- * Fix X_FORWARDED_HOST protection. [CVE-2021-44528]
52
+ 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.
108
53
 
109
- ## Rails 6.1.4.1 (August 19, 2021) ##
54
+ *Tadas Sasnauskas*
110
55
 
111
- * [CVE-2021-22942] Fix possible open redirect in Host Authorization middleware.
56
+ * Configuration setting to skip logging an uncaught exception backtrace when the exception is
57
+ present in `rescued_responses`.
112
58
 
113
- Specially crafted "X-Forwarded-Host" headers in combination with certain
114
- "allowed host" formats can cause the Host Authorization middleware in Action
115
- Pack to redirect users to a malicious website.
59
+ It may be too noisy to get all backtraces logged for applications that manage uncaught
60
+ exceptions via `rescued_responses` and `exceptions_app`.
61
+ `config.action_dispatch.log_rescued_responses` (defaults to `true`) can be set to `false` in
62
+ this case, so that only exceptions not found in `rescued_responses` will be logged.
116
63
 
117
- ## Rails 6.1.4 (June 24, 2021) ##
64
+ *Alexander Azarov*, *Mike Dalessio*
118
65
 
119
- * Ignore file fixtures on `db:fixtures:load`
66
+ * Ignore file fixtures on `db:fixtures:load`.
120
67
 
121
68
  *Kevin Sjöberg*
122
69
 
@@ -124,513 +71,123 @@
124
71
 
125
72
  *Dylan Thacker-Smith*
126
73
 
127
- * Correctly place optional path parameter booleans.
128
-
129
- Previously, if you specify a url parameter that is part of the path as false it would include that part
130
- of the path as parameter for example:
131
-
132
- ```
133
- get "(/optional/:optional_id)/things" => "foo#foo", as: :things
134
- things_path(optional_id: false) # => /things?optional_id=false
135
- ```
136
-
137
- After this change, true and false will be treated the same when used as optional path parameters. Meaning now:
138
-
139
- ```
140
- get '(this/:my_bool)/that' as: :that
141
-
142
- that_path(my_bool: true) # => `/this/true/that`
143
- that_path(my_bool: false) # => `/this/false/that`
144
- ```
145
-
146
- *Adam Hess*
147
-
148
- * Add support for 'private, no-store' Cache-Control headers.
149
-
150
- Previously, 'no-store' was exclusive; no other directives could be specified.
151
-
152
- *Alex Smith*
153
-
154
-
155
- ## Rails 6.1.3.2 (May 05, 2021) ##
74
+ * New `ActionController::ConditionalGet#no_store` method to set HTTP cache control `no-store` directive.
156
75
 
157
- * Prevent open redirects by correctly escaping the host allow list
158
- CVE-2021-22903
76
+ *Tadas Sasnauskas*
159
77
 
160
- * Prevent catastrophic backtracking during mime parsing
161
- CVE-2021-22902
78
+ * Drop support for the `SERVER_ADDR` header.
162
79
 
163
- * Prevent regex DoS in HTTP token authentication
164
- CVE-2021-22904
80
+ Following up https://github.com/rack/rack/pull/1573 and https://github.com/rails/rails/pull/42349.
165
81
 
166
- * Prevent string polymorphic route arguments.
82
+ *Ricardo Díaz*
167
83
 
168
- `url_for` supports building polymorphic URLs via an array
169
- of arguments (usually symbols and records). If a developer passes a
170
- user input array, strings can result in unwanted route helper calls.
171
-
172
- CVE-2021-22885
84
+ * Set session options when initializing a basic session.
173
85
 
174
86
  *Gannon McGibbon*
175
87
 
176
- ## Rails 6.1.3.1 (March 26, 2021) ##
177
-
178
- * No changes.
179
-
88
+ * Add `cache_control: {}` option to `fresh_when` and `stale?`.
180
89
 
181
- ## Rails 6.1.3 (February 17, 2021) ##
90
+ Works as a shortcut to set `response.cache_control` with the above methods.
182
91
 
183
- * Re-define routes when not set correctly via inheritance.
92
+ *Jacopo Beschi*
184
93
 
185
- *John Hawthorn*
186
-
187
-
188
- ## Rails 6.1.2.1 (February 10, 2021) ##
189
-
190
- * Prevent open redirect when allowed host starts with a dot
191
-
192
- [CVE-2021-22881]
193
-
194
- Thanks to @tktech (https://hackerone.com/tktech) for reporting this
195
- issue and the patch!
196
-
197
- *Aaron Patterson*
198
-
199
-
200
- ## Rails 6.1.2 (February 09, 2021) ##
201
-
202
- * Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
203
-
204
- *Janko Marohnić*
205
-
206
- * Fix `fixture_file_upload` deprecation when `file_fixture_path` is a relative path.
207
-
208
- *Eugene Kenny*
209
-
210
-
211
- ## Rails 6.1.1 (January 07, 2021) ##
212
-
213
- * Fix nil translation key lookup in controllers/
214
-
215
- *Jan Klimo*
216
-
217
- * Quietly handle unknown HTTP methods in Action Dispatch SSL middleware.
218
-
219
- *Alex Robbin*
220
-
221
- * Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
222
-
223
- *Alex Robbin*
224
-
225
-
226
- ## Rails 6.1.0 (December 09, 2020) ##
227
-
228
- * Support for the HTTP header `Feature-Policy` has been revised to reflect
229
- its [rename](https://github.com/w3c/webappsec-permissions-policy/pull/379) to [`Permissions-Policy`](https://w3c.github.io/webappsec-permissions-policy/#permissions-policy-http-header-field).
230
-
231
- ```ruby
232
- Rails.application.config.permissions_policy do |p|
233
- p.camera :none
234
- p.gyroscope :none
235
- p.microphone :none
236
- p.usb :none
237
- p.fullscreen :self
238
- p.payment :self, "https://secure-example.com"
239
- end
240
- ```
241
-
242
- *Julien Grillot*
243
-
244
- * Allow `ActionDispatch::HostAuthorization` to exclude specific requests.
245
-
246
- Host Authorization checks can be skipped for specific requests. This allows for health check requests to be permitted for requests with missing or non-matching host headers.
247
-
248
- *Chris Bisnett*
249
-
250
- * Add `config.action_dispatch.request_id_header` to allow changing the name of
251
- the unique X-Request-Id header
252
-
253
- *Arlston Fernandes*
254
-
255
- * Deprecate `config.action_dispatch.return_only_media_type_on_content_type`.
256
-
257
- *Rafael Mendonça França*
258
-
259
- * Change `ActionDispatch::Response#content_type` to return the full Content-Type header.
260
-
261
- *Rafael Mendonça França*
262
-
263
- * Remove deprecated `ActionDispatch::Http::ParameterFilter`.
264
-
265
- *Rafael Mendonça França*
266
-
267
- * Added support for exclusive no-store Cache-Control header.
268
-
269
- If `no-store` is set on Cache-Control header it is exclusive (all other cache directives are dropped).
270
-
271
- *Chris Kruger*
272
-
273
- * Catch invalid UTF-8 parameters for POST requests and respond with BadRequest.
274
-
275
- Additionally, perform `#set_binary_encoding` in `ActionDispatch::Http::Request#GET` and
276
- `ActionDispatch::Http::Request#POST` prior to validating encoding.
277
-
278
- *Adrianna Chang*
279
-
280
- * Allow `assert_recognizes` routing assertions to work on mounted root routes.
281
-
282
- *Gannon McGibbon*
94
+ * Writing into a disabled session will now raise an error.
283
95
 
284
- * Change default redirection status code for non-GET/HEAD requests to 308 Permanent Redirect for `ActionDispatch::SSL`.
96
+ Previously when no session store was set, writing into the session would silently fail.
285
97
 
286
- *Alan Tan*, *Oz Ben-David*
98
+ *Jean Boussier*
287
99
 
288
- * Fix `follow_redirect!` to follow redirection with same HTTP verb when following
289
- a 308 redirection.
100
+ * Add support for 'require-trusted-types-for' and 'trusted-types' headers.
290
101
 
291
- *Alan Tan*
102
+ Fixes #42034.
292
103
 
293
- * When multiple domains are specified for a cookie, a domain will now be
294
- chosen only if it is equal to or is a superdomain of the request host.
104
+ *lfalcao*
295
105
 
296
- *Jonathan Hefner*
106
+ * Remove inline styles and address basic accessibility issues on rescue templates.
297
107
 
298
- * `ActionDispatch::Static` handles precompiled Brotli (.br) files.
108
+ *Jacob Herrington*
299
109
 
300
- Adds to existing support for precompiled gzip (.gz) files.
301
- Brotli files are preferred due to much better compression.
302
-
303
- When the browser requests /some.js with `Accept-Encoding: br`,
304
- we check for public/some.js.br and serve that file, if present, with
305
- `Content-Encoding: br` and `Vary: Accept-Encoding` headers.
306
-
307
- *Ryan Edward Hall*, *Jeremy Daer*
308
-
309
- * Add raise_on_missing_translations support for controllers.
310
-
311
- This configuration determines whether an error should be raised for missing translations.
312
- It can be enabled through `config.i18n.raise_on_missing_translations`. Note that described
313
- configuration also affects raising error for missing translations in views.
314
-
315
- *fatkodima*
316
-
317
- * Added `compact` and `compact!` to `ActionController::Parameters`.
318
-
319
- *Eugene Kenny*
320
-
321
- * Calling `each_pair` or `each_value` on an `ActionController::Parameters`
322
- without passing a block now returns an enumerator.
323
-
324
- *Eugene Kenny*
325
-
326
- * `fixture_file_upload` now uses path relative to `file_fixture_path`
327
-
328
- Previously the path had to be relative to `fixture_path`.
329
- You can change your existing code as follow:
330
-
331
- ```ruby
332
- # Before
333
- fixture_file_upload('files/dog.png')
334
-
335
- # After
336
- fixture_file_upload('dog.png')
337
- ```
338
-
339
- *Edouard Chin*
340
-
341
- * Remove deprecated `force_ssl` at the controller level.
342
-
343
- *Rafael Mendonça França*
344
-
345
- * The +helper+ class method for controllers loads helper modules specified as
346
- strings/symbols with `String#constantize` instead of `require_dependency`.
347
-
348
- Remember that support for strings/symbols is only a convenient API. You can
349
- always pass a module object:
350
-
351
- ```ruby
352
- helper UtilsHelper
353
- ```
354
-
355
- which is recommended because it is simple and direct. When a string/symbol
356
- is received, `helper` just manipulates and inflects the argument to obtain
357
- that same module object.
358
-
359
- *Xavier Noria*, *Jean Boussier*
360
-
361
- * Correctly identify the entire localhost IPv4 range as trusted proxy.
362
-
363
- *Nick Soracco*
364
-
365
- * `url_for` will now use "https://" as the default protocol when
366
- `Rails.application.config.force_ssl` is set to true.
367
-
368
- *Jonathan Hefner*
369
-
370
- * Accept and default to base64_urlsafe CSRF tokens.
371
-
372
- Base64 strict-encoded CSRF tokens are not inherently websafe, which makes
373
- them difficult to deal with. For example, the common practice of sending
374
- the CSRF token to a browser in a client-readable cookie does not work properly
375
- out of the box: the value has to be url-encoded and decoded to survive transport.
376
-
377
- Now, we generate Base64 urlsafe-encoded CSRF tokens, which are inherently safe
378
- to transport. Validation accepts both urlsafe tokens, and strict-encoded tokens
379
- for backwards compatibility.
380
-
381
- *Scott Blum*
382
-
383
- * Support rolling deploys for cookie serialization/encryption changes.
384
-
385
- In a distributed configuration like rolling update, users may observe
386
- both old and new instances during deployment. Users may be served by a
387
- new instance and then by an old instance.
388
-
389
- That means when the server changes `cookies_serializer` from `:marshal`
390
- to `:hybrid` or the server changes `use_authenticated_cookie_encryption`
391
- from `false` to `true`, users may lose their sessions if they access the
392
- server during deployment.
393
-
394
- We added fallbacks to downgrade the cookie format when necessary during
395
- deployment, ensuring compatibility on both old and new instances.
396
-
397
- *Masaki Hara*
398
-
399
- * `ActionDispatch::Request.remote_ip` has ip address even when all sites are trusted.
400
-
401
- Before, if all `X-Forwarded-For` sites were trusted, the `remote_ip` would default to `127.0.0.1`.
402
- Now, the furthest proxy site is used. e.g.: It now gives an ip address when using curl from the load balancer.
403
-
404
- *Keenan Brock*
405
-
406
- * Fix possible information leak / session hijacking vulnerability.
407
-
408
- The `ActionDispatch::Session::MemcacheStore` is still vulnerable given it requires the
409
- gem dalli to be updated as well.
410
-
411
- CVE-2019-16782.
412
-
413
- * Include child session assertion count in ActionDispatch::IntegrationTest.
414
-
415
- `IntegrationTest#open_session` uses `dup` to create the new session, which
416
- meant it had its own copy of `@assertions`. This prevented the assertions
417
- from being correctly counted and reported.
418
-
419
- Child sessions now have their `attr_accessor` overridden to delegate to the
420
- root session.
421
-
422
- Fixes #32142.
423
-
424
- *Sam Bostock*
425
-
426
- * Add SameSite protection to every written cookie.
427
-
428
- Enabling `SameSite` cookie protection is an addition to CSRF protection,
429
- where cookies won't be sent by browsers in cross-site POST requests when set to `:lax`.
430
-
431
- `:strict` disables cookies being sent in cross-site GET or POST requests.
432
-
433
- Passing `:none` disables this protection and is the same as previous versions albeit a `; SameSite=None` is appended to the cookie.
434
-
435
- See upgrade instructions in config/initializers/new_framework_defaults_6_1.rb.
110
+ * Add support for 'private, no-store' Cache-Control headers.
436
111
 
437
- More info [here](https://tools.ietf.org/html/draft-west-first-party-cookies-07)
112
+ Previously, 'no-store' was exclusive; no other directives could be specified.
438
113
 
439
- _NB: Technically already possible as Rack supports SameSite protection, this is to ensure it's applied to all cookies_
114
+ *Alex Smith*
440
115
 
441
- *Cédric Fabianski*
116
+ * Expand payload of `unpermitted_parameters.action_controller` instrumentation to allow subscribers to
117
+ know which controller action received unpermitted parameters.
442
118
 
443
- * Bring back the feature that allows loading external route files from the router.
119
+ *bbuchalter*
444
120
 
445
- This feature existed back in 2012 but got reverted with the incentive that
446
- https://github.com/rails/routing_concerns was a better approach. Turned out
447
- that this wasn't fully the case and loading external route files from the router
448
- can be helpful for applications with a really large set of routes.
449
- Without this feature, application needs to implement routes reloading
450
- themselves and it's not straightforward.
121
+ * Add `ActionController::Live#send_stream` that makes it more convenient to send generated streams:
451
122
 
452
123
  ```ruby
453
- # config/routes.rb
454
-
455
- Rails.application.routes.draw do
456
- draw(:admin)
457
- end
458
-
459
- # config/routes/admin.rb
460
-
461
- get :foo, to: 'foo#bar'
462
- ```
463
-
464
- *Yehuda Katz*, *Edouard Chin*
465
-
466
- * Fix system test driver option initialization for non-headless browsers.
467
-
468
- *glaszig*
469
-
470
- * `redirect_to.action_controller` notifications now include the `ActionDispatch::Request` in
471
- their payloads as `:request`.
472
-
473
- *Austin Story*
474
-
475
- * `respond_to#any` no longer returns a response's Content-Type based on the
476
- request format but based on the block given.
477
-
478
- Example:
124
+ send_stream(filename: "subscribers.csv") do |stream|
125
+ stream.writeln "email_address,updated_at"
479
126
 
480
- ```ruby
481
- def my_action
482
- respond_to do |format|
483
- format.any { render(json: { foo: 'bar' }) }
484
- end
127
+ @subscribers.find_each do |subscriber|
128
+ stream.writeln [ subscriber.email_address, subscriber.updated_at ].join(",")
485
129
  end
486
-
487
- get('my_action.csv')
488
- ```
489
-
490
- The previous behaviour was to respond with a `text/csv` Content-Type which
491
- is inaccurate since a JSON response is being rendered.
492
-
493
- Now it correctly returns a `application/json` Content-Type.
494
-
495
- *Edouard Chin*
496
-
497
- * Replaces (back)slashes in failure screenshot image paths with dashes.
498
-
499
- If a failed test case contained a slash or a backslash, a screenshot would be created in a
500
- nested directory, causing issues with `tmp:clear`.
501
-
502
- *Damir Zekic*
503
-
504
- * Add `params.member?` to mimic Hash behavior.
505
-
506
- *Younes Serraj*
507
-
508
- * `process_action.action_controller` notifications now include the following in their payloads:
509
-
510
- * `:request` - the `ActionDispatch::Request`
511
- * `:response` - the `ActionDispatch::Response`
512
-
513
- *George Claghorn*
514
-
515
- * Updated `ActionDispatch::Request.remote_ip` setter to clear set the instance
516
- `remote_ip` to `nil` before setting the header that the value is derived
517
- from.
518
-
519
- Fixes #37383.
520
-
521
- *Norm Provost*
522
-
523
- * `ActionController::Base.log_at` allows setting a different log level per request.
524
-
525
- ```ruby
526
- # Use the debug level if a particular cookie is set.
527
- class ApplicationController < ActionController::Base
528
- log_at :debug, if: -> { cookies[:debug] }
529
130
  end
530
131
  ```
531
132
 
532
- *George Claghorn*
533
-
534
- * Allow system test screen shots to be taken more than once in
535
- a test by prefixing the file name with an incrementing counter.
536
-
537
- Add an environment variable `RAILS_SYSTEM_TESTING_SCREENSHOT_HTML` to
538
- enable saving of HTML during a screenshot in addition to the image.
539
- This uses the same image name, with the extension replaced with `.html`
540
-
541
- *Tom Fakes*
542
-
543
- * Add `Vary: Accept` header when using `Accept` header for response.
544
-
545
- For some requests like `/users/1`, Rails uses requests' `Accept`
546
- header to determine what to return. And if we don't add `Vary`
547
- in the response header, browsers might accidentally cache different
548
- types of content, which would cause issues: e.g. javascript got displayed
549
- instead of html content. This PR fixes these issues by adding `Vary: Accept`
550
- in these types of requests. For more detailed problem description, please read:
551
-
552
- https://github.com/rails/rails/pull/36213
553
-
554
- Fixes #25842.
133
+ *DHH*
555
134
 
556
- *Stan Lo*
135
+ * Add `ActionController::Live::Buffer#writeln` to write a line to the stream with a newline included.
557
136
 
558
- * Fix IntegrationTest `follow_redirect!` to follow redirection using the same HTTP verb when following
559
- a 307 redirection.
137
+ *DHH*
560
138
 
561
- *Edouard Chin*
139
+ * `ActionDispatch::Request#content_type` now returned Content-Type header as it is.
562
140
 
563
- * System tests require Capybara 3.26 or newer.
141
+ Previously, `ActionDispatch::Request#content_type` returned value does NOT contain charset part.
142
+ This behavior changed to returned Content-Type header containing charset part as it is.
564
143
 
565
- *George Claghorn*
144
+ If you want just MIME type, please use `ActionDispatch::Request#media_type` instead.
566
145
 
567
- * Reduced log noise handling ActionController::RoutingErrors.
568
-
569
- *Alberto Fernández-Capel*
570
-
571
- * Add DSL for configuring HTTP Feature Policy.
572
-
573
- This new DSL provides a way to configure an HTTP Feature Policy at a
574
- global or per-controller level. Full details of HTTP Feature Policy
575
- specification and guidelines can be found at MDN:
576
-
577
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
578
-
579
- Example global policy:
146
+ Before:
580
147
 
581
148
  ```ruby
582
- Rails.application.config.feature_policy do |f|
583
- f.camera :none
584
- f.gyroscope :none
585
- f.microphone :none
586
- f.usb :none
587
- f.fullscreen :self
588
- f.payment :self, "https://secure.example.com"
589
- end
149
+ request = ActionDispatch::Request.new("CONTENT_TYPE" => "text/csv; header=present; charset=utf-16", "REQUEST_METHOD" => "GET")
150
+ request.content_type #=> "text/csv"
590
151
  ```
591
152
 
592
- Example controller level policy:
153
+ After:
593
154
 
594
155
  ```ruby
595
- class PagesController < ApplicationController
596
- feature_policy do |p|
597
- p.geolocation "https://example.com"
598
- end
599
- end
156
+ request = ActionDispatch::Request.new("Content-Type" => "text/csv; header=present; charset=utf-16", "REQUEST_METHOD" => "GET")
157
+ request.content_type #=> "text/csv; header=present; charset=utf-16"
158
+ request.media_type #=> "text/csv"
600
159
  ```
601
160
 
602
- *Jacob Bednarz*
161
+ *Rafael Mendonça França*
603
162
 
604
- * Add the ability to set the CSP nonce only to the specified directives.
163
+ * Change `ActionDispatch::Request#media_type` to return `nil` when the request don't have a `Content-Type` header.
605
164
 
606
- Fixes #35137.
165
+ *Rafael Mendonça França*
607
166
 
608
- *Yuji Yaginuma*
167
+ * Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
609
168
 
610
- * Keep part when scope option has value.
169
+ *Janko Marohnić*
611
170
 
612
- When a route was defined within an optional scope, if that route didn't
613
- take parameters the scope was lost when using path helpers. This commit
614
- ensures scope is kept both when the route takes parameters or when it
615
- doesn't.
171
+ * Allow anything with `#to_str` (like `Addressable::URI`) as a `redirect_to` location.
616
172
 
617
- Fixes #33219.
173
+ *ojab*
618
174
 
619
- *Alberto Almagro*
175
+ * Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
620
176
 
621
- * Added `deep_transform_keys` and `deep_transform_keys!` methods to ActionController::Parameters.
177
+ *Alex Robbin*
622
178
 
623
- *Gustavo Gutierrez*
179
+ * Deprecate the ability to assign a single value to `config.action_dispatch.trusted_proxies`
180
+ as `RemoteIp` middleware behaves inconsistently depending on whether this is configured
181
+ with a single value or an enumerable.
624
182
 
625
- * Calling `ActionController::Parameters#transform_keys`/`!` without a block now returns
626
- an enumerator for the parameters instead of the underlying hash.
183
+ Fixes #40772.
627
184
 
628
- *Eugene Kenny*
185
+ *Christian Sutter*
629
186
 
630
- * Fix strong parameters blocks all attributes even when only some keys are invalid (non-numerical).
631
- It should only block invalid key's values instead.
187
+ * Add `redirect_back_or_to(fallback_location, **)` as a more aesthetically pleasing version of `redirect_back fallback_location:, **`.
188
+ The old method name is retained without explicit deprecation.
632
189
 
633
- *Stan Lo*
190
+ *DHH*
634
191
 
635
192
 
636
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionpack/CHANGELOG.md) for previous changes.
193
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionpack/CHANGELOG.md) for previous changes.