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