actionpack 5.2.8 → 6.0.0.beta1

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 (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +109 -477
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/lib/abstract_controller/base.rb +4 -2
  6. data/lib/abstract_controller/caching/fragments.rb +6 -21
  7. data/lib/abstract_controller/callbacks.rb +12 -0
  8. data/lib/abstract_controller/collector.rb +1 -1
  9. data/lib/abstract_controller/helpers.rb +2 -2
  10. data/lib/abstract_controller/railties/routes_helpers.rb +1 -1
  11. data/lib/action_controller/api.rb +2 -1
  12. data/lib/action_controller/base.rb +2 -7
  13. data/lib/action_controller/caching.rb +1 -1
  14. data/lib/action_controller/log_subscriber.rb +8 -5
  15. data/lib/action_controller/metal/conditional_get.rb +9 -3
  16. data/lib/action_controller/metal/data_streaming.rb +5 -6
  17. data/lib/action_controller/metal/default_headers.rb +17 -0
  18. data/lib/action_controller/metal/exceptions.rb +22 -1
  19. data/lib/action_controller/metal/flash.rb +5 -5
  20. data/lib/action_controller/metal/force_ssl.rb +17 -57
  21. data/lib/action_controller/metal/head.rb +1 -1
  22. data/lib/action_controller/metal/helpers.rb +1 -2
  23. data/lib/action_controller/metal/http_authentication.rb +21 -22
  24. data/lib/action_controller/metal/implicit_render.rb +2 -12
  25. data/lib/action_controller/metal/instrumentation.rb +3 -5
  26. data/lib/action_controller/metal/live.rb +28 -26
  27. data/lib/action_controller/metal/mime_responds.rb +13 -2
  28. data/lib/action_controller/metal/params_wrapper.rb +18 -14
  29. data/lib/action_controller/metal/redirecting.rb +32 -11
  30. data/lib/action_controller/metal/rendering.rb +1 -1
  31. data/lib/action_controller/metal/request_forgery_protection.rb +32 -97
  32. data/lib/action_controller/metal/strong_parameters.rb +57 -34
  33. data/lib/action_controller/metal/url_for.rb +1 -1
  34. data/lib/action_controller/metal.rb +2 -2
  35. data/lib/action_controller/railties/helpers.rb +1 -1
  36. data/lib/action_controller/renderer.rb +15 -2
  37. data/lib/action_controller/test_case.rb +5 -9
  38. data/lib/action_controller.rb +1 -0
  39. data/lib/action_dispatch/http/cache.rb +14 -10
  40. data/lib/action_dispatch/http/content_disposition.rb +45 -0
  41. data/lib/action_dispatch/http/content_security_policy.rb +17 -8
  42. data/lib/action_dispatch/http/filter_parameters.rb +8 -6
  43. data/lib/action_dispatch/http/filter_redirect.rb +1 -1
  44. data/lib/action_dispatch/http/headers.rb +1 -1
  45. data/lib/action_dispatch/http/mime_negotiation.rb +7 -10
  46. data/lib/action_dispatch/http/mime_type.rb +1 -5
  47. data/lib/action_dispatch/http/parameter_filter.rb +5 -79
  48. data/lib/action_dispatch/http/parameters.rb +13 -3
  49. data/lib/action_dispatch/http/request.rb +10 -13
  50. data/lib/action_dispatch/http/response.rb +14 -14
  51. data/lib/action_dispatch/http/upload.rb +5 -0
  52. data/lib/action_dispatch/http/url.rb +81 -81
  53. data/lib/action_dispatch/journey/formatter.rb +1 -1
  54. data/lib/action_dispatch/journey/nfa/simulator.rb +0 -2
  55. data/lib/action_dispatch/journey/nodes/node.rb +9 -8
  56. data/lib/action_dispatch/journey/path/pattern.rb +3 -4
  57. data/lib/action_dispatch/journey/router/utils.rb +10 -10
  58. data/lib/action_dispatch/journey/router.rb +0 -3
  59. data/lib/action_dispatch/journey/scanner.rb +11 -4
  60. data/lib/action_dispatch/journey/visitors.rb +1 -1
  61. data/lib/action_dispatch/middleware/callbacks.rb +2 -4
  62. data/lib/action_dispatch/middleware/cookies.rb +49 -70
  63. data/lib/action_dispatch/middleware/debug_exceptions.rb +32 -58
  64. data/lib/action_dispatch/middleware/debug_locks.rb +5 -5
  65. data/lib/action_dispatch/middleware/debug_view.rb +50 -0
  66. data/lib/action_dispatch/middleware/exception_wrapper.rb +36 -7
  67. data/lib/action_dispatch/middleware/executor.rb +1 -1
  68. data/lib/action_dispatch/middleware/flash.rb +1 -1
  69. data/lib/action_dispatch/middleware/host_authorization.rb +103 -0
  70. data/lib/action_dispatch/middleware/remote_ip.rb +6 -8
  71. data/lib/action_dispatch/middleware/request_id.rb +2 -2
  72. data/lib/action_dispatch/middleware/session/abstract_store.rb +0 -14
  73. data/lib/action_dispatch/middleware/session/cache_store.rb +6 -11
  74. data/lib/action_dispatch/middleware/session/cookie_store.rb +11 -27
  75. data/lib/action_dispatch/middleware/ssl.rb +8 -8
  76. data/lib/action_dispatch/middleware/stack.rb +2 -2
  77. data/lib/action_dispatch/middleware/static.rb +5 -6
  78. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +4 -2
  79. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +45 -35
  80. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +7 -0
  81. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +5 -0
  82. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +20 -2
  83. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +4 -4
  84. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +2 -2
  85. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +19 -0
  86. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.text.erb +3 -0
  87. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +2 -2
  88. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +1 -1
  89. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +2 -2
  90. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +3 -0
  91. data/lib/action_dispatch/railtie.rb +1 -0
  92. data/lib/action_dispatch/request/session.rb +8 -6
  93. data/lib/action_dispatch/routing/inspector.rb +99 -50
  94. data/lib/action_dispatch/routing/mapper.rb +36 -29
  95. data/lib/action_dispatch/routing/polymorphic_routes.rb +7 -12
  96. data/lib/action_dispatch/routing/route_set.rb +11 -12
  97. data/lib/action_dispatch/routing/url_for.rb +1 -0
  98. data/lib/action_dispatch/routing.rb +3 -2
  99. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +3 -3
  100. data/lib/action_dispatch/testing/assertions/response.rb +2 -3
  101. data/lib/action_dispatch/testing/assertions/routing.rb +7 -2
  102. data/lib/action_dispatch/testing/integration.rb +11 -5
  103. data/lib/action_dispatch/testing/test_process.rb +2 -2
  104. data/lib/action_dispatch/testing/test_response.rb +4 -32
  105. data/lib/action_dispatch.rb +7 -6
  106. data/lib/action_pack/gem_version.rb +4 -4
  107. data/lib/action_pack.rb +1 -1
  108. metadata +22 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8e4c97e51cd3c8e31f3131d2cd56e7ebe51cdd3efbda1ac55f134f1b899a090
4
- data.tar.gz: 454e803f0fbf6c985117ef9177457ec07b2f29bbb7fefc1748196e9531ca8481
3
+ metadata.gz: df5b083c08009f1025bfbf541400a4819b5620f5bb49aa3d4bbe0c056eae44b3
4
+ data.tar.gz: '0374579e1273c1d727e0bc94d7a73b3933d8c0f54e7196beedc61ea30d88209f'
5
5
  SHA512:
6
- metadata.gz: 6c23887c17c3010ea19083d9151e8c8d9a141c62535e2d4fccb818cfe67cd394ff140b2189b3ef71416e9e943c96e555986778647138bf698932662e7ce8ae0e
7
- data.tar.gz: af1d5ec895a4b8d3fc7f010438c7431f7d13ccfea62bc7e0e83b76652c213688b68d8e40828c5eab0cb76d5f69c21b3067cbc78e23614d80c9f0c48a0832ca26
6
+ metadata.gz: cb0e467dc8c10baa42df2d08d79b2f5caedad996d247523abf54713a542f6d49a01f120ca0b0faa6930ea89592bfe074979201adec97d33135a5877391a5d4bb
7
+ data.tar.gz: dee5cf35ce9af7e795d65bb2a44d5edb229439f5fbde0dde1c35e8d3cf2564c49ddf929a9d5499b3aa6248c42cf6f61ca2c75c85a623ba51f1dd6106750d3267
data/CHANGELOG.md CHANGED
@@ -1,153 +1,66 @@
1
- ## Rails 5.2.8 (May 09, 2022) ##
1
+ ## Rails 6.0.0.beta1 (January 18, 2019) ##
2
2
 
3
- * No changes.
3
+ * Remove deprecated `fragment_cache_key` helper in favor of `combined_fragment_cache_key`.
4
4
 
5
+ *Rafael Mendonça França*
5
6
 
6
- ## Rails 5.2.7.1 (April 26, 2022) ##
7
-
8
- * Allow Content Security Policy DSL to generate for API responses.
9
-
10
- *Tim Wade*
11
-
12
- ## Rails 5.2.7 (March 10, 2022) ##
13
-
14
- * No changes.
15
-
16
- ## Rails 5.2.6.3 (March 08, 2022) ##
17
-
18
- * No changes.
19
-
20
-
21
- ## Rails 5.2.6.2 (February 11, 2022) ##
22
-
23
- * No changes.
24
-
7
+ * Remove deprecated methods in `ActionDispatch::TestResponse`.
25
8
 
26
- ## Rails 5.2.6.1 (February 11, 2022) ##
9
+ `#success?`, `missing?` and `error?` were deprecated in Rails 5.2 in favor of
10
+ `#successful?`, `not_found?` and `server_error?`.
27
11
 
28
- * Under certain circumstances, the middleware isn't informed that the
29
- response body has been fully closed which result in request state not
30
- being fully reset before the next request
12
+ *Rafael Mendonça França*
31
13
 
32
- [CVE-2022-23633]
14
+ * Ensure external redirects are explicitly allowed
33
15
 
16
+ Add `fallback_location` and `allow_other_host` options to `redirect_to`.
34
17
 
35
- ## Rails 5.2.6 (May 05, 2021) ##
18
+ *Gannon McGibbon*
36
19
 
37
- * Accept base64_urlsafe CSRF tokens to make forward compatible.
20
+ * Introduce ActionDispatch::HostAuthorization
38
21
 
39
- Base64 strict-encoded CSRF tokens are not inherently websafe, which makes
40
- them difficult to deal with. For example, the common practice of sending
41
- the CSRF token to a browser in a client-readable cookie does not work properly
42
- out of the box: the value has to be url-encoded and decoded to survive transport.
22
+ This is a new middleware that guards against DNS rebinding attacks by
23
+ white-listing the allowed hosts a request can be made to.
43
24
 
44
- In this version, we generate Base64 urlsafe-encoded CSRF tokens, which are inherently
45
- safe to transport. Validation accepts both urlsafe tokens, and strict-encoded
46
- tokens for backwards compatibility.
25
+ Each host is checked with the case operator (`#===`) to support `RegExp`,
26
+ `Proc`, `IPAddr` and custom objects as host allowances.
47
27
 
48
- How the tokes are encoded is controllr by the `action_controller.urlsafe_csrf_tokens`
49
- config.
28
+ *Genadi Samokovarov*
50
29
 
51
- In Rails 5.2.5, the CSRF token format was accidentally changed to urlsafe-encoded.
30
+ * Allow using `parsed_body` in `ActionController::TestCase`.
52
31
 
53
- **Atention**: If you already upgraded your application to 5.2.5, set the config
54
- `urlsafe_csrf_tokens` to `true`, otherwise your form submission will start to fail
55
- during the deploy of this new version.
32
+ In addition to `ActionDispatch::IntegrationTest`, allow using
33
+ `parsed_body` in `ActionController::TestCase`:
56
34
 
57
- ```ruby
58
- Rails.application.config.action_controller.urlsafe_csrf_tokens = true
35
+ ```
36
+ class SomeControllerTest < ActionController::TestCase
37
+ def test_some_action
38
+ post :action, body: { foo: 'bar' }
39
+ assert_equal({ "foo" => "bar" }, response.parsed_body)
40
+ end
41
+ end
59
42
  ```
60
43
 
61
- If you are upgrading from 5.2.4.x, you don't need to change this configuration.
62
-
63
- *Scott Blum*, *Étienne Barrié*
64
-
65
-
66
- ## Rails 5.2.5 (March 26, 2021) ##
67
-
68
- * No changes.
69
-
70
-
71
- ## Rails 5.2.4.6 (May 05, 2021) ##
72
-
73
- * Prevent regex DoS in HTTP token authentication
74
- CVE-2021-22904
44
+ Fixes #34676.
75
45
 
76
- * Prevent string polymorphic route arguments.
46
+ *Tobias Bühlmann*
77
47
 
78
- `url_for` supports building polymorphic URLs via an array
79
- of arguments (usually symbols and records). If a developer passes a
80
- user input array, strings can result in unwanted route helper calls.
48
+ * Raise an error on root route naming conflicts.
81
49
 
82
- CVE-2021-22885
50
+ Raises an ArgumentError when multiple root routes are defined in the
51
+ same context instead of assigning nil names to subsequent roots.
83
52
 
84
53
  *Gannon McGibbon*
85
54
 
86
- ## Rails 5.2.4.5 (February 10, 2021) ##
87
-
88
- * No changes.
89
-
90
-
91
- ## Rails 5.2.4.4 (September 09, 2020) ##
92
-
93
- * No changes.
94
-
95
-
96
- ## Rails 5.2.4.3 (May 18, 2020) ##
97
-
98
- * [CVE-2020-8166] HMAC raw CSRF token before masking it, so it cannot be used to reconstruct a per-form token
99
-
100
- * [CVE-2020-8164] Return self when calling #each, #each_pair, and #each_value instead of the raw @parameters hash
101
-
102
-
103
- ## Rails 5.2.4.2 (March 19, 2020) ##
104
-
105
- * No changes.
106
-
107
-
108
- ## Rails 5.2.4.1 (December 18, 2019) ##
109
-
110
- * Fix possible information leak / session hijacking vulnerability.
111
-
112
- The `ActionDispatch::Session::MemcacheStore` is still vulnerable given it requires the
113
- gem dalli to be updated as well.
114
-
115
- _Breaking changes:_
116
- * `session.id` now returns an instance of `Rack::Session::SessionId` and not a String (use `session.id.public_id` to restore the old behaviour, see #38063)
117
- * Accessing the session id using `session[:session_id]`/`session['session_id']` no longer works with
118
- ruby 2.2 (see https://github.com/rails/rails/commit/2a52a38cb51b65d71cf91fc960777213cf96f962#commitcomment-37929811)
119
-
120
- CVE-2019-16782.
121
-
122
-
123
- ## Rails 5.2.4 (November 27, 2019) ##
124
-
125
- * No changes.
126
-
127
-
128
- ## Rails 5.2.3 (March 27, 2019) ##
129
-
130
- * Allow using `public` and `no-cache` together in the the Cache Control header.
131
-
132
- Before this change, even if `public` was specified in the Cache Control header,
133
- it was excluded when `no-cache` was included. This change preserves the
134
- `public` value as is.
135
-
136
- Fixes #34780.
137
-
138
- *Yuji Yaginuma*
139
-
140
- * Allow `nil` params for `ActionController::TestCase`.
141
-
142
- *Ryo Nakamura*
143
-
144
-
145
- ## Rails 5.2.2.1 (March 11, 2019) ##
146
-
147
- * No changes.
55
+ * Allow rescue from parameter parse errors:
148
56
 
57
+ ```
58
+ rescue_from ActionDispatch::Http::Parameters::ParseError do
59
+ head :unauthorized
60
+ end
61
+ ```
149
62
 
150
- ## Rails 5.2.2 (December 04, 2018) ##
63
+ *Gannon McGibbon*, *Josh Cheek*
151
64
 
152
65
  * Reset Capybara sessions if failed system test screenshot raising an exception.
153
66
 
@@ -183,402 +96,121 @@
183
96
 
184
97
  *Andrew White*
185
98
 
186
- * Fix `rails routes -c` for controller name consists of multiple word.
187
-
188
- *Yoshiyuki Kinjo*
189
-
190
- * Call the `#redirect_to` block in controller context.
191
-
192
- *Steven Peckins*
193
-
194
-
195
- ## Rails 5.2.1.1 (November 27, 2018) ##
99
+ * Add `ActionController::Parameters#each_value`.
196
100
 
197
- * No changes.
101
+ *Lukáš Zapletal*
198
102
 
103
+ * Deprecate `ActionDispatch::Http::ParameterFilter` in favor of `ActiveSupport::ParameterFilter`.
199
104
 
200
- ## Rails 5.2.1 (August 07, 2018) ##
201
-
202
- * Prevent `?null=` being passed on JSON encoded test requests.
203
-
204
- `RequestEncoder#encode_params` won't attempt to parse params if
205
- there are none.
206
-
207
- So call like this will no longer append a `?null=` query param.
208
-
209
- get foos_url, as: :json
210
-
211
- *Alireza Bashiri*
212
-
213
- * Ensure `ActionController::Parameters#transform_values` and
214
- `ActionController::Parameters#transform_values!` converts hashes into
215
- parameters.
216
-
217
- *Kevin Sjöberg*
218
-
219
- * Fix strong parameters `permit!` with nested arrays.
220
-
221
- Given:
222
- ```
223
- params = ActionController::Parameters.new(nested_arrays: [[{ x: 2, y: 3 }, { x: 21, y: 42 }]])
224
- params.permit!
225
- ```
226
-
227
- `params[:nested_arrays][0][0].permitted?` will now return `true` instead of `false`.
228
-
229
- *Steve Hull*
230
-
231
- * Reset `RAW_POST_DATA` and `CONTENT_LENGTH` request environment between test requests in
232
- `ActionController::TestCase` subclasses.
233
-
234
- *Eugene Kenny*
235
-
236
- * Output only one Content-Security-Policy nonce header value per request.
237
-
238
- Fixes #32597.
239
-
240
- *Andrey Novikov*, *Andrew White*
241
-
242
- * Only disable GPUs for headless Chrome on Windows.
243
-
244
- It is not necessary anymore for Linux and macOS machines.
245
-
246
- https://bugs.chromium.org/p/chromium/issues/detail?id=737678#c1
247
-
248
- *Stefan Wrobel*
249
-
250
- * Fix system tests transactions not closed between examples.
251
-
252
- *Sergey Tarasov*
253
-
254
-
255
- ## Rails 5.2.0 (April 09, 2018) ##
256
-
257
- * Check exclude before flagging cookies as secure.
258
-
259
- *Catherine Khuu*
260
-
261
- * Always yield a CSP policy instance from `content_security_policy`
262
-
263
- This allows a controller action to enable the policy individually
264
- for a controller and/or specific actions.
265
-
266
- *Andrew White*
267
-
268
- * Add the ability to disable the global CSP in a controller, e.g:
269
-
270
- class LegacyPagesController < ApplicationController
271
- content_security_policy false, only: :index
272
- end
273
-
274
- *Andrew White*
275
-
276
- * Add alias method `to_hash` to `to_h` for `cookies`.
277
- Add alias method `to_h` to `to_hash` for `session`.
278
-
279
- *Igor Kasyanchuk*
280
-
281
- * Update the default HSTS max-age value to 31536000 seconds (1 year)
282
- to meet the minimum max-age requirement for https://hstspreload.org/.
283
-
284
- *Grant Bourque*
285
-
286
- * Add support for automatic nonce generation for Rails UJS.
287
-
288
- Because the UJS library creates a script tag to process responses it
289
- normally requires the script-src attribute of the content security
290
- policy to include 'unsafe-inline'.
291
-
292
- To work around this we generate a per-request nonce value that is
293
- embedded in a meta tag in a similar fashion to how CSRF protection
294
- embeds its token in a meta tag. The UJS library can then read the
295
- nonce value and set it on the dynamically generated script tag to
296
- enable it to execute without needing 'unsafe-inline' enabled.
105
+ *Yoshiyuki Kinjo*
297
106
 
298
- Nonce generation isn't 100% safe - if your script tag is including
299
- user generated content in someway then it may be possible to exploit
300
- an XSS vulnerability which can take advantage of the nonce. It is
301
- however an improvement on a blanket permission for inline scripts.
107
+ * Encode Content-Disposition filenames on `send_data` and `send_file`.
108
+ Previously, `send_data 'data', filename: "\u{3042}.txt"` sends
109
+ `"filename=\"\u{3042}.txt\""` as Content-Disposition and it can be
110
+ garbled.
111
+ Now it follows [RFC 2231](https://tools.ietf.org/html/rfc2231) and
112
+ [RFC 5987](https://tools.ietf.org/html/rfc5987) and sends
113
+ `"filename=\"%3F.txt\"; filename*=UTF-8''%E3%81%82.txt"`.
114
+ Most browsers can find filename correctly and old browsers fallback to ASCII
115
+ converted name.
302
116
 
303
- It is also possible to use the nonce within your own script tags by
304
- using `nonce: true` to set the nonce value on the tag, e.g
117
+ *Fumiaki Matsushima*
305
118
 
306
- <%= javascript_tag nonce: true do %>
307
- alert('Hello, World!');
308
- <% end %>
119
+ * Expose `ActionController::Parameters#each_key` which allows iterating over
120
+ keys without allocating an array.
309
121
 
310
- Fixes #31689.
122
+ *Richard Schneeman*
311
123
 
312
- *Andrew White*
124
+ * Purpose metadata for signed/encrypted cookies.
313
125
 
314
- * Matches behavior of `Hash#each` in `ActionController::Parameters#each`.
126
+ Rails can now thwart attacks that attempt to copy signed/encrypted value
127
+ of a cookie and use it as the value of another cookie.
315
128
 
316
- Rails 5.0 introduced a bug when looping through controller params using `each`. Only the keys of params hash were passed to the block, e.g.
129
+ It does so by stashing the cookie-name in the purpose field which is
130
+ then signed/encrypted along with the cookie value. Then, on a server-side
131
+ read, we verify the cookie-names and discard any attacked cookies.
317
132
 
318
- # Parameters: {"param"=>"1", "param_two"=>"2"}
319
- def index
320
- params.each do |name|
321
- puts name
322
- end
323
- end
133
+ Enable `action_dispatch.use_cookies_with_metadata` to use this feature, which
134
+ writes cookies with the new purpose and expiry metadata embedded.
324
135
 
325
- # Prints
326
- # param
327
- # param_two
136
+ *Assain Jaleel*
328
137
 
329
- In Rails 5.2 the bug has been fixed and name will be an array (which was the behavior for all versions prior to 5.0), instead of a string.
138
+ * Raises `ActionController::RespondToMismatchError` with confliciting `respond_to` invocations.
330
139
 
331
- To fix the code above simply change as per example below:
140
+ `respond_to` can match multiple types and lead to undefined behavior when
141
+ multiple invocations are made and the types do not match:
332
142
 
333
- # Parameters: {"param"=>"1", "param_two"=>"2"}
334
- def index
335
- params.each do |name, value|
336
- puts name
143
+ respond_to do |outer_type|
144
+ outer_type.js do
145
+ respond_to do |inner_type|
146
+ inner_type.html { render body: "HTML" }
147
+ end
337
148
  end
338
149
  end
339
150
 
340
- # Prints
341
- # param
342
- # param_two
343
-
344
- *Dominic Cleal*
151
+ *Patrick Toomey*
345
152
 
346
- * Add `Referrer-Policy` header to default headers set.
153
+ * `ActionDispatch::Http::UploadedFile` now delegates `to_path` to its tempfile.
347
154
 
348
- *Guillermo Iguaran*
155
+ This allows uploaded file objects to be passed directly to `File.read`
156
+ without raising a `TypeError`:
349
157
 
350
- * Changed the system tests to set Puma as default server only when the
351
- user haven't specified manually another server.
158
+ uploaded_file = ActionDispatch::Http::UploadedFile.new(tempfile: tmp_file)
159
+ File.read(uploaded_file)
352
160
 
353
- *Guillermo Iguaran*
161
+ *Aaron Kromer*
354
162
 
355
- * Add secure `X-Download-Options` and `X-Permitted-Cross-Domain-Policies` to
356
- default headers set.
163
+ * Pass along arguments to underlying `get` method in `follow_redirect!`.
357
164
 
358
- *Guillermo Iguaran*
165
+ Now all arguments passed to `follow_redirect!` are passed to the underlying
166
+ `get` method. This for example allows to set custom headers for the
167
+ redirection request to the server.
359
168
 
360
- * Add headless firefox support to System Tests.
169
+ follow_redirect!(params: { foo: :bar })
361
170
 
362
- *bogdanvlviv*
171
+ *Remo Fritzsche*
363
172
 
364
- * Changed the default system test screenshot output from `inline` to `simple`.
173
+ * Introduce a new error page to when the implicit render page is accessed in the browser.
365
174
 
366
- `inline` works well for iTerm2 but not everyone uses iTerm2. Some terminals like
367
- Terminal.app ignore the `inline` and output the path to the file since it can't
368
- render the image. Other terminals, like those on Ubuntu, cannot handle the image
369
- inline, but also don't handle it gracefully and instead of outputting the file
370
- path, it dumps binary into the terminal.
175
+ Now instead of showing an error page that with exception and backtraces we now show only
176
+ one informative page.
371
177
 
372
- Commit 9d6e28 fixes this by changing the default for screenshot to be `simple`.
178
+ *Vinicius Stock*
373
179
 
374
- *Eileen M. Uchitelle*
375
-
376
- * Register most popular audio/video/font mime types supported by modern browsers.
377
-
378
- *Guillermo Iguaran*
379
-
380
- * Fix optimized url helpers when using relative url root.
381
-
382
- Fixes #31220.
383
-
384
- *Andrew White*
180
+ * Introduce `ActionDispatch::DebugExceptions.register_interceptor`.
385
181
 
386
- * Add DSL for configuring Content-Security-Policy header.
182
+ Exception aware plugin authors can use the newly introduced
183
+ `.register_interceptor` method to get the processed exception, instead of
184
+ monkey patching DebugExceptions.
387
185
 
388
- The DSL allows you to configure a global Content-Security-Policy
389
- header and then override within a controller. For more information
390
- about the Content-Security-Policy header see MDN:
391
-
392
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
393
-
394
- Example global policy:
395
-
396
- # config/initializers/content_security_policy.rb
397
- Rails.application.config.content_security_policy do |p|
398
- p.default_src :self, :https
399
- p.font_src :self, :https, :data
400
- p.img_src :self, :https, :data
401
- p.object_src :none
402
- p.script_src :self, :https
403
- p.style_src :self, :https, :unsafe_inline
404
- end
405
-
406
- Example controller overrides:
407
-
408
- # Override policy inline
409
- class PostsController < ApplicationController
410
- content_security_policy do |p|
411
- p.upgrade_insecure_requests true
412
- end
413
- end
414
-
415
- # Using literal values
416
- class PostsController < ApplicationController
417
- content_security_policy do |p|
418
- p.base_uri "https://www.example.com"
419
- end
186
+ ActionDispatch::DebugExceptions.register_interceptor do |request, exception|
187
+ HypoteticalPlugin.capture_exception(request, exception)
420
188
  end
421
189
 
422
- # Using mixed static and dynamic values
423
- class PostsController < ApplicationController
424
- content_security_policy do |p|
425
- p.base_uri :self, -> { "https://#{current_user.domain}.example.com" }
426
- end
427
- end
428
-
429
- Allows you to also only report content violations for migrating
430
- legacy content using the `content_security_policy_report_only`
431
- configuration attribute, e.g;
432
-
433
- # config/initializers/content_security_policy.rb
434
- Rails.application.config.content_security_policy_report_only = true
435
-
436
- # controller override
437
- class PostsController < ApplicationController
438
- content_security_policy_report_only only: :index
439
- end
440
-
441
- Note that this feature does not validate the header for performance
442
- reasons since the header is calculated at runtime.
443
-
444
- *Andrew White*
445
-
446
- * Make `assert_recognizes` to traverse mounted engines.
447
-
448
- *Yuichiro Kaneko*
449
-
450
- * Remove deprecated `ActionController::ParamsParser::ParseError`.
451
-
452
- *Rafael Mendonça França*
453
-
454
- * Add `:allow_other_host` option to `redirect_back` method.
455
-
456
- When `allow_other_host` is set to `false`, the `redirect_back` will not allow redirecting from a
457
- different host. `allow_other_host` is `true` by default.
458
-
459
- *Tim Masliuchenko*
460
-
461
- * Add headless chrome support to System Tests.
462
-
463
- *Yuji Yaginuma*
464
-
465
- * Add ability to enable Early Hints for HTTP/2
466
-
467
- If supported by the server, and enabled in Puma this allows H2 Early Hints to be used.
468
-
469
- The `javascript_include_tag` and the `stylesheet_link_tag` automatically add Early Hints if requested.
470
-
471
- *Eileen M. Uchitelle*, *Aaron Patterson*
472
-
473
- * Simplify cookies middleware with key rotation support
474
-
475
- Use the `rotate` method for both `MessageEncryptor` and
476
- `MessageVerifier` to add key rotation support for encrypted and
477
- signed cookies. This also helps simplify support for legacy cookie
478
- security.
479
-
480
- *Michael J Coyne*
481
-
482
- * Use Capybara registered `:puma` server config.
483
-
484
- The Capybara registered `:puma` server ensures the puma server is run in process so
485
- connection sharing and open request detection work correctly by default.
486
-
487
- *Thomas Walpole*
488
-
489
- * Cookies `:expires` option supports `ActiveSupport::Duration` object.
490
-
491
- cookies[:user_name] = { value: "assain", expires: 1.hour }
492
- cookies[:key] = { value: "a yummy cookie", expires: 6.months }
493
-
494
- Pull Request: #30121
495
-
496
- *Assain Jaleel*
497
-
498
- * Enforce signed/encrypted cookie expiry server side.
499
-
500
- Rails can thwart attacks by malicious clients that don't honor a cookie's expiry.
501
-
502
- It does so by stashing the expiry within the written cookie and relying on the
503
- signing/encrypting to vouch that it hasn't been tampered with. Then on a
504
- server-side read, the expiry is verified and any expired cookie is discarded.
190
+ *Genadi Samokovarov*
505
191
 
506
- Pull Request: #30121
507
-
508
- *Assain Jaleel*
509
-
510
- * Make `take_failed_screenshot` work within engine.
511
-
512
- Fixes #30405.
513
-
514
- *Yuji Yaginuma*
515
-
516
- * Deprecate `ActionDispatch::TestResponse` response aliases.
517
-
518
- `#success?`, `#missing?` & `#error?` are not supported by the actual
519
- `ActionDispatch::Response` object and can produce false-positives. Instead,
520
- use the response helpers provided by `Rack::Response`.
521
-
522
- *Trevor Wistaff*
523
-
524
- * Protect from forgery by default
525
-
526
- Rather than protecting from forgery in the generated `ApplicationController`,
527
- add it to `ActionController::Base` depending on
528
- `config.action_controller.default_protect_from_forgery`. This configuration
529
- defaults to false to support older versions which have removed it from their
530
- `ApplicationController`, but is set to true for Rails 5.2.
531
-
532
- *Lisa Ugray*
533
-
534
- * Fallback `ActionController::Parameters#to_s` to `Hash#to_s`.
535
-
536
- *Kir Shatrov*
537
-
538
- * `driven_by` now registers poltergeist and capybara-webkit.
539
-
540
- If poltergeist or capybara-webkit are set as drivers is set for System Tests,
541
- `driven_by` will register the driver and set additional options passed via
542
- the `:options` parameter.
543
-
544
- Refer to the respective driver's documentation to see what options can be passed.
545
-
546
- *Mario Chavez*
547
-
548
- * AEAD encrypted cookies and sessions with GCM.
549
-
550
- Encrypted cookies now use AES-GCM which couples authentication and
551
- encryption in one faster step and produces shorter ciphertexts. Cookies
552
- encrypted using AES in CBC HMAC mode will be seamlessly upgraded when
553
- this new mode is enabled via the
554
- `action_dispatch.use_authenticated_cookie_encryption` configuration value.
555
-
556
- *Michael J Coyne*
192
+ * Output only one Content-Security-Policy nonce header value per request.
557
193
 
558
- * Change the cache key format for fragments to make it easier to debug key churn. The new format is:
194
+ Fixes #32597.
559
195
 
560
- views/template/action.html.erb:7a1156131a6928cb0026877f8b749ac9/projects/123
561
- ^template path ^template tree digest ^class ^id
196
+ *Andrey Novikov*, *Andrew White*
562
197
 
563
- *DHH*
198
+ * Move default headers configuration into their own module that can be included in controllers.
564
199
 
565
- * Add support for recyclable cache keys with fragment caching. This uses the new versioned entries in the
566
- `ActiveSupport::Cache` stores and relies on the fact that Active Record has split `#cache_key` and `#cache_version`
567
- to support it.
200
+ *Kevin Deisz*
568
201
 
569
- *DHH*
202
+ * Add method `dig` to `session`.
570
203
 
571
- * Add `action_controller_api` and `action_controller_base` load hooks to be called in `ActiveSupport.on_load`
204
+ *claudiob*, *Takumi Shotoku*
572
205
 
573
- `ActionController::Base` and `ActionController::API` have differing implementations. This means that
574
- the one umbrella hook `action_controller` is not able to address certain situations where a method
575
- may not exist in a certain implementation.
206
+ * Controller level `force_ssl` has been deprecated in favor of
207
+ `config.force_ssl`.
576
208
 
577
- This is fixed by adding two new hooks so you can target `ActionController::Base` vs `ActionController::API`
209
+ *Derek Prior*
578
210
 
579
- Fixes #27013.
211
+ * Rails 6 requires Ruby 2.5.0 or newer.
580
212
 
581
- *Julian Nadeau*
213
+ *Jeremy Daer*, *Kasper Timm Hansen*
582
214
 
583
215
 
584
- Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/actionpack/CHANGELOG.md) for previous changes.
216
+ Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/actionpack/CHANGELOG.md) for previous changes.