actionpack 6.0.3.7 → 6.1.3.2

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 (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +287 -226
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/lib/abstract_controller.rb +1 -0
  6. data/lib/abstract_controller/base.rb +35 -2
  7. data/lib/abstract_controller/callbacks.rb +2 -2
  8. data/lib/abstract_controller/helpers.rb +105 -90
  9. data/lib/abstract_controller/railties/routes_helpers.rb +17 -1
  10. data/lib/abstract_controller/rendering.rb +9 -9
  11. data/lib/abstract_controller/translation.rb +8 -2
  12. data/lib/action_controller.rb +2 -3
  13. data/lib/action_controller/api.rb +2 -2
  14. data/lib/action_controller/base.rb +4 -2
  15. data/lib/action_controller/caching.rb +0 -1
  16. data/lib/action_controller/log_subscriber.rb +3 -3
  17. data/lib/action_controller/metal.rb +2 -2
  18. data/lib/action_controller/metal/conditional_get.rb +11 -3
  19. data/lib/action_controller/metal/content_security_policy.rb +1 -1
  20. data/lib/action_controller/metal/cookies.rb +3 -1
  21. data/lib/action_controller/metal/data_streaming.rb +1 -1
  22. data/lib/action_controller/metal/etag_with_template_digest.rb +2 -4
  23. data/lib/action_controller/metal/exceptions.rb +33 -0
  24. data/lib/action_controller/metal/head.rb +7 -4
  25. data/lib/action_controller/metal/helpers.rb +11 -1
  26. data/lib/action_controller/metal/http_authentication.rb +4 -2
  27. data/lib/action_controller/metal/implicit_render.rb +1 -1
  28. data/lib/action_controller/metal/instrumentation.rb +11 -9
  29. data/lib/action_controller/metal/live.rb +1 -1
  30. data/lib/action_controller/metal/logging.rb +20 -0
  31. data/lib/action_controller/metal/mime_responds.rb +6 -2
  32. data/lib/action_controller/metal/parameter_encoding.rb +35 -4
  33. data/lib/action_controller/metal/params_wrapper.rb +14 -8
  34. data/lib/action_controller/metal/permissions_policy.rb +46 -0
  35. data/lib/action_controller/metal/redirecting.rb +1 -1
  36. data/lib/action_controller/metal/rendering.rb +6 -0
  37. data/lib/action_controller/metal/request_forgery_protection.rb +48 -24
  38. data/lib/action_controller/metal/rescue.rb +1 -1
  39. data/lib/action_controller/metal/strong_parameters.rb +103 -15
  40. data/lib/action_controller/renderer.rb +24 -13
  41. data/lib/action_controller/test_case.rb +62 -56
  42. data/lib/action_dispatch.rb +3 -2
  43. data/lib/action_dispatch/http/cache.rb +12 -10
  44. data/lib/action_dispatch/http/content_disposition.rb +2 -2
  45. data/lib/action_dispatch/http/content_security_policy.rb +5 -1
  46. data/lib/action_dispatch/http/filter_parameters.rb +1 -1
  47. data/lib/action_dispatch/http/filter_redirect.rb +1 -1
  48. data/lib/action_dispatch/http/headers.rb +3 -2
  49. data/lib/action_dispatch/http/mime_negotiation.rb +20 -8
  50. data/lib/action_dispatch/http/mime_type.rb +29 -16
  51. data/lib/action_dispatch/http/parameters.rb +1 -19
  52. data/lib/action_dispatch/http/permissions_policy.rb +173 -0
  53. data/lib/action_dispatch/http/request.rb +26 -8
  54. data/lib/action_dispatch/http/response.rb +17 -16
  55. data/lib/action_dispatch/http/url.rb +3 -2
  56. data/lib/action_dispatch/journey.rb +0 -2
  57. data/lib/action_dispatch/journey/formatter.rb +53 -28
  58. data/lib/action_dispatch/journey/gtg/builder.rb +22 -36
  59. data/lib/action_dispatch/journey/gtg/simulator.rb +8 -7
  60. data/lib/action_dispatch/journey/gtg/transition_table.rb +6 -4
  61. data/lib/action_dispatch/journey/nfa/dot.rb +0 -11
  62. data/lib/action_dispatch/journey/nodes/node.rb +4 -3
  63. data/lib/action_dispatch/journey/parser.rb +13 -13
  64. data/lib/action_dispatch/journey/parser.y +1 -1
  65. data/lib/action_dispatch/journey/path/pattern.rb +13 -18
  66. data/lib/action_dispatch/journey/route.rb +7 -18
  67. data/lib/action_dispatch/journey/router.rb +26 -30
  68. data/lib/action_dispatch/journey/router/utils.rb +6 -4
  69. data/lib/action_dispatch/middleware/actionable_exceptions.rb +2 -2
  70. data/lib/action_dispatch/middleware/cookies.rb +74 -33
  71. data/lib/action_dispatch/middleware/debug_exceptions.rb +10 -17
  72. data/lib/action_dispatch/middleware/debug_view.rb +1 -1
  73. data/lib/action_dispatch/middleware/exception_wrapper.rb +29 -17
  74. data/lib/action_dispatch/middleware/host_authorization.rb +27 -7
  75. data/lib/action_dispatch/middleware/public_exceptions.rb +1 -1
  76. data/lib/action_dispatch/middleware/remote_ip.rb +5 -4
  77. data/lib/action_dispatch/middleware/request_id.rb +4 -5
  78. data/lib/action_dispatch/middleware/session/abstract_store.rb +2 -2
  79. data/lib/action_dispatch/middleware/session/cookie_store.rb +2 -2
  80. data/lib/action_dispatch/middleware/show_exceptions.rb +2 -0
  81. data/lib/action_dispatch/middleware/ssl.rb +12 -7
  82. data/lib/action_dispatch/middleware/stack.rb +19 -1
  83. data/lib/action_dispatch/middleware/static.rb +154 -93
  84. data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +22 -0
  85. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +2 -5
  86. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +2 -2
  87. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +2 -2
  88. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +100 -8
  89. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +1 -1
  90. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +21 -1
  91. data/lib/action_dispatch/railtie.rb +3 -2
  92. data/lib/action_dispatch/request/session.rb +2 -8
  93. data/lib/action_dispatch/request/utils.rb +26 -2
  94. data/lib/action_dispatch/routing/inspector.rb +8 -7
  95. data/lib/action_dispatch/routing/mapper.rb +102 -71
  96. data/lib/action_dispatch/routing/polymorphic_routes.rb +12 -11
  97. data/lib/action_dispatch/routing/redirection.rb +4 -4
  98. data/lib/action_dispatch/routing/route_set.rb +49 -41
  99. data/lib/action_dispatch/routing/url_for.rb +1 -0
  100. data/lib/action_dispatch/system_test_case.rb +29 -24
  101. data/lib/action_dispatch/system_testing/browser.rb +33 -27
  102. data/lib/action_dispatch/system_testing/driver.rb +6 -7
  103. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +47 -6
  104. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +4 -7
  105. data/lib/action_dispatch/testing/assertions.rb +1 -1
  106. data/lib/action_dispatch/testing/assertions/response.rb +2 -4
  107. data/lib/action_dispatch/testing/assertions/routing.rb +5 -5
  108. data/lib/action_dispatch/testing/integration.rb +40 -29
  109. data/lib/action_dispatch/testing/test_process.rb +29 -4
  110. data/lib/action_dispatch/testing/test_request.rb +3 -3
  111. data/lib/action_pack.rb +1 -1
  112. data/lib/action_pack/gem_version.rb +2 -2
  113. metadata +16 -17
  114. data/lib/action_controller/metal/force_ssl.rb +0 -58
  115. data/lib/action_dispatch/http/parameter_filter.rb +0 -12
  116. data/lib/action_dispatch/journey/nfa/builder.rb +0 -78
  117. data/lib/action_dispatch/journey/nfa/simulator.rb +0 -47
  118. data/lib/action_dispatch/journey/nfa/transition_table.rb +0 -119
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 689cadf2c5055a30bce24daa0dbd2c5f4e9b62b8e05f318527556df6a1bbc0bd
4
- data.tar.gz: db971eb4537c26d3c61aaeb5933a936ab80465ab7533c3a1fd96fed34bc98159
3
+ metadata.gz: 9cfba18fd1e2c6507de318e22c9cab8f878c22b9cbce70065f9c2ff9053f1d96
4
+ data.tar.gz: 178c4347f79392aaa6d452c3eeb406cbecf66a9b3ece0d244f98d7a4fa15b6ab
5
5
  SHA512:
6
- metadata.gz: bb3325660659b91dd7917b48dfd211078d28812bfae7695e224599573835d7c42994ead64ebeb5c121d1dbc4ac30da9ae0f3a0be304892c914ce2309d8b3fc2b
7
- data.tar.gz: 826160c64038886b1bc08301f8d4782cd1564f5b167d452bd87b8870043581dc971bb9f5a54075001fe254148fc8845187f660f4cf4fcb84f5dfdf17bfb85dda
6
+ metadata.gz: 6479340989a0677d3e64e0723a67c0cc64ea4dc9d5fcfe6bfad6538703582f3b95bc2426b68c56c2dda3a1b66842e7ed890b70fefbf136c8a198d23336525447
7
+ data.tar.gz: 9021e02a953bf859d984e3722561745d0b562292b3fe3566ee1d362a9eb8c06af868f2d17db7dd5558e31871f626a39d8d9a7bb9b34697c5d26b8b58a533db4f
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- ## Rails 6.0.3.7 (May 05, 2021) ##
1
+ ## Rails 6.1.3.2 (May 05, 2021) ##
2
+
3
+ * Prevent open redirects by correctly escaping the host allow list
4
+ CVE-2021-22903
2
5
 
3
6
  * Prevent catastrophic backtracking during mime parsing
4
7
  CVE-2021-22902
@@ -16,12 +19,19 @@
16
19
 
17
20
  *Gannon McGibbon*
18
21
 
19
- ## Rails 6.0.3.6 (March 26, 2021) ##
22
+ ## Rails 6.1.3.1 (March 26, 2021) ##
20
23
 
21
24
  * No changes.
22
25
 
23
26
 
24
- ## Rails 6.0.3.5 (February 10, 2021) ##
27
+ ## Rails 6.1.3 (February 17, 2021) ##
28
+
29
+ * Re-define routes when not set correctly via inheritance.
30
+
31
+ *John Hawthorn*
32
+
33
+
34
+ ## Rails 6.1.2.1 (February 10, 2021) ##
25
35
 
26
36
  * Prevent open redirect when allowed host starts with a dot
27
37
 
@@ -33,389 +43,440 @@
33
43
  *Aaron Patterson*
34
44
 
35
45
 
36
- ## Rails 6.0.3.4 (October 07, 2020) ##
37
-
38
- * [CVE-2020-8264] Prevent XSS in Actionable Exceptions
46
+ ## Rails 6.1.2 (February 09, 2021) ##
39
47
 
48
+ * Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
40
49
 
41
- ## Rails 6.0.3.3 (September 09, 2020) ##
50
+ *Janko Marohnić*
42
51
 
43
- * No changes.
52
+ * Fix `fixture_file_upload` deprecation when `file_fixture_path` is a relative path.
44
53
 
54
+ *Eugene Kenny*
45
55
 
46
- ## Rails 6.0.3.2 (June 17, 2020) ##
47
56
 
48
- * [CVE-2020-8185] Only allow ActionableErrors if show_detailed_exceptions is enabled
57
+ ## Rails 6.1.1 (January 07, 2021) ##
49
58
 
50
- ## Rails 6.0.3.1 (May 18, 2020) ##
59
+ * Fix nil translation key lookup in controllers/
51
60
 
52
- * [CVE-2020-8166] HMAC raw CSRF token before masking it, so it cannot be used to reconstruct a per-form token
61
+ *Jan Klimo*
53
62
 
54
- * [CVE-2020-8164] Return self when calling #each, #each_pair, and #each_value instead of the raw @parameters hash
63
+ * Quietly handle unknown HTTP methods in Action Dispatch SSL middleware.
55
64
 
56
- ## Rails 6.0.3 (May 06, 2020) ##
65
+ *Alex Robbin*
57
66
 
58
- * Include child session assertion count in ActionDispatch::IntegrationTest
67
+ * Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
59
68
 
60
- `IntegrationTest#open_session` uses `dup` to create the new session, which
61
- meant it had its own copy of `@assertions`. This prevented the assertions
62
- from being correctly counted and reported.
69
+ *Alex Robbin*
63
70
 
64
- Child sessions now have their `attr_accessor` overriden to delegate to the
65
- root session.
66
71
 
67
- Fixes #32142
72
+ ## Rails 6.1.0 (December 09, 2020) ##
68
73
 
69
- *Sam Bostock*
74
+ * Support for the HTTP header `Feature-Policy` has been revised to reflect
75
+ 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).
70
76
 
77
+ ```ruby
78
+ Rails.application.config.permissions_policy do |p|
79
+ p.camera :none
80
+ p.gyroscope :none
81
+ p.microphone :none
82
+ p.usb :none
83
+ p.fullscreen :self
84
+ p.payment :self, "https://secure-example.com"
85
+ end
86
+ ```
71
87
 
72
- ## Rails 6.0.2.2 (March 19, 2020) ##
88
+ *Julien Grillot*
73
89
 
74
- * No changes.
90
+ * Allow `ActionDispatch::HostAuthorization` to exclude specific requests.
75
91
 
92
+ 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.
76
93
 
77
- ## Rails 6.0.2.1 (December 18, 2019) ##
94
+ *Chris Bisnett*
78
95
 
79
- * Fix possible information leak / session hijacking vulnerability.
96
+ * Add `config.action_dispatch.request_id_header` to allow changing the name of
97
+ the unique X-Request-Id header
80
98
 
81
- The `ActionDispatch::Session::MemcacheStore` is still vulnerable given it requires the
82
- gem dalli to be updated as well.
99
+ *Arlston Fernandes*
83
100
 
84
- CVE-2019-16782.
101
+ * Deprecate `config.action_dispatch.return_only_media_type_on_content_type`.
85
102
 
103
+ *Rafael Mendonça França*
86
104
 
87
- ## Rails 6.0.2 (December 13, 2019) ##
105
+ * Change `ActionDispatch::Response#content_type` to return the full Content-Type header.
88
106
 
89
- * Allow using mountable engine route helpers in System Tests.
107
+ *Rafael Mendonça França*
90
108
 
91
- *Chalo Fernandez*
109
+ * Remove deprecated `ActionDispatch::Http::ParameterFilter`.
92
110
 
111
+ *Rafael Mendonça França*
93
112
 
94
- ## Rails 6.0.1 (November 5, 2019) ##
113
+ * Added support for exclusive no-store Cache-Control header.
95
114
 
96
- * `ActionDispatch::SystemTestCase` now inherits from `ActiveSupport::TestCase`
97
- rather than `ActionDispatch::IntegrationTest`. This permits running jobs in
98
- system tests.
115
+ If `no-store` is set on Cache-Control header it is exclusive (all other cache directives are dropped).
99
116
 
100
- *George Claghorn*, *Edouard Chin*
117
+ *Chris Kruger*
101
118
 
102
- * Registered MIME types may contain extra flags:
119
+ * Catch invalid UTF-8 parameters for POST requests and respond with BadRequest.
103
120
 
104
- ```ruby
105
- Mime::Type.register "text/html; fragment", :html_fragment
106
- ```
121
+ Additionally, perform `#set_binary_encoding` in `ActionDispatch::Http::Request#GET` and
122
+ `ActionDispatch::Http::Request#POST` prior to validating encoding.
107
123
 
108
- *Aaron Patterson*
124
+ *Adrianna Chang*
109
125
 
126
+ * Allow `assert_recognizes` routing assertions to work on mounted root routes.
110
127
 
111
- ## Rails 6.0.0 (August 16, 2019) ##
128
+ *Gannon McGibbon*
112
129
 
113
- * No changes.
130
+ * Change default redirection status code for non-GET/HEAD requests to 308 Permanent Redirect for `ActionDispatch::SSL`.
114
131
 
132
+ *Alan Tan*, *Oz Ben-David*
115
133
 
116
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
134
+ * Fix `follow_redirect!` to follow redirection with same HTTP verb when following
135
+ a 308 redirection.
117
136
 
118
- * Add the ability to set the CSP nonce only to the specified directives.
137
+ *Alan Tan*
119
138
 
120
- Fixes #35137.
139
+ * When multiple domains are specified for a cookie, a domain will now be
140
+ chosen only if it is equal to or is a superdomain of the request host.
121
141
 
122
- *Yuji Yaginuma*
142
+ *Jonathan Hefner*
123
143
 
124
- * Keep part when scope option has value.
144
+ * `ActionDispatch::Static` handles precompiled Brotli (.br) files.
125
145
 
126
- When a route was defined within an optional scope, if that route didn't
127
- take parameters the scope was lost when using path helpers. This commit
128
- ensures scope is kept both when the route takes parameters or when it
129
- doesn't.
146
+ Adds to existing support for precompiled gzip (.gz) files.
147
+ Brotli files are preferred due to much better compression.
130
148
 
131
- Fixes #33219
149
+ When the browser requests /some.js with `Accept-Encoding: br`,
150
+ we check for public/some.js.br and serve that file, if present, with
151
+ `Content-Encoding: br` and `Vary: Accept-Encoding` headers.
132
152
 
133
- *Alberto Almagro*
153
+ *Ryan Edward Hall*, *Jeremy Daer*
134
154
 
135
- * Change `ActionDispatch::Response#content_type` to return Content-Type header as it is.
155
+ * Add raise_on_missing_translations support for controllers.
136
156
 
137
- Previously, `ActionDispatch::Response#content_type` returned value does NOT
138
- contain charset part. This behavior changed to returned Content-Type header
139
- containing charset part as it is.
157
+ This configuration determines whether an error should be raised for missing translations.
158
+ It can be enabled through `config.i18n.raise_on_missing_translations`. Note that described
159
+ configuration also affects raising error for missing translations in views.
140
160
 
141
- If you want just MIME type, please use `ActionDispatch::Response#media_type`
142
- instead.
161
+ *fatkodima*
143
162
 
144
- Enable `action_dispatch.return_only_media_type_on_content_type` to use this change.
145
- If not enabled, `ActionDispatch::Response#content_type` returns the same
146
- value as before version, but its behavior is deprecate.
163
+ * Added `compact` and `compact!` to `ActionController::Parameters`.
147
164
 
148
- *Yuji Yaginuma*
165
+ *Eugene Kenny*
149
166
 
150
- * Calling `ActionController::Parameters#transform_keys/!` without a block now returns
151
- an enumerator for the parameters instead of the underlying hash.
167
+ * Calling `each_pair` or `each_value` on an `ActionController::Parameters`
168
+ without passing a block now returns an enumerator.
152
169
 
153
170
  *Eugene Kenny*
154
171
 
155
- * Fix a bug where DebugExceptions throws an error when malformed query parameters are provided
172
+ * `fixture_file_upload` now uses path relative to `file_fixture_path`
156
173
 
157
- *Yuki Nishijima*, *Stan Lo*
174
+ Previously the path had to be relative to `fixture_path`.
175
+ You can change your existing code as follow:
158
176
 
177
+ ```ruby
178
+ # Before
179
+ fixture_file_upload('files/dog.png')
159
180
 
160
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
181
+ # After
182
+ fixture_file_upload('dog.png')
183
+ ```
161
184
 
162
- * Make system tests take a failed screenshot in a `before_teardown` hook
163
- rather than an `after_teardown` hook.
185
+ *Edouard Chin*
164
186
 
165
- This helps minimize the time gap between when an assertion fails and when
166
- the screenshot is taken (reducing the time in which the page could have
167
- been dynamically updated after the assertion failed).
187
+ * Remove deprecated `force_ssl` at the controller level.
168
188
 
169
- *Richard Macklin*
189
+ *Rafael Mendonça França*
170
190
 
171
- * Introduce `ActionDispatch::ActionableExceptions`.
191
+ * The +helper+ class method for controllers loads helper modules specified as
192
+ strings/symbols with `String#constantize` instead of `require_dependency`.
172
193
 
173
- The `ActionDispatch::ActionableExceptions` middleware dispatches actions
174
- from `ActiveSupport::ActionableError` descendants.
194
+ Remember that support for strings/symbols is only a convenient API. You can
195
+ always pass a module object:
175
196
 
176
- Actionable errors let's you dispatch actions from Rails' error pages.
197
+ ```ruby
198
+ helper UtilsHelper
199
+ ```
177
200
 
178
- *Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
201
+ which is recommended because it is simple and direct. When a string/symbol
202
+ is received, `helper` just manipulates and inflects the argument to obtain
203
+ that same module object.
179
204
 
180
- * Raise an `ArgumentError` if a resource custom param contains a colon (`:`).
205
+ *Xavier Noria*, *Jean Boussier*
181
206
 
182
- After this change it's not possible anymore to configure routes like this:
207
+ * Correctly identify the entire localhost IPv4 range as trusted proxy.
183
208
 
184
- ```
185
- routes.draw do
186
- resources :users, param: 'name/:sneaky'
187
- end
188
- ```
209
+ *Nick Soracco*
189
210
 
190
- Fixes #30467.
211
+ * `url_for` will now use "https://" as the default protocol when
212
+ `Rails.application.config.force_ssl` is set to true.
191
213
 
192
- *Josua Schmid*
214
+ *Jonathan Hefner*
193
215
 
216
+ * Accept and default to base64_urlsafe CSRF tokens.
194
217
 
195
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
218
+ Base64 strict-encoded CSRF tokens are not inherently websafe, which makes
219
+ them difficult to deal with. For example, the common practice of sending
220
+ the CSRF token to a browser in a client-readable cookie does not work properly
221
+ out of the box: the value has to be url-encoded and decoded to survive transport.
196
222
 
197
- * No changes.
223
+ Now, we generate Base64 urlsafe-encoded CSRF tokens, which are inherently safe
224
+ to transport. Validation accepts both urlsafe tokens, and strict-encoded tokens
225
+ for backwards compatibility.
198
226
 
227
+ *Scott Blum*
199
228
 
200
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
229
+ * Support rolling deploys for cookie serialization/encryption changes.
201
230
 
202
- * Make debug exceptions works in an environment where ActiveStorage is not loaded.
231
+ In a distributed configuration like rolling update, users may observe
232
+ both old and new instances during deployment. Users may be served by a
233
+ new instance and then by an old instance.
203
234
 
204
- *Tomoyuki Kurosawa*
235
+ That means when the server changes `cookies_serializer` from `:marshal`
236
+ to `:hybrid` or the server changes `use_authenticated_cookie_encryption`
237
+ from `false` to `true`, users may lose their sessions if they access the
238
+ server during deployment.
205
239
 
206
- * `ActionDispatch::SystemTestCase.driven_by` can now be called with a block
207
- to define specific browser capabilities.
240
+ We added fallbacks to downgrade the cookie format when necessary during
241
+ deployment, ensuring compatibility on both old and new instances.
208
242
 
209
- *Edouard Chin*
243
+ *Masaki Hara*
210
244
 
245
+ * `ActionDispatch::Request.remote_ip` has ip address even when all sites are trusted.
211
246
 
212
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
247
+ Before, if all `X-Forwarded-For` sites were trusted, the `remote_ip` would default to `127.0.0.1`.
248
+ Now, the furthest proxy site is used. e.g.: It now gives an ip address when using curl from the load balancer.
213
249
 
214
- * Remove deprecated `fragment_cache_key` helper in favor of `combined_fragment_cache_key`.
250
+ *Keenan Brock*
215
251
 
216
- *Rafael Mendonça França*
252
+ * Fix possible information leak / session hijacking vulnerability.
217
253
 
218
- * Remove deprecated methods in `ActionDispatch::TestResponse`.
254
+ The `ActionDispatch::Session::MemcacheStore` is still vulnerable given it requires the
255
+ gem dalli to be updated as well.
219
256
 
220
- `#success?`, `missing?` and `error?` were deprecated in Rails 5.2 in favor of
221
- `#successful?`, `not_found?` and `server_error?`.
257
+ CVE-2019-16782.
222
258
 
223
- *Rafael Mendonça França*
259
+ * Include child session assertion count in ActionDispatch::IntegrationTest.
224
260
 
225
- * Introduce `ActionDispatch::HostAuthorization`.
261
+ `IntegrationTest#open_session` uses `dup` to create the new session, which
262
+ meant it had its own copy of `@assertions`. This prevented the assertions
263
+ from being correctly counted and reported.
226
264
 
227
- This is a new middleware that guards against DNS rebinding attacks by
228
- explicitly permitting the hosts a request can be made to.
265
+ Child sessions now have their `attr_accessor` overridden to delegate to the
266
+ root session.
229
267
 
230
- Each host is checked with the case operator (`#===`) to support `Regexp`,
231
- `Proc`, `IPAddr` and custom objects as host allowances.
268
+ Fixes #32142.
232
269
 
233
- *Genadi Samokovarov*
270
+ *Sam Bostock*
234
271
 
235
- * Allow using `parsed_body` in `ActionController::TestCase`.
272
+ * Add SameSite protection to every written cookie.
236
273
 
237
- In addition to `ActionDispatch::IntegrationTest`, allow using
238
- `parsed_body` in `ActionController::TestCase`:
274
+ Enabling `SameSite` cookie protection is an addition to CSRF protection,
275
+ where cookies won't be sent by browsers in cross-site POST requests when set to `:lax`.
239
276
 
240
- ```
241
- class SomeControllerTest < ActionController::TestCase
242
- def test_some_action
243
- post :action, body: { foo: 'bar' }
244
- assert_equal({ "foo" => "bar" }, response.parsed_body)
245
- end
246
- end
247
- ```
277
+ `:strict` disables cookies being sent in cross-site GET or POST requests.
248
278
 
249
- Fixes #34676.
279
+ Passing `:none` disables this protection and is the same as previous versions albeit a `; SameSite=None` is appended to the cookie.
250
280
 
251
- *Tobias Bühlmann*
281
+ See upgrade instructions in config/initializers/new_framework_defaults_6_1.rb.
252
282
 
253
- * Raise an error on root route naming conflicts.
283
+ More info [here](https://tools.ietf.org/html/draft-west-first-party-cookies-07)
254
284
 
255
- Raises an `ArgumentError` when multiple root routes are defined in the
256
- same context instead of assigning nil names to subsequent roots.
285
+ _NB: Technically already possible as Rack supports SameSite protection, this is to ensure it's applied to all cookies_
257
286
 
258
- *Gannon McGibbon*
287
+ *Cédric Fabianski*
259
288
 
260
- * Allow rescue from parameter parse errors:
289
+ * Bring back the feature that allows loading external route files from the router.
261
290
 
262
- ```
263
- rescue_from ActionDispatch::Http::Parameters::ParseError do
264
- head :unauthorized
291
+ This feature existed back in 2012 but got reverted with the incentive that
292
+ https://github.com/rails/routing_concerns was a better approach. Turned out
293
+ that this wasn't fully the case and loading external route files from the router
294
+ can be helpful for applications with a really large set of routes.
295
+ Without this feature, application needs to implement routes reloading
296
+ themselves and it's not straightforward.
297
+
298
+ ```ruby
299
+ # config/routes.rb
300
+
301
+ Rails.application.routes.draw do
302
+ draw(:admin)
265
303
  end
304
+
305
+ # config/routes/admin.rb
306
+
307
+ get :foo, to: 'foo#bar'
266
308
  ```
267
309
 
268
- *Gannon McGibbon*, *Josh Cheek*
310
+ *Yehuda Katz*, *Edouard Chin*
311
+
312
+ * Fix system test driver option initialization for non-headless browsers.
313
+
314
+ *glaszig*
269
315
 
270
- * Reset Capybara sessions if failed system test screenshot raising an exception.
316
+ * `redirect_to.action_controller` notifications now include the `ActionDispatch::Request` in
317
+ their payloads as `:request`.
271
318
 
272
- Reset Capybara sessions if `take_failed_screenshot` raise exception
273
- in system test `after_teardown`.
319
+ *Austin Story*
274
320
 
275
- *Maxim Perepelitsa*
321
+ * `respond_to#any` no longer returns a response's Content-Type based on the
322
+ request format but based on the block given.
276
323
 
277
- * Use request object for context if there's no controller
324
+ Example:
278
325
 
279
- There is no controller instance when using a redirect route or a
280
- mounted rack application so pass the request object as the context
281
- when resolving dynamic CSP sources in this scenario.
326
+ ```ruby
327
+ def my_action
328
+ respond_to do |format|
329
+ format.any { render(json: { foo: 'bar' }) }
330
+ end
331
+ end
282
332
 
283
- Fixes #34200.
333
+ get('my_action.csv')
334
+ ```
284
335
 
285
- *Andrew White*
336
+ The previous behaviour was to respond with a `text/csv` Content-Type which
337
+ is inaccurate since a JSON response is being rendered.
286
338
 
287
- * Apply mapping to symbols returned from dynamic CSP sources
339
+ Now it correctly returns a `application/json` Content-Type.
288
340
 
289
- Previously if a dynamic source returned a symbol such as :self it
290
- would be converted to a string implicitly, e.g:
341
+ *Edouard Chin*
291
342
 
292
- policy.default_src -> { :self }
343
+ * Replaces (back)slashes in failure screenshot image paths with dashes.
293
344
 
294
- would generate the header:
345
+ If a failed test case contained a slash or a backslash, a screenshot would be created in a
346
+ nested directory, causing issues with `tmp:clear`.
295
347
 
296
- Content-Security-Policy: default-src self
348
+ *Damir Zekic*
297
349
 
298
- and now it generates:
350
+ * Add `params.member?` to mimic Hash behavior.
299
351
 
300
- Content-Security-Policy: default-src 'self'
352
+ *Younes Serraj*
301
353
 
302
- *Andrew White*
354
+ * `process_action.action_controller` notifications now include the following in their payloads:
303
355
 
304
- * Add `ActionController::Parameters#each_value`.
356
+ * `:request` - the `ActionDispatch::Request`
357
+ * `:response` - the `ActionDispatch::Response`
305
358
 
306
- *Lukáš Zapletal*
359
+ *George Claghorn*
307
360
 
308
- * Deprecate `ActionDispatch::Http::ParameterFilter` in favor of `ActiveSupport::ParameterFilter`.
361
+ * Updated `ActionDispatch::Request.remote_ip` setter to clear set the instance
362
+ `remote_ip` to `nil` before setting the header that the value is derived
363
+ from.
309
364
 
310
- *Yoshiyuki Kinjo*
365
+ Fixes #37383.
311
366
 
312
- * Encode Content-Disposition filenames on `send_data` and `send_file`.
313
- Previously, `send_data 'data', filename: "\u{3042}.txt"` sends
314
- `"filename=\"\u{3042}.txt\""` as Content-Disposition and it can be
315
- garbled.
316
- Now it follows [RFC 2231](https://tools.ietf.org/html/rfc2231) and
317
- [RFC 5987](https://tools.ietf.org/html/rfc5987) and sends
318
- `"filename=\"%3F.txt\"; filename*=UTF-8''%E3%81%82.txt"`.
319
- Most browsers can find filename correctly and old browsers fallback to ASCII
320
- converted name.
367
+ *Norm Provost*
321
368
 
322
- *Fumiaki Matsushima*
369
+ * `ActionController::Base.log_at` allows setting a different log level per request.
323
370
 
324
- * Expose `ActionController::Parameters#each_key` which allows iterating over
325
- keys without allocating an array.
371
+ ```ruby
372
+ # Use the debug level if a particular cookie is set.
373
+ class ApplicationController < ActionController::Base
374
+ log_at :debug, if: -> { cookies[:debug] }
375
+ end
376
+ ```
326
377
 
327
- *Richard Schneeman*
378
+ *George Claghorn*
328
379
 
329
- * Purpose metadata for signed/encrypted cookies.
380
+ * Allow system test screen shots to be taken more than once in
381
+ a test by prefixing the file name with an incrementing counter.
330
382
 
331
- Rails can now thwart attacks that attempt to copy signed/encrypted value
332
- of a cookie and use it as the value of another cookie.
383
+ Add an environment variable `RAILS_SYSTEM_TESTING_SCREENSHOT_HTML` to
384
+ enable saving of HTML during a screenshot in addition to the image.
385
+ This uses the same image name, with the extension replaced with `.html`
333
386
 
334
- It does so by stashing the cookie-name in the purpose field which is
335
- then signed/encrypted along with the cookie value. Then, on a server-side
336
- read, we verify the cookie-names and discard any attacked cookies.
387
+ *Tom Fakes*
337
388
 
338
- Enable `action_dispatch.use_cookies_with_metadata` to use this feature, which
339
- writes cookies with the new purpose and expiry metadata embedded.
389
+ * Add `Vary: Accept` header when using `Accept` header for response.
340
390
 
341
- *Assain Jaleel*
391
+ For some requests like `/users/1`, Rails uses requests' `Accept`
392
+ header to determine what to return. And if we don't add `Vary`
393
+ in the response header, browsers might accidentally cache different
394
+ types of content, which would cause issues: e.g. javascript got displayed
395
+ instead of html content. This PR fixes these issues by adding `Vary: Accept`
396
+ in these types of requests. For more detailed problem description, please read:
342
397
 
343
- * Raises `ActionController::RespondToMismatchError` with conflicting `respond_to` invocations.
398
+ https://github.com/rails/rails/pull/36213
344
399
 
345
- `respond_to` can match multiple types and lead to undefined behavior when
346
- multiple invocations are made and the types do not match:
400
+ Fixes #25842.
347
401
 
348
- respond_to do |outer_type|
349
- outer_type.js do
350
- respond_to do |inner_type|
351
- inner_type.html { render body: "HTML" }
352
- end
353
- end
354
- end
402
+ *Stan Lo*
355
403
 
356
- *Patrick Toomey*
404
+ * Fix IntegrationTest `follow_redirect!` to follow redirection using the same HTTP verb when following
405
+ a 307 redirection.
357
406
 
358
- * `ActionDispatch::Http::UploadedFile` now delegates `to_path` to its tempfile.
407
+ *Edouard Chin*
359
408
 
360
- This allows uploaded file objects to be passed directly to `File.read`
361
- without raising a `TypeError`:
409
+ * System tests require Capybara 3.26 or newer.
362
410
 
363
- uploaded_file = ActionDispatch::Http::UploadedFile.new(tempfile: tmp_file)
364
- File.read(uploaded_file)
411
+ *George Claghorn*
365
412
 
366
- *Aaron Kromer*
413
+ * Reduced log noise handling ActionController::RoutingErrors.
367
414
 
368
- * Pass along arguments to underlying `get` method in `follow_redirect!`
415
+ *Alberto Fernández-Capel*
369
416
 
370
- Now all arguments passed to `follow_redirect!` are passed to the underlying
371
- `get` method. This for example allows to set custom headers for the
372
- redirection request to the server.
417
+ * Add DSL for configuring HTTP Feature Policy.
373
418
 
374
- follow_redirect!(params: { foo: :bar })
419
+ This new DSL provides a way to configure an HTTP Feature Policy at a
420
+ global or per-controller level. Full details of HTTP Feature Policy
421
+ specification and guidelines can be found at MDN:
375
422
 
376
- *Remo Fritzsche*
423
+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
377
424
 
378
- * Introduce a new error page to when the implicit render page is accessed in the browser.
425
+ Example global policy:
379
426
 
380
- Now instead of showing an error page that with exception and backtraces we now show only
381
- one informative page.
427
+ ```ruby
428
+ Rails.application.config.feature_policy do |f|
429
+ f.camera :none
430
+ f.gyroscope :none
431
+ f.microphone :none
432
+ f.usb :none
433
+ f.fullscreen :self
434
+ f.payment :self, "https://secure.example.com"
435
+ end
436
+ ```
382
437
 
383
- *Vinicius Stock*
438
+ Example controller level policy:
384
439
 
385
- * Introduce `ActionDispatch::DebugExceptions.register_interceptor`.
440
+ ```ruby
441
+ class PagesController < ApplicationController
442
+ feature_policy do |p|
443
+ p.geolocation "https://example.com"
444
+ end
445
+ end
446
+ ```
386
447
 
387
- Exception aware plugin authors can use the newly introduced
388
- `.register_interceptor` method to get the processed exception, instead of
389
- monkey patching DebugExceptions.
448
+ *Jacob Bednarz*
390
449
 
391
- ActionDispatch::DebugExceptions.register_interceptor do |request, exception|
392
- HypoteticalPlugin.capture_exception(request, exception)
393
- end
450
+ * Add the ability to set the CSP nonce only to the specified directives.
394
451
 
395
- *Genadi Samokovarov*
452
+ Fixes #35137.
396
453
 
397
- * Output only one Content-Security-Policy nonce header value per request.
454
+ *Yuji Yaginuma*
398
455
 
399
- Fixes #32597.
456
+ * Keep part when scope option has value.
400
457
 
401
- *Andrey Novikov*, *Andrew White*
458
+ When a route was defined within an optional scope, if that route didn't
459
+ take parameters the scope was lost when using path helpers. This commit
460
+ ensures scope is kept both when the route takes parameters or when it
461
+ doesn't.
402
462
 
403
- * Move default headers configuration into their own module that can be included in controllers.
463
+ Fixes #33219.
404
464
 
405
- *Kevin Deisz*
465
+ *Alberto Almagro*
406
466
 
407
- * Add method `dig` to `session`.
467
+ * Added `deep_transform_keys` and `deep_transform_keys!` methods to ActionController::Parameters.
408
468
 
409
- *claudiob*, *Takumi Shotoku*
469
+ *Gustavo Gutierrez*
410
470
 
411
- * Controller level `force_ssl` has been deprecated in favor of
412
- `config.force_ssl`.
471
+ * Calling `ActionController::Parameters#transform_keys`/`!` without a block now returns
472
+ an enumerator for the parameters instead of the underlying hash.
413
473
 
414
- *Derek Prior*
474
+ *Eugene Kenny*
415
475
 
416
- * Rails 6 requires Ruby 2.5.0 or newer.
476
+ * Fix strong parameters blocks all attributes even when only some keys are invalid (non-numerical).
477
+ It should only block invalid key's values instead.
417
478
 
418
- *Jeremy Daer*, *Kasper Timm Hansen*
479
+ *Stan Lo*
419
480
 
420
481
 
421
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/actionpack/CHANGELOG.md) for previous changes.
482
+ Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionpack/CHANGELOG.md) for previous changes.