actionpack 6.0.3.3 → 6.1.1
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 +267 -222
- data/MIT-LICENSE +1 -1
- data/lib/abstract_controller.rb +1 -0
- 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/action_controller.rb +2 -3
- 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.rb +2 -2
- data/lib/action_controller/metal/conditional_get.rb +11 -3
- 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 +4 -2
- 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 +14 -8
- 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 +48 -24
- data/lib/action_controller/metal/rescue.rb +1 -1
- data/lib/action_controller/metal/strong_parameters.rb +103 -15
- data/lib/action_controller/renderer.rb +24 -13
- data/lib/action_controller/test_case.rb +62 -56
- data/lib/action_dispatch.rb +3 -2
- data/lib/action_dispatch/http/cache.rb +12 -10
- data/lib/action_dispatch/http/content_disposition.rb +2 -2
- data/lib/action_dispatch/http/content_security_policy.rb +5 -1
- 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 +20 -8
- data/lib/action_dispatch/http/mime_type.rb +28 -15
- 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 +26 -8
- data/lib/action_dispatch/http/response.rb +17 -16
- data/lib/action_dispatch/http/url.rb +3 -2
- data/lib/action_dispatch/journey.rb +0 -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.rb +26 -30
- data/lib/action_dispatch/journey/router/utils.rb +6 -4
- data/lib/action_dispatch/middleware/actionable_exceptions.rb +9 -2
- data/lib/action_dispatch/middleware/cookies.rb +74 -33
- data/lib/action_dispatch/middleware/debug_exceptions.rb +10 -17
- data/lib/action_dispatch/middleware/debug_view.rb +1 -1
- data/lib/action_dispatch/middleware/exception_wrapper.rb +29 -17
- data/lib/action_dispatch/middleware/host_authorization.rb +25 -5
- data/lib/action_dispatch/middleware/public_exceptions.rb +1 -1
- 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/show_exceptions.rb +2 -0
- data/lib/action_dispatch/middleware/ssl.rb +12 -7
- 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/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 -2
- 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 +21 -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 +12 -11
- data/lib/action_dispatch/routing/redirection.rb +3 -3
- data/lib/action_dispatch/routing/route_set.rb +49 -41
- data/lib/action_dispatch/routing/url_for.rb +1 -0
- 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.rb +1 -1
- 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/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_pack.rb +1 -1
- data/lib/action_pack/gem_version.rb +3 -3
- metadata +21 -22
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3813bd7e46eeb386962cafd48601aace5759055c9311cc47e79706458e4d8723
|
4
|
+
data.tar.gz: 9b1c73e829be328eff697fb0472c2917516a7956db547e6f364c1fa194a49cd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 271e0b7f7ce9cb659ffe7684f03677ea6699f065e1b2c1e8ce20cf992f3525c6ea2947702308b764fd21407498ac0e916dbd3390934615bf0c5d73450a938927
|
7
|
+
data.tar.gz: 9344404abd36b7fcc6bdf73a5186bc6bfc6665565b0fce4bf143aea6d149b61eefed5ec56787bebcbf0a9307bf464bbe4d822f726965f834fc3afaa13dde786d
|
data/CHANGELOG.md
CHANGED
@@ -1,381 +1,426 @@
|
|
1
|
-
## Rails 6.
|
1
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Fix nil translation key lookup in controllers/
|
4
4
|
|
5
|
+
*Jan Klimo*
|
5
6
|
|
6
|
-
|
7
|
+
* Quietly handle unknown HTTP methods in Action Dispatch SSL middleware.
|
7
8
|
|
8
|
-
*
|
9
|
+
*Alex Robbin*
|
9
10
|
|
10
|
-
|
11
|
+
* Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
|
11
12
|
|
12
|
-
*
|
13
|
+
*Alex Robbin*
|
13
14
|
|
14
|
-
* [CVE-2020-8164] Return self when calling #each, #each_pair, and #each_value instead of the raw @parameters hash
|
15
15
|
|
16
|
-
## Rails 6.0
|
16
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
17
17
|
|
18
|
-
*
|
18
|
+
* Support for the HTTP header `Feature-Policy` has been revised to reflect
|
19
|
+
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).
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
```ruby
|
22
|
+
Rails.application.config.permissions_policy do |p|
|
23
|
+
p.camera :none
|
24
|
+
p.gyroscope :none
|
25
|
+
p.microphone :none
|
26
|
+
p.usb :none
|
27
|
+
p.fullscreen :self
|
28
|
+
p.payment :self, "https://secure-example.com"
|
29
|
+
end
|
30
|
+
```
|
23
31
|
|
24
|
-
|
25
|
-
root session.
|
32
|
+
*Julien Grillot*
|
26
33
|
|
27
|
-
|
34
|
+
* Allow `ActionDispatch::HostAuthorization` to exclude specific requests.
|
28
35
|
|
29
|
-
|
36
|
+
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.
|
30
37
|
|
38
|
+
*Chris Bisnett*
|
31
39
|
|
32
|
-
|
40
|
+
* Add `config.action_dispatch.request_id_header` to allow changing the name of
|
41
|
+
the unique X-Request-Id header
|
33
42
|
|
34
|
-
*
|
43
|
+
*Arlston Fernandes*
|
35
44
|
|
45
|
+
* Deprecate `config.action_dispatch.return_only_media_type_on_content_type`.
|
36
46
|
|
37
|
-
|
47
|
+
*Rafael Mendonça França*
|
38
48
|
|
39
|
-
*
|
49
|
+
* Change `ActionDispatch::Response#content_type` to return the full Content-Type header.
|
40
50
|
|
41
|
-
|
42
|
-
gem dalli to be updated as well.
|
51
|
+
*Rafael Mendonça França*
|
43
52
|
|
44
|
-
|
53
|
+
* Remove deprecated `ActionDispatch::Http::ParameterFilter`.
|
45
54
|
|
55
|
+
*Rafael Mendonça França*
|
46
56
|
|
47
|
-
|
57
|
+
* Added support for exclusive no-store Cache-Control header.
|
48
58
|
|
49
|
-
|
59
|
+
If `no-store` is set on Cache-Control header it is exclusive (all other cache directives are dropped).
|
50
60
|
|
51
|
-
*
|
61
|
+
*Chris Kruger*
|
52
62
|
|
63
|
+
* Catch invalid UTF-8 parameters for POST requests and respond with BadRequest.
|
53
64
|
|
54
|
-
|
65
|
+
Additionally, perform `#set_binary_encoding` in `ActionDispatch::Http::Request#GET` and
|
66
|
+
`ActionDispatch::Http::Request#POST` prior to validating encoding.
|
55
67
|
|
56
|
-
*
|
57
|
-
rather than `ActionDispatch::IntegrationTest`. This permits running jobs in
|
58
|
-
system tests.
|
68
|
+
*Adrianna Chang*
|
59
69
|
|
60
|
-
|
70
|
+
* Allow `assert_recognizes` routing assertions to work on mounted root routes.
|
61
71
|
|
62
|
-
*
|
72
|
+
*Gannon McGibbon*
|
63
73
|
|
64
|
-
|
65
|
-
Mime::Type.register "text/html; fragment", :html_fragment
|
66
|
-
```
|
74
|
+
* Change default redirection status code for non-GET/HEAD requests to 308 Permanent Redirect for `ActionDispatch::SSL`.
|
67
75
|
|
68
|
-
*
|
76
|
+
*Alan Tan*, *Oz Ben-David*
|
69
77
|
|
78
|
+
* Fix `follow_redirect!` to follow redirection with same HTTP verb when following
|
79
|
+
a 308 redirection.
|
70
80
|
|
71
|
-
|
81
|
+
*Alan Tan*
|
72
82
|
|
73
|
-
*
|
83
|
+
* When multiple domains are specified for a cookie, a domain will now be
|
84
|
+
chosen only if it is equal to or is a superdomain of the request host.
|
74
85
|
|
86
|
+
*Jonathan Hefner*
|
75
87
|
|
76
|
-
|
88
|
+
* `ActionDispatch::Static` handles precompiled Brotli (.br) files.
|
77
89
|
|
78
|
-
|
90
|
+
Adds to existing support for precompiled gzip (.gz) files.
|
91
|
+
Brotli files are preferred due to much better compression.
|
79
92
|
|
80
|
-
|
93
|
+
When the browser requests /some.js with `Accept-Encoding: br`,
|
94
|
+
we check for public/some.js.br and serve that file, if present, with
|
95
|
+
`Content-Encoding: br` and `Vary: Accept-Encoding` headers.
|
81
96
|
|
82
|
-
*
|
97
|
+
*Ryan Edward Hall*, *Jeremy Daer*
|
83
98
|
|
84
|
-
*
|
99
|
+
* Add raise_on_missing_translations support for controllers.
|
85
100
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
doesn't.
|
101
|
+
This configuration determines whether an error should be raised for missing translations.
|
102
|
+
It can be enabled through `config.i18n.raise_on_missing_translations`. Note that described
|
103
|
+
configuration also affects raising error for missing translations in views.
|
90
104
|
|
91
|
-
|
105
|
+
*fatkodima*
|
92
106
|
|
93
|
-
|
107
|
+
* Added `compact` and `compact!` to `ActionController::Parameters`.
|
94
108
|
|
95
|
-
*
|
109
|
+
*Eugene Kenny*
|
96
110
|
|
97
|
-
|
98
|
-
|
99
|
-
containing charset part as it is.
|
111
|
+
* Calling `each_pair` or `each_value` on an `ActionController::Parameters`
|
112
|
+
without passing a block now returns an enumerator.
|
100
113
|
|
101
|
-
|
102
|
-
instead.
|
114
|
+
*Eugene Kenny*
|
103
115
|
|
104
|
-
|
105
|
-
If not enabled, `ActionDispatch::Response#content_type` returns the same
|
106
|
-
value as before version, but its behavior is deprecate.
|
116
|
+
* `fixture_file_upload` now uses path relative to `file_fixture_path`
|
107
117
|
|
108
|
-
|
118
|
+
Previously the path had to be relative to `fixture_path`.
|
119
|
+
You can change your existing code as follow:
|
109
120
|
|
110
|
-
|
111
|
-
|
121
|
+
```ruby
|
122
|
+
# Before
|
123
|
+
fixture_file_upload('files/dog.png')
|
112
124
|
|
113
|
-
|
125
|
+
# After
|
126
|
+
fixture_file_upload('dog.png')
|
127
|
+
```
|
114
128
|
|
115
|
-
*
|
129
|
+
*Edouard Chin*
|
116
130
|
|
117
|
-
|
131
|
+
* Remove deprecated `force_ssl` at the controller level.
|
118
132
|
|
133
|
+
*Rafael Mendonça França*
|
119
134
|
|
120
|
-
|
135
|
+
* The +helper+ class method for controllers loads helper modules specified as
|
136
|
+
strings/symbols with `String#constantize` instead of `require_dependency`.
|
121
137
|
|
122
|
-
|
123
|
-
|
138
|
+
Remember that support for strings/symbols is only a convenient API. You can
|
139
|
+
always pass a module object:
|
124
140
|
|
125
|
-
|
126
|
-
|
127
|
-
|
141
|
+
```ruby
|
142
|
+
helper UtilsHelper
|
143
|
+
```
|
128
144
|
|
129
|
-
|
145
|
+
which is recommended because it is simple and direct. When a string/symbol
|
146
|
+
is received, `helper` just manipulates and inflects the argument to obtain
|
147
|
+
that same module object.
|
130
148
|
|
131
|
-
*
|
149
|
+
*Xavier Noria*, *Jean Boussier*
|
132
150
|
|
133
|
-
|
134
|
-
from `ActiveSupport::ActionableError` descendants.
|
151
|
+
* Correctly identify the entire localhost IPv4 range as trusted proxy.
|
135
152
|
|
136
|
-
|
153
|
+
*Nick Soracco*
|
137
154
|
|
138
|
-
|
155
|
+
* `url_for` will now use "https://" as the default protocol when
|
156
|
+
`Rails.application.config.force_ssl` is set to true.
|
139
157
|
|
140
|
-
*
|
158
|
+
*Jonathan Hefner*
|
141
159
|
|
142
|
-
|
160
|
+
* Accept and default to base64_urlsafe CSRF tokens.
|
143
161
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
```
|
162
|
+
Base64 strict-encoded CSRF tokens are not inherently websafe, which makes
|
163
|
+
them difficult to deal with. For example, the common practice of sending
|
164
|
+
the CSRF token to a browser in a client-readable cookie does not work properly
|
165
|
+
out of the box: the value has to be url-encoded and decoded to survive transport.
|
149
166
|
|
150
|
-
|
167
|
+
Now, we generate Base64 urlsafe-encoded CSRF tokens, which are inherently safe
|
168
|
+
to transport. Validation accepts both urlsafe tokens, and strict-encoded tokens
|
169
|
+
for backwards compatibility.
|
151
170
|
|
152
|
-
*
|
171
|
+
*Scott Blum*
|
153
172
|
|
173
|
+
* Support rolling deploys for cookie serialization/encryption changes.
|
154
174
|
|
155
|
-
|
175
|
+
In a distributed configuration like rolling update, users may observe
|
176
|
+
both old and new instances during deployment. Users may be served by a
|
177
|
+
new instance and then by an old instance.
|
156
178
|
|
157
|
-
|
179
|
+
That means when the server changes `cookies_serializer` from `:marshal`
|
180
|
+
to `:hybrid` or the server changes `use_authenticated_cookie_encryption`
|
181
|
+
from `false` to `true`, users may lose their sessions if they access the
|
182
|
+
server during deployment.
|
158
183
|
|
184
|
+
We added fallbacks to downgrade the cookie format when necessary during
|
185
|
+
deployment, ensuring compatibility on both old and new instances.
|
159
186
|
|
160
|
-
|
187
|
+
*Masaki Hara*
|
161
188
|
|
162
|
-
*
|
189
|
+
* `ActionDispatch::Request.remote_ip` has ip address even when all sites are trusted.
|
163
190
|
|
164
|
-
|
191
|
+
Before, if all `X-Forwarded-For` sites were trusted, the `remote_ip` would default to `127.0.0.1`.
|
192
|
+
Now, the furthest proxy site is used. e.g.: It now gives an ip address when using curl from the load balancer.
|
165
193
|
|
166
|
-
*
|
167
|
-
to define specific browser capabilities.
|
194
|
+
*Keenan Brock*
|
168
195
|
|
169
|
-
|
196
|
+
* Fix possible information leak / session hijacking vulnerability.
|
170
197
|
|
198
|
+
The `ActionDispatch::Session::MemcacheStore` is still vulnerable given it requires the
|
199
|
+
gem dalli to be updated as well.
|
171
200
|
|
172
|
-
|
201
|
+
CVE-2019-16782.
|
173
202
|
|
174
|
-
*
|
203
|
+
* Include child session assertion count in ActionDispatch::IntegrationTest.
|
175
204
|
|
176
|
-
|
205
|
+
`IntegrationTest#open_session` uses `dup` to create the new session, which
|
206
|
+
meant it had its own copy of `@assertions`. This prevented the assertions
|
207
|
+
from being correctly counted and reported.
|
177
208
|
|
178
|
-
|
209
|
+
Child sessions now have their `attr_accessor` overridden to delegate to the
|
210
|
+
root session.
|
179
211
|
|
180
|
-
|
181
|
-
`#successful?`, `not_found?` and `server_error?`.
|
212
|
+
Fixes #32142.
|
182
213
|
|
183
|
-
*
|
214
|
+
*Sam Bostock*
|
184
215
|
|
185
|
-
*
|
216
|
+
* Add SameSite protection to every written cookie.
|
186
217
|
|
187
|
-
|
188
|
-
|
218
|
+
Enabling `SameSite` cookie protection is an addition to CSRF protection,
|
219
|
+
where cookies won't be sent by browsers in cross-site POST requests when set to `:lax`.
|
189
220
|
|
190
|
-
|
191
|
-
`Proc`, `IPAddr` and custom objects as host allowances.
|
221
|
+
`:strict` disables cookies being sent in cross-site GET or POST requests.
|
192
222
|
|
193
|
-
|
223
|
+
Passing `:none` disables this protection and is the same as previous versions albeit a `; SameSite=None` is appended to the cookie.
|
194
224
|
|
195
|
-
|
225
|
+
See upgrade instructions in config/initializers/new_framework_defaults_6_1.rb.
|
196
226
|
|
197
|
-
|
198
|
-
`parsed_body` in `ActionController::TestCase`:
|
227
|
+
More info [here](https://tools.ietf.org/html/draft-west-first-party-cookies-07)
|
199
228
|
|
200
|
-
|
201
|
-
class SomeControllerTest < ActionController::TestCase
|
202
|
-
def test_some_action
|
203
|
-
post :action, body: { foo: 'bar' }
|
204
|
-
assert_equal({ "foo" => "bar" }, response.parsed_body)
|
205
|
-
end
|
206
|
-
end
|
207
|
-
```
|
229
|
+
_NB: Technically already possible as Rack supports SameSite protection, this is to ensure it's applied to all cookies_
|
208
230
|
|
209
|
-
|
231
|
+
*Cédric Fabianski*
|
210
232
|
|
211
|
-
|
233
|
+
* Bring back the feature that allows loading external route files from the router.
|
212
234
|
|
213
|
-
|
235
|
+
This feature existed back in 2012 but got reverted with the incentive that
|
236
|
+
https://github.com/rails/routing_concerns was a better approach. Turned out
|
237
|
+
that this wasn't fully the case and loading external route files from the router
|
238
|
+
can be helpful for applications with a really large set of routes.
|
239
|
+
Without this feature, application needs to implement routes reloading
|
240
|
+
themselves and it's not straightforward.
|
214
241
|
|
215
|
-
|
216
|
-
|
242
|
+
```ruby
|
243
|
+
# config/routes.rb
|
217
244
|
|
218
|
-
|
245
|
+
Rails.application.routes.draw do
|
246
|
+
draw(:admin)
|
247
|
+
end
|
219
248
|
|
220
|
-
|
249
|
+
# config/routes/admin.rb
|
221
250
|
|
222
|
-
|
223
|
-
rescue_from ActionDispatch::Http::Parameters::ParseError do
|
224
|
-
head :unauthorized
|
225
|
-
end
|
251
|
+
get :foo, to: 'foo#bar'
|
226
252
|
```
|
227
253
|
|
228
|
-
*
|
254
|
+
*Yehuda Katz*, *Edouard Chin*
|
229
255
|
|
230
|
-
*
|
256
|
+
* Fix system test driver option initialization for non-headless browsers.
|
231
257
|
|
232
|
-
|
233
|
-
in system test `after_teardown`.
|
258
|
+
*glaszig*
|
234
259
|
|
235
|
-
|
260
|
+
* `redirect_to.action_controller` notifications now include the `ActionDispatch::Request` in
|
261
|
+
their payloads as `:request`.
|
236
262
|
|
237
|
-
*
|
263
|
+
*Austin Story*
|
238
264
|
|
239
|
-
|
240
|
-
|
241
|
-
when resolving dynamic CSP sources in this scenario.
|
265
|
+
* `respond_to#any` no longer returns a response's Content-Type based on the
|
266
|
+
request format but based on the block given.
|
242
267
|
|
243
|
-
|
268
|
+
Example:
|
244
269
|
|
245
|
-
|
270
|
+
```ruby
|
271
|
+
def my_action
|
272
|
+
respond_to do |format|
|
273
|
+
format.any { render(json: { foo: 'bar' }) }
|
274
|
+
end
|
275
|
+
end
|
246
276
|
|
247
|
-
|
277
|
+
get('my_action.csv')
|
278
|
+
```
|
279
|
+
|
280
|
+
The previous behaviour was to respond with a `text/csv` Content-Type which
|
281
|
+
is inaccurate since a JSON response is being rendered.
|
248
282
|
|
249
|
-
|
250
|
-
would be converted to a string implicitly, e.g:
|
283
|
+
Now it correctly returns a `application/json` Content-Type.
|
251
284
|
|
252
|
-
|
285
|
+
*Edouard Chin*
|
253
286
|
|
254
|
-
|
287
|
+
* Replaces (back)slashes in failure screenshot image paths with dashes.
|
255
288
|
|
256
|
-
|
289
|
+
If a failed test case contained a slash or a backslash, a screenshot would be created in a
|
290
|
+
nested directory, causing issues with `tmp:clear`.
|
257
291
|
|
258
|
-
|
292
|
+
*Damir Zekic*
|
259
293
|
|
260
|
-
|
294
|
+
* Add `params.member?` to mimic Hash behavior.
|
261
295
|
|
262
|
-
*
|
296
|
+
*Younes Serraj*
|
263
297
|
|
264
|
-
*
|
298
|
+
* `process_action.action_controller` notifications now include the following in their payloads:
|
265
299
|
|
266
|
-
*
|
300
|
+
* `:request` - the `ActionDispatch::Request`
|
301
|
+
* `:response` - the `ActionDispatch::Response`
|
267
302
|
|
268
|
-
*
|
303
|
+
*George Claghorn*
|
269
304
|
|
270
|
-
|
305
|
+
* Updated `ActionDispatch::Request.remote_ip` setter to clear set the instance
|
306
|
+
`remote_ip` to `nil` before setting the header that the value is derived
|
307
|
+
from.
|
271
308
|
|
272
|
-
|
273
|
-
Previously, `send_data 'data', filename: "\u{3042}.txt"` sends
|
274
|
-
`"filename=\"\u{3042}.txt\""` as Content-Disposition and it can be
|
275
|
-
garbled.
|
276
|
-
Now it follows [RFC 2231](https://tools.ietf.org/html/rfc2231) and
|
277
|
-
[RFC 5987](https://tools.ietf.org/html/rfc5987) and sends
|
278
|
-
`"filename=\"%3F.txt\"; filename*=UTF-8''%E3%81%82.txt"`.
|
279
|
-
Most browsers can find filename correctly and old browsers fallback to ASCII
|
280
|
-
converted name.
|
309
|
+
Fixes #37383.
|
281
310
|
|
282
|
-
*
|
311
|
+
*Norm Provost*
|
283
312
|
|
284
|
-
*
|
285
|
-
|
313
|
+
* `ActionController::Base.log_at` allows setting a different log level per request.
|
314
|
+
|
315
|
+
```ruby
|
316
|
+
# Use the debug level if a particular cookie is set.
|
317
|
+
class ApplicationController < ActionController::Base
|
318
|
+
log_at :debug, if: -> { cookies[:debug] }
|
319
|
+
end
|
320
|
+
```
|
286
321
|
|
287
|
-
*
|
322
|
+
*George Claghorn*
|
288
323
|
|
289
|
-
*
|
324
|
+
* Allow system test screen shots to be taken more than once in
|
325
|
+
a test by prefixing the file name with an incrementing counter.
|
290
326
|
|
291
|
-
|
292
|
-
|
327
|
+
Add an environment variable `RAILS_SYSTEM_TESTING_SCREENSHOT_HTML` to
|
328
|
+
enable saving of HTML during a screenshot in addition to the image.
|
329
|
+
This uses the same image name, with the extension replaced with `.html`
|
293
330
|
|
294
|
-
|
295
|
-
then signed/encrypted along with the cookie value. Then, on a server-side
|
296
|
-
read, we verify the cookie-names and discard any attacked cookies.
|
331
|
+
*Tom Fakes*
|
297
332
|
|
298
|
-
|
299
|
-
writes cookies with the new purpose and expiry metadata embedded.
|
333
|
+
* Add `Vary: Accept` header when using `Accept` header for response.
|
300
334
|
|
301
|
-
|
335
|
+
For some requests like `/users/1`, Rails uses requests' `Accept`
|
336
|
+
header to determine what to return. And if we don't add `Vary`
|
337
|
+
in the response header, browsers might accidentally cache different
|
338
|
+
types of content, which would cause issues: e.g. javascript got displayed
|
339
|
+
instead of html content. This PR fixes these issues by adding `Vary: Accept`
|
340
|
+
in these types of requests. For more detailed problem description, please read:
|
302
341
|
|
303
|
-
|
342
|
+
https://github.com/rails/rails/pull/36213
|
304
343
|
|
305
|
-
|
306
|
-
multiple invocations are made and the types do not match:
|
344
|
+
Fixes #25842.
|
307
345
|
|
308
|
-
|
309
|
-
outer_type.js do
|
310
|
-
respond_to do |inner_type|
|
311
|
-
inner_type.html { render body: "HTML" }
|
312
|
-
end
|
313
|
-
end
|
314
|
-
end
|
346
|
+
*Stan Lo*
|
315
347
|
|
316
|
-
|
348
|
+
* Fix IntegrationTest `follow_redirect!` to follow redirection using the same HTTP verb when following
|
349
|
+
a 307 redirection.
|
317
350
|
|
318
|
-
*
|
351
|
+
*Edouard Chin*
|
319
352
|
|
320
|
-
|
321
|
-
without raising a `TypeError`:
|
353
|
+
* System tests require Capybara 3.26 or newer.
|
322
354
|
|
323
|
-
|
324
|
-
File.read(uploaded_file)
|
355
|
+
*George Claghorn*
|
325
356
|
|
326
|
-
|
357
|
+
* Reduced log noise handling ActionController::RoutingErrors.
|
327
358
|
|
328
|
-
*
|
359
|
+
*Alberto Fernández-Capel*
|
329
360
|
|
330
|
-
|
331
|
-
`get` method. This for example allows to set custom headers for the
|
332
|
-
redirection request to the server.
|
361
|
+
* Add DSL for configuring HTTP Feature Policy.
|
333
362
|
|
334
|
-
|
363
|
+
This new DSL provides a way to configure an HTTP Feature Policy at a
|
364
|
+
global or per-controller level. Full details of HTTP Feature Policy
|
365
|
+
specification and guidelines can be found at MDN:
|
335
366
|
|
336
|
-
|
367
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
|
337
368
|
|
338
|
-
|
369
|
+
Example global policy:
|
339
370
|
|
340
|
-
|
341
|
-
|
371
|
+
```ruby
|
372
|
+
Rails.application.config.feature_policy do |f|
|
373
|
+
f.camera :none
|
374
|
+
f.gyroscope :none
|
375
|
+
f.microphone :none
|
376
|
+
f.usb :none
|
377
|
+
f.fullscreen :self
|
378
|
+
f.payment :self, "https://secure.example.com"
|
379
|
+
end
|
380
|
+
```
|
342
381
|
|
343
|
-
|
382
|
+
Example controller level policy:
|
344
383
|
|
345
|
-
|
384
|
+
```ruby
|
385
|
+
class PagesController < ApplicationController
|
386
|
+
feature_policy do |p|
|
387
|
+
p.geolocation "https://example.com"
|
388
|
+
end
|
389
|
+
end
|
390
|
+
```
|
346
391
|
|
347
|
-
|
348
|
-
`.register_interceptor` method to get the processed exception, instead of
|
349
|
-
monkey patching DebugExceptions.
|
392
|
+
*Jacob Bednarz*
|
350
393
|
|
351
|
-
|
352
|
-
HypoteticalPlugin.capture_exception(request, exception)
|
353
|
-
end
|
394
|
+
* Add the ability to set the CSP nonce only to the specified directives.
|
354
395
|
|
355
|
-
|
396
|
+
Fixes #35137.
|
356
397
|
|
357
|
-
*
|
398
|
+
*Yuji Yaginuma*
|
358
399
|
|
359
|
-
|
400
|
+
* Keep part when scope option has value.
|
360
401
|
|
361
|
-
|
402
|
+
When a route was defined within an optional scope, if that route didn't
|
403
|
+
take parameters the scope was lost when using path helpers. This commit
|
404
|
+
ensures scope is kept both when the route takes parameters or when it
|
405
|
+
doesn't.
|
362
406
|
|
363
|
-
|
407
|
+
Fixes #33219.
|
364
408
|
|
365
|
-
*
|
409
|
+
*Alberto Almagro*
|
366
410
|
|
367
|
-
*
|
411
|
+
* Added `deep_transform_keys` and `deep_transform_keys!` methods to ActionController::Parameters.
|
368
412
|
|
369
|
-
*
|
413
|
+
*Gustavo Gutierrez*
|
370
414
|
|
371
|
-
*
|
372
|
-
|
415
|
+
* Calling `ActionController::Parameters#transform_keys`/`!` without a block now returns
|
416
|
+
an enumerator for the parameters instead of the underlying hash.
|
373
417
|
|
374
|
-
*
|
418
|
+
*Eugene Kenny*
|
375
419
|
|
376
|
-
*
|
420
|
+
* Fix strong parameters blocks all attributes even when only some keys are invalid (non-numerical).
|
421
|
+
It should only block invalid key's values instead.
|
377
422
|
|
378
|
-
*
|
423
|
+
*Stan Lo*
|
379
424
|
|
380
425
|
|
381
|
-
Please check [
|
426
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionpack/CHANGELOG.md) for previous changes.
|