actionpack 5.2.0 → 6.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +408 -190
- data/MIT-LICENSE +1 -1
- data/README.rdoc +4 -3
- data/lib/abstract_controller/base.rb +38 -4
- data/lib/abstract_controller/caching/fragments.rb +6 -22
- data/lib/abstract_controller/caching.rb +1 -1
- data/lib/abstract_controller/callbacks.rb +14 -2
- data/lib/abstract_controller/collector.rb +1 -2
- data/lib/abstract_controller/helpers.rb +106 -90
- data/lib/abstract_controller/railties/routes_helpers.rb +17 -1
- data/lib/abstract_controller/rendering.rb +9 -9
- data/lib/abstract_controller/translation.rb +11 -5
- data/lib/abstract_controller.rb +2 -0
- data/lib/action_controller/api.rb +4 -3
- data/lib/action_controller/base.rb +6 -9
- data/lib/action_controller/caching.rb +1 -3
- data/lib/action_controller/log_subscriber.rb +10 -7
- data/lib/action_controller/metal/basic_implicit_render.rb +1 -1
- data/lib/action_controller/metal/conditional_get.rb +19 -5
- data/lib/action_controller/metal/content_security_policy.rb +1 -2
- data/lib/action_controller/metal/cookies.rb +3 -1
- data/lib/action_controller/metal/data_streaming.rb +6 -7
- data/lib/action_controller/metal/default_headers.rb +17 -0
- data/lib/action_controller/metal/etag_with_template_digest.rb +4 -6
- data/lib/action_controller/metal/exceptions.rb +56 -2
- data/lib/action_controller/metal/flash.rb +5 -5
- data/lib/action_controller/metal/head.rb +7 -4
- data/lib/action_controller/metal/helpers.rb +14 -5
- data/lib/action_controller/metal/http_authentication.rb +25 -24
- data/lib/action_controller/metal/implicit_render.rb +5 -15
- data/lib/action_controller/metal/instrumentation.rb +13 -14
- data/lib/action_controller/metal/live.rb +39 -32
- data/lib/action_controller/metal/logging.rb +20 -0
- data/lib/action_controller/metal/mime_responds.rb +19 -4
- data/lib/action_controller/metal/parameter_encoding.rb +35 -4
- data/lib/action_controller/metal/params_wrapper.rb +33 -23
- data/lib/action_controller/metal/permissions_policy.rb +46 -0
- data/lib/action_controller/metal/redirecting.rb +7 -7
- data/lib/action_controller/metal/renderers.rb +4 -4
- data/lib/action_controller/metal/rendering.rb +8 -3
- data/lib/action_controller/metal/request_forgery_protection.rb +89 -36
- data/lib/action_controller/metal/rescue.rb +1 -1
- data/lib/action_controller/metal/streaming.rb +0 -1
- data/lib/action_controller/metal/strong_parameters.rb +181 -69
- data/lib/action_controller/metal/url_for.rb +1 -1
- data/lib/action_controller/metal.rb +12 -10
- data/lib/action_controller/railties/helpers.rb +1 -1
- data/lib/action_controller/renderer.rb +37 -13
- data/lib/action_controller/template_assertions.rb +1 -1
- data/lib/action_controller/test_case.rb +81 -70
- data/lib/action_controller.rb +7 -4
- data/lib/action_dispatch/http/cache.rb +34 -28
- data/lib/action_dispatch/http/content_disposition.rb +45 -0
- data/lib/action_dispatch/http/content_security_policy.rb +47 -24
- data/lib/action_dispatch/http/filter_parameters.rb +9 -8
- data/lib/action_dispatch/http/filter_redirect.rb +2 -3
- data/lib/action_dispatch/http/headers.rb +4 -4
- data/lib/action_dispatch/http/mime_negotiation.rb +31 -13
- data/lib/action_dispatch/http/mime_type.rb +43 -24
- data/lib/action_dispatch/http/parameters.rb +14 -23
- data/lib/action_dispatch/http/permissions_policy.rb +173 -0
- data/lib/action_dispatch/http/request.rb +45 -22
- data/lib/action_dispatch/http/response.rb +45 -25
- data/lib/action_dispatch/http/upload.rb +9 -1
- data/lib/action_dispatch/http/url.rb +82 -82
- data/lib/action_dispatch/journey/formatter.rb +55 -31
- data/lib/action_dispatch/journey/gtg/builder.rb +22 -37
- data/lib/action_dispatch/journey/gtg/simulator.rb +8 -7
- data/lib/action_dispatch/journey/gtg/transition_table.rb +6 -5
- data/lib/action_dispatch/journey/nfa/dot.rb +0 -11
- data/lib/action_dispatch/journey/nodes/node.rb +13 -11
- 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 +21 -22
- data/lib/action_dispatch/journey/route.rb +10 -20
- data/lib/action_dispatch/journey/router/utils.rb +14 -12
- data/lib/action_dispatch/journey/router.rb +26 -34
- data/lib/action_dispatch/journey/routes.rb +1 -2
- data/lib/action_dispatch/journey/scanner.rb +10 -4
- data/lib/action_dispatch/journey/visitors.rb +1 -4
- data/lib/action_dispatch/journey.rb +0 -2
- data/lib/action_dispatch/middleware/actionable_exceptions.rb +46 -0
- data/lib/action_dispatch/middleware/callbacks.rb +2 -4
- data/lib/action_dispatch/middleware/cookies.rb +128 -109
- data/lib/action_dispatch/middleware/debug_exceptions.rb +43 -66
- data/lib/action_dispatch/middleware/debug_locks.rb +5 -5
- data/lib/action_dispatch/middleware/debug_view.rb +66 -0
- data/lib/action_dispatch/middleware/exception_wrapper.rb +75 -30
- data/lib/action_dispatch/middleware/flash.rb +2 -2
- data/lib/action_dispatch/middleware/host_authorization.rb +130 -0
- data/lib/action_dispatch/middleware/public_exceptions.rb +6 -3
- data/lib/action_dispatch/middleware/remote_ip.rb +14 -16
- data/lib/action_dispatch/middleware/request_id.rb +5 -6
- data/lib/action_dispatch/middleware/session/abstract_store.rb +15 -2
- data/lib/action_dispatch/middleware/session/cache_store.rb +11 -6
- data/lib/action_dispatch/middleware/session/cookie_store.rb +24 -19
- data/lib/action_dispatch/middleware/show_exceptions.rb +3 -2
- data/lib/action_dispatch/middleware/ssl.rb +20 -15
- data/lib/action_dispatch/middleware/stack.rb +57 -3
- data/lib/action_dispatch/middleware/static.rb +153 -93
- data/lib/action_dispatch/middleware/templates/rescues/_actions.html.erb +13 -0
- data/lib/action_dispatch/middleware/templates/rescues/_actions.text.erb +0 -0
- data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +22 -0
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +3 -1
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +4 -2
- data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +45 -35
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +7 -0
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +5 -0
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +23 -4
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +6 -3
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +4 -1
- data/lib/action_dispatch/middleware/templates/rescues/layout.erb +104 -8
- data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +19 -0
- data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.text.erb +3 -0
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +2 -2
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +2 -2
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +1 -1
- data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +24 -1
- data/lib/action_dispatch/railtie.rb +8 -2
- data/lib/action_dispatch/request/session.rb +17 -10
- data/lib/action_dispatch/request/utils.rb +28 -2
- data/lib/action_dispatch/routing/inspector.rb +101 -53
- data/lib/action_dispatch/routing/mapper.rb +156 -103
- data/lib/action_dispatch/routing/polymorphic_routes.rb +21 -19
- data/lib/action_dispatch/routing/redirection.rb +4 -4
- data/lib/action_dispatch/routing/route_set.rb +71 -69
- data/lib/action_dispatch/routing/url_for.rb +3 -3
- data/lib/action_dispatch/routing.rb +21 -20
- data/lib/action_dispatch/system_test_case.rb +54 -11
- data/lib/action_dispatch/system_testing/browser.rb +53 -16
- data/lib/action_dispatch/system_testing/driver.rb +11 -3
- data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +49 -7
- data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +8 -6
- data/lib/action_dispatch/testing/assertion_response.rb +0 -1
- data/lib/action_dispatch/testing/assertions/response.rb +4 -7
- data/lib/action_dispatch/testing/assertions/routing.rb +20 -8
- data/lib/action_dispatch/testing/assertions.rb +1 -1
- data/lib/action_dispatch/testing/integration.rb +61 -28
- data/lib/action_dispatch/testing/request_encoder.rb +3 -3
- data/lib/action_dispatch/testing/test_process.rb +29 -4
- data/lib/action_dispatch/testing/test_request.rb +3 -3
- data/lib/action_dispatch/testing/test_response.rb +4 -32
- data/lib/action_dispatch.rb +14 -7
- data/lib/action_pack/gem_version.rb +3 -3
- data/lib/action_pack.rb +1 -1
- metadata +39 -22
- data/lib/action_controller/metal/force_ssl.rb +0 -99
- data/lib/action_dispatch/http/parameter_filter.rb +0 -86
- data/lib/action_dispatch/journey/nfa/builder.rb +0 -78
- data/lib/action_dispatch/journey/nfa/simulator.rb +0 -49
- data/lib/action_dispatch/journey/nfa/transition_table.rb +0 -120
- data/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb +0 -26
data/CHANGELOG.md
CHANGED
|
@@ -1,302 +1,520 @@
|
|
|
1
|
-
## Rails
|
|
1
|
+
## Rails 6.1.4 (June 24, 2021) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Ignore file fixtures on `db:fixtures:load`
|
|
4
4
|
|
|
5
|
-
*
|
|
5
|
+
*Kevin Sjöberg*
|
|
6
6
|
|
|
7
|
-
*
|
|
7
|
+
* Fix ActionController::Live controller test deadlocks by removing the body buffer size limit for tests.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
for a controller and/or specific actions.
|
|
9
|
+
*Dylan Thacker-Smith*
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
* Correctly place optional path parameter booleans.
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
Previously, if you specify a url parameter that is part of the path as false it would include that part
|
|
14
|
+
of the path as parameter for example:
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
```
|
|
17
|
+
get "(/optional/:optional_id)/things" => "foo#foo", as: :things
|
|
18
|
+
things_path(optional_id: false) # => /things?optional_id=false
|
|
19
|
+
```
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
After this change, true and false will be treated the same when used as optional path parameters. Meaning now:
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
```
|
|
24
|
+
get '(this/:my_bool)/that' as: :that
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
that_path(my_bool: true) # => `/this/true/that`
|
|
27
|
+
that_path(my_bool: false) # => `/this/false/that`
|
|
28
|
+
```
|
|
26
29
|
|
|
27
|
-
*
|
|
28
|
-
to meet the minimum max-age requirement for https://hstspreload.org/.
|
|
30
|
+
*Adam Hess*
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
* Add support for 'private, no-store' Cache-Control headers.
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Previously, 'no-store' was exclusive; no other directives could be specified.
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
normally requires the script-src attribute of the content security
|
|
36
|
-
policy to include 'unsafe-inline'.
|
|
36
|
+
*Alex Smith*
|
|
37
37
|
|
|
38
|
-
To work around this we generate a per-request nonce value that is
|
|
39
|
-
embedded in a meta tag in a similar fashion to how CSRF protection
|
|
40
|
-
embeds its token in a meta tag. The UJS library can then read the
|
|
41
|
-
nonce value and set it on the dynamically generated script tag to
|
|
42
|
-
enable it to execute without needing 'unsafe-inline' enabled.
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
user generated content in someway then it may be possible to exploit
|
|
46
|
-
an XSS vulnerability which can take advantage of the nonce. It is
|
|
47
|
-
however an improvement on a blanket permission for inline scripts.
|
|
39
|
+
## Rails 6.1.3.2 (May 05, 2021) ##
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
* Prevent open redirects by correctly escaping the host allow list
|
|
42
|
+
CVE-2021-22903
|
|
51
43
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<% end %>
|
|
44
|
+
* Prevent catastrophic backtracking during mime parsing
|
|
45
|
+
CVE-2021-22902
|
|
55
46
|
|
|
56
|
-
|
|
47
|
+
* Prevent regex DoS in HTTP token authentication
|
|
48
|
+
CVE-2021-22904
|
|
57
49
|
|
|
58
|
-
|
|
50
|
+
* Prevent string polymorphic route arguments.
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
`url_for` supports building polymorphic URLs via an array
|
|
53
|
+
of arguments (usually symbols and records). If a developer passes a
|
|
54
|
+
user input array, strings can result in unwanted route helper calls.
|
|
61
55
|
|
|
62
|
-
|
|
56
|
+
CVE-2021-22885
|
|
63
57
|
|
|
64
|
-
*
|
|
58
|
+
*Gannon McGibbon*
|
|
65
59
|
|
|
66
|
-
|
|
60
|
+
## Rails 6.1.3.1 (March 26, 2021) ##
|
|
67
61
|
|
|
68
|
-
*
|
|
69
|
-
user haven't specified manually another server.
|
|
62
|
+
* No changes.
|
|
70
63
|
|
|
71
|
-
*Guillermo Iguaran*
|
|
72
64
|
|
|
73
|
-
|
|
74
|
-
default headers set.
|
|
65
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
|
75
66
|
|
|
76
|
-
|
|
67
|
+
* Re-define routes when not set correctly via inheritance.
|
|
77
68
|
|
|
78
|
-
*
|
|
69
|
+
*John Hawthorn*
|
|
79
70
|
|
|
80
|
-
*bogdanvlviv*
|
|
81
71
|
|
|
82
|
-
|
|
72
|
+
## Rails 6.1.2.1 (February 10, 2021) ##
|
|
83
73
|
|
|
84
|
-
|
|
85
|
-
Terminal.app ignore the `inline` and output the path to the file since it can't
|
|
86
|
-
render the image. Other terminals, like those on Ubuntu, cannot handle the image
|
|
87
|
-
inline, but also don't handle it gracefully and instead of outputting the file
|
|
88
|
-
path, it dumps binary into the terminal.
|
|
74
|
+
* Prevent open redirect when allowed host starts with a dot
|
|
89
75
|
|
|
90
|
-
|
|
76
|
+
[CVE-2021-22881]
|
|
91
77
|
|
|
92
|
-
|
|
78
|
+
Thanks to @tktech (https://hackerone.com/tktech) for reporting this
|
|
79
|
+
issue and the patch!
|
|
93
80
|
|
|
94
|
-
*
|
|
81
|
+
*Aaron Patterson*
|
|
95
82
|
|
|
96
|
-
*Guillermo Iguaran*
|
|
97
83
|
|
|
98
|
-
|
|
84
|
+
## Rails 6.1.2 (February 09, 2021) ##
|
|
99
85
|
|
|
100
|
-
|
|
86
|
+
* Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
|
|
101
87
|
|
|
102
|
-
*
|
|
88
|
+
*Janko Marohnić*
|
|
103
89
|
|
|
104
|
-
*
|
|
90
|
+
* Fix `fixture_file_upload` deprecation when `file_fixture_path` is a relative path.
|
|
105
91
|
|
|
106
|
-
|
|
107
|
-
header and then override within a controller. For more information
|
|
108
|
-
about the Content-Security-Policy header see MDN:
|
|
92
|
+
*Eugene Kenny*
|
|
109
93
|
|
|
110
|
-
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
|
111
94
|
|
|
112
|
-
|
|
95
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
|
113
96
|
|
|
114
|
-
|
|
115
|
-
Rails.application.config.content_security_policy do |p|
|
|
116
|
-
p.default_src :self, :https
|
|
117
|
-
p.font_src :self, :https, :data
|
|
118
|
-
p.img_src :self, :https, :data
|
|
119
|
-
p.object_src :none
|
|
120
|
-
p.script_src :self, :https
|
|
121
|
-
p.style_src :self, :https, :unsafe_inline
|
|
122
|
-
end
|
|
97
|
+
* Fix nil translation key lookup in controllers/
|
|
123
98
|
|
|
124
|
-
|
|
99
|
+
*Jan Klimo*
|
|
125
100
|
|
|
126
|
-
|
|
127
|
-
class PostsController < ApplicationController
|
|
128
|
-
content_security_policy do |p|
|
|
129
|
-
p.upgrade_insecure_requests true
|
|
130
|
-
end
|
|
131
|
-
end
|
|
101
|
+
* Quietly handle unknown HTTP methods in Action Dispatch SSL middleware.
|
|
132
102
|
|
|
133
|
-
|
|
134
|
-
class PostsController < ApplicationController
|
|
135
|
-
content_security_policy do |p|
|
|
136
|
-
p.base_uri "https://www.example.com"
|
|
137
|
-
end
|
|
138
|
-
end
|
|
103
|
+
*Alex Robbin*
|
|
139
104
|
|
|
140
|
-
|
|
141
|
-
class PostsController < ApplicationController
|
|
142
|
-
content_security_policy do |p|
|
|
143
|
-
p.base_uri :self, -> { "https://#{current_user.domain}.example.com" }
|
|
144
|
-
end
|
|
145
|
-
end
|
|
105
|
+
* Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
|
|
146
106
|
|
|
147
|
-
|
|
148
|
-
legacy content using the `content_security_policy_report_only`
|
|
149
|
-
configuration attribute, e.g;
|
|
107
|
+
*Alex Robbin*
|
|
150
108
|
|
|
151
|
-
# config/initializers/content_security_policy.rb
|
|
152
|
-
Rails.application.config.content_security_policy_report_only = true
|
|
153
109
|
|
|
154
|
-
|
|
155
|
-
class PostsController < ApplicationController
|
|
156
|
-
content_security_policy_report_only only: :index
|
|
157
|
-
end
|
|
110
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
|
158
111
|
|
|
159
|
-
|
|
160
|
-
|
|
112
|
+
* Support for the HTTP header `Feature-Policy` has been revised to reflect
|
|
113
|
+
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).
|
|
161
114
|
|
|
162
|
-
|
|
115
|
+
```ruby
|
|
116
|
+
Rails.application.config.permissions_policy do |p|
|
|
117
|
+
p.camera :none
|
|
118
|
+
p.gyroscope :none
|
|
119
|
+
p.microphone :none
|
|
120
|
+
p.usb :none
|
|
121
|
+
p.fullscreen :self
|
|
122
|
+
p.payment :self, "https://secure-example.com"
|
|
123
|
+
end
|
|
124
|
+
```
|
|
163
125
|
|
|
164
|
-
*
|
|
126
|
+
*Julien Grillot*
|
|
165
127
|
|
|
166
|
-
|
|
128
|
+
* Allow `ActionDispatch::HostAuthorization` to exclude specific requests.
|
|
167
129
|
|
|
168
|
-
|
|
130
|
+
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.
|
|
131
|
+
|
|
132
|
+
*Chris Bisnett*
|
|
133
|
+
|
|
134
|
+
* Add `config.action_dispatch.request_id_header` to allow changing the name of
|
|
135
|
+
the unique X-Request-Id header
|
|
136
|
+
|
|
137
|
+
*Arlston Fernandes*
|
|
138
|
+
|
|
139
|
+
* Deprecate `config.action_dispatch.return_only_media_type_on_content_type`.
|
|
169
140
|
|
|
170
141
|
*Rafael Mendonça França*
|
|
171
142
|
|
|
172
|
-
*
|
|
143
|
+
* Change `ActionDispatch::Response#content_type` to return the full Content-Type header.
|
|
173
144
|
|
|
174
|
-
|
|
175
|
-
different host. `allow_other_host` is `true` by default.
|
|
145
|
+
*Rafael Mendonça França*
|
|
176
146
|
|
|
177
|
-
|
|
147
|
+
* Remove deprecated `ActionDispatch::Http::ParameterFilter`.
|
|
178
148
|
|
|
179
|
-
*
|
|
149
|
+
*Rafael Mendonça França*
|
|
180
150
|
|
|
181
|
-
|
|
151
|
+
* Added support for exclusive no-store Cache-Control header.
|
|
182
152
|
|
|
183
|
-
|
|
153
|
+
If `no-store` is set on Cache-Control header it is exclusive (all other cache directives are dropped).
|
|
184
154
|
|
|
185
|
-
|
|
155
|
+
*Chris Kruger*
|
|
186
156
|
|
|
187
|
-
|
|
157
|
+
* Catch invalid UTF-8 parameters for POST requests and respond with BadRequest.
|
|
188
158
|
|
|
189
|
-
|
|
159
|
+
Additionally, perform `#set_binary_encoding` in `ActionDispatch::Http::Request#GET` and
|
|
160
|
+
`ActionDispatch::Http::Request#POST` prior to validating encoding.
|
|
190
161
|
|
|
191
|
-
*
|
|
162
|
+
*Adrianna Chang*
|
|
192
163
|
|
|
193
|
-
|
|
194
|
-
`MessageVerifier` to add key rotation support for encrypted and
|
|
195
|
-
signed cookies. This also helps simplify support for legacy cookie
|
|
196
|
-
security.
|
|
164
|
+
* Allow `assert_recognizes` routing assertions to work on mounted root routes.
|
|
197
165
|
|
|
198
|
-
*
|
|
166
|
+
*Gannon McGibbon*
|
|
199
167
|
|
|
200
|
-
*
|
|
168
|
+
* Change default redirection status code for non-GET/HEAD requests to 308 Permanent Redirect for `ActionDispatch::SSL`.
|
|
201
169
|
|
|
202
|
-
|
|
203
|
-
connection sharing and open request detection work correctly by default.
|
|
170
|
+
*Alan Tan*, *Oz Ben-David*
|
|
204
171
|
|
|
205
|
-
|
|
172
|
+
* Fix `follow_redirect!` to follow redirection with same HTTP verb when following
|
|
173
|
+
a 308 redirection.
|
|
206
174
|
|
|
207
|
-
*
|
|
175
|
+
*Alan Tan*
|
|
208
176
|
|
|
209
|
-
|
|
210
|
-
|
|
177
|
+
* When multiple domains are specified for a cookie, a domain will now be
|
|
178
|
+
chosen only if it is equal to or is a superdomain of the request host.
|
|
211
179
|
|
|
212
|
-
|
|
180
|
+
*Jonathan Hefner*
|
|
213
181
|
|
|
214
|
-
|
|
182
|
+
* `ActionDispatch::Static` handles precompiled Brotli (.br) files.
|
|
215
183
|
|
|
216
|
-
|
|
184
|
+
Adds to existing support for precompiled gzip (.gz) files.
|
|
185
|
+
Brotli files are preferred due to much better compression.
|
|
217
186
|
|
|
218
|
-
|
|
187
|
+
When the browser requests /some.js with `Accept-Encoding: br`,
|
|
188
|
+
we check for public/some.js.br and serve that file, if present, with
|
|
189
|
+
`Content-Encoding: br` and `Vary: Accept-Encoding` headers.
|
|
219
190
|
|
|
220
|
-
|
|
221
|
-
signing/encrypting to vouch that it hasn't been tampered with. Then on a
|
|
222
|
-
server-side read, the expiry is verified and any expired cookie is discarded.
|
|
191
|
+
*Ryan Edward Hall*, *Jeremy Daer*
|
|
223
192
|
|
|
224
|
-
|
|
193
|
+
* Add raise_on_missing_translations support for controllers.
|
|
225
194
|
|
|
226
|
-
|
|
195
|
+
This configuration determines whether an error should be raised for missing translations.
|
|
196
|
+
It can be enabled through `config.i18n.raise_on_missing_translations`. Note that described
|
|
197
|
+
configuration also affects raising error for missing translations in views.
|
|
227
198
|
|
|
228
|
-
*
|
|
199
|
+
*fatkodima*
|
|
229
200
|
|
|
230
|
-
|
|
201
|
+
* Added `compact` and `compact!` to `ActionController::Parameters`.
|
|
231
202
|
|
|
232
|
-
*
|
|
203
|
+
*Eugene Kenny*
|
|
204
|
+
|
|
205
|
+
* Calling `each_pair` or `each_value` on an `ActionController::Parameters`
|
|
206
|
+
without passing a block now returns an enumerator.
|
|
207
|
+
|
|
208
|
+
*Eugene Kenny*
|
|
209
|
+
|
|
210
|
+
* `fixture_file_upload` now uses path relative to `file_fixture_path`
|
|
211
|
+
|
|
212
|
+
Previously the path had to be relative to `fixture_path`.
|
|
213
|
+
You can change your existing code as follow:
|
|
214
|
+
|
|
215
|
+
```ruby
|
|
216
|
+
# Before
|
|
217
|
+
fixture_file_upload('files/dog.png')
|
|
218
|
+
|
|
219
|
+
# After
|
|
220
|
+
fixture_file_upload('dog.png')
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
*Edouard Chin*
|
|
224
|
+
|
|
225
|
+
* Remove deprecated `force_ssl` at the controller level.
|
|
226
|
+
|
|
227
|
+
*Rafael Mendonça França*
|
|
228
|
+
|
|
229
|
+
* The +helper+ class method for controllers loads helper modules specified as
|
|
230
|
+
strings/symbols with `String#constantize` instead of `require_dependency`.
|
|
231
|
+
|
|
232
|
+
Remember that support for strings/symbols is only a convenient API. You can
|
|
233
|
+
always pass a module object:
|
|
234
|
+
|
|
235
|
+
```ruby
|
|
236
|
+
helper UtilsHelper
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
which is recommended because it is simple and direct. When a string/symbol
|
|
240
|
+
is received, `helper` just manipulates and inflects the argument to obtain
|
|
241
|
+
that same module object.
|
|
242
|
+
|
|
243
|
+
*Xavier Noria*, *Jean Boussier*
|
|
244
|
+
|
|
245
|
+
* Correctly identify the entire localhost IPv4 range as trusted proxy.
|
|
246
|
+
|
|
247
|
+
*Nick Soracco*
|
|
248
|
+
|
|
249
|
+
* `url_for` will now use "https://" as the default protocol when
|
|
250
|
+
`Rails.application.config.force_ssl` is set to true.
|
|
251
|
+
|
|
252
|
+
*Jonathan Hefner*
|
|
253
|
+
|
|
254
|
+
* Accept and default to base64_urlsafe CSRF tokens.
|
|
255
|
+
|
|
256
|
+
Base64 strict-encoded CSRF tokens are not inherently websafe, which makes
|
|
257
|
+
them difficult to deal with. For example, the common practice of sending
|
|
258
|
+
the CSRF token to a browser in a client-readable cookie does not work properly
|
|
259
|
+
out of the box: the value has to be url-encoded and decoded to survive transport.
|
|
260
|
+
|
|
261
|
+
Now, we generate Base64 urlsafe-encoded CSRF tokens, which are inherently safe
|
|
262
|
+
to transport. Validation accepts both urlsafe tokens, and strict-encoded tokens
|
|
263
|
+
for backwards compatibility.
|
|
264
|
+
|
|
265
|
+
*Scott Blum*
|
|
266
|
+
|
|
267
|
+
* Support rolling deploys for cookie serialization/encryption changes.
|
|
268
|
+
|
|
269
|
+
In a distributed configuration like rolling update, users may observe
|
|
270
|
+
both old and new instances during deployment. Users may be served by a
|
|
271
|
+
new instance and then by an old instance.
|
|
272
|
+
|
|
273
|
+
That means when the server changes `cookies_serializer` from `:marshal`
|
|
274
|
+
to `:hybrid` or the server changes `use_authenticated_cookie_encryption`
|
|
275
|
+
from `false` to `true`, users may lose their sessions if they access the
|
|
276
|
+
server during deployment.
|
|
277
|
+
|
|
278
|
+
We added fallbacks to downgrade the cookie format when necessary during
|
|
279
|
+
deployment, ensuring compatibility on both old and new instances.
|
|
280
|
+
|
|
281
|
+
*Masaki Hara*
|
|
282
|
+
|
|
283
|
+
* `ActionDispatch::Request.remote_ip` has ip address even when all sites are trusted.
|
|
284
|
+
|
|
285
|
+
Before, if all `X-Forwarded-For` sites were trusted, the `remote_ip` would default to `127.0.0.1`.
|
|
286
|
+
Now, the furthest proxy site is used. e.g.: It now gives an ip address when using curl from the load balancer.
|
|
287
|
+
|
|
288
|
+
*Keenan Brock*
|
|
289
|
+
|
|
290
|
+
* Fix possible information leak / session hijacking vulnerability.
|
|
291
|
+
|
|
292
|
+
The `ActionDispatch::Session::MemcacheStore` is still vulnerable given it requires the
|
|
293
|
+
gem dalli to be updated as well.
|
|
294
|
+
|
|
295
|
+
CVE-2019-16782.
|
|
296
|
+
|
|
297
|
+
* Include child session assertion count in ActionDispatch::IntegrationTest.
|
|
298
|
+
|
|
299
|
+
`IntegrationTest#open_session` uses `dup` to create the new session, which
|
|
300
|
+
meant it had its own copy of `@assertions`. This prevented the assertions
|
|
301
|
+
from being correctly counted and reported.
|
|
302
|
+
|
|
303
|
+
Child sessions now have their `attr_accessor` overridden to delegate to the
|
|
304
|
+
root session.
|
|
305
|
+
|
|
306
|
+
Fixes #32142.
|
|
307
|
+
|
|
308
|
+
*Sam Bostock*
|
|
233
309
|
|
|
234
|
-
*
|
|
310
|
+
* Add SameSite protection to every written cookie.
|
|
235
311
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
use the response helpers provided by `Rack::Response`.
|
|
312
|
+
Enabling `SameSite` cookie protection is an addition to CSRF protection,
|
|
313
|
+
where cookies won't be sent by browsers in cross-site POST requests when set to `:lax`.
|
|
239
314
|
|
|
240
|
-
|
|
315
|
+
`:strict` disables cookies being sent in cross-site GET or POST requests.
|
|
241
316
|
|
|
242
|
-
|
|
317
|
+
Passing `:none` disables this protection and is the same as previous versions albeit a `; SameSite=None` is appended to the cookie.
|
|
243
318
|
|
|
244
|
-
|
|
245
|
-
add it to `ActionController::Base` depending on
|
|
246
|
-
`config.action_controller.default_protect_from_forgery`. This configuration
|
|
247
|
-
defaults to false to support older versions which have removed it from their
|
|
248
|
-
`ApplicationController`, but is set to true for Rails 5.2.
|
|
319
|
+
See upgrade instructions in config/initializers/new_framework_defaults_6_1.rb.
|
|
249
320
|
|
|
250
|
-
|
|
321
|
+
More info [here](https://tools.ietf.org/html/draft-west-first-party-cookies-07)
|
|
251
322
|
|
|
252
|
-
|
|
323
|
+
_NB: Technically already possible as Rack supports SameSite protection, this is to ensure it's applied to all cookies_
|
|
253
324
|
|
|
254
|
-
*
|
|
325
|
+
*Cédric Fabianski*
|
|
255
326
|
|
|
256
|
-
*
|
|
327
|
+
* Bring back the feature that allows loading external route files from the router.
|
|
257
328
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
the
|
|
329
|
+
This feature existed back in 2012 but got reverted with the incentive that
|
|
330
|
+
https://github.com/rails/routing_concerns was a better approach. Turned out
|
|
331
|
+
that this wasn't fully the case and loading external route files from the router
|
|
332
|
+
can be helpful for applications with a really large set of routes.
|
|
333
|
+
Without this feature, application needs to implement routes reloading
|
|
334
|
+
themselves and it's not straightforward.
|
|
261
335
|
|
|
262
|
-
|
|
336
|
+
```ruby
|
|
337
|
+
# config/routes.rb
|
|
263
338
|
|
|
264
|
-
|
|
339
|
+
Rails.application.routes.draw do
|
|
340
|
+
draw(:admin)
|
|
341
|
+
end
|
|
265
342
|
|
|
266
|
-
|
|
343
|
+
# config/routes/admin.rb
|
|
267
344
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
encrypted using AES in CBC HMAC mode will be seamlessly upgraded when
|
|
271
|
-
this new mode is enabled via the
|
|
272
|
-
`action_dispatch.use_authenticated_cookie_encryption` configuration value.
|
|
345
|
+
get :foo, to: 'foo#bar'
|
|
346
|
+
```
|
|
273
347
|
|
|
274
|
-
*
|
|
348
|
+
*Yehuda Katz*, *Edouard Chin*
|
|
349
|
+
|
|
350
|
+
* Fix system test driver option initialization for non-headless browsers.
|
|
351
|
+
|
|
352
|
+
*glaszig*
|
|
353
|
+
|
|
354
|
+
* `redirect_to.action_controller` notifications now include the `ActionDispatch::Request` in
|
|
355
|
+
their payloads as `:request`.
|
|
356
|
+
|
|
357
|
+
*Austin Story*
|
|
358
|
+
|
|
359
|
+
* `respond_to#any` no longer returns a response's Content-Type based on the
|
|
360
|
+
request format but based on the block given.
|
|
361
|
+
|
|
362
|
+
Example:
|
|
363
|
+
|
|
364
|
+
```ruby
|
|
365
|
+
def my_action
|
|
366
|
+
respond_to do |format|
|
|
367
|
+
format.any { render(json: { foo: 'bar' }) }
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
get('my_action.csv')
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
The previous behaviour was to respond with a `text/csv` Content-Type which
|
|
375
|
+
is inaccurate since a JSON response is being rendered.
|
|
376
|
+
|
|
377
|
+
Now it correctly returns a `application/json` Content-Type.
|
|
378
|
+
|
|
379
|
+
*Edouard Chin*
|
|
380
|
+
|
|
381
|
+
* Replaces (back)slashes in failure screenshot image paths with dashes.
|
|
382
|
+
|
|
383
|
+
If a failed test case contained a slash or a backslash, a screenshot would be created in a
|
|
384
|
+
nested directory, causing issues with `tmp:clear`.
|
|
385
|
+
|
|
386
|
+
*Damir Zekic*
|
|
387
|
+
|
|
388
|
+
* Add `params.member?` to mimic Hash behavior.
|
|
389
|
+
|
|
390
|
+
*Younes Serraj*
|
|
391
|
+
|
|
392
|
+
* `process_action.action_controller` notifications now include the following in their payloads:
|
|
393
|
+
|
|
394
|
+
* `:request` - the `ActionDispatch::Request`
|
|
395
|
+
* `:response` - the `ActionDispatch::Response`
|
|
396
|
+
|
|
397
|
+
*George Claghorn*
|
|
398
|
+
|
|
399
|
+
* Updated `ActionDispatch::Request.remote_ip` setter to clear set the instance
|
|
400
|
+
`remote_ip` to `nil` before setting the header that the value is derived
|
|
401
|
+
from.
|
|
402
|
+
|
|
403
|
+
Fixes #37383.
|
|
404
|
+
|
|
405
|
+
*Norm Provost*
|
|
406
|
+
|
|
407
|
+
* `ActionController::Base.log_at` allows setting a different log level per request.
|
|
408
|
+
|
|
409
|
+
```ruby
|
|
410
|
+
# Use the debug level if a particular cookie is set.
|
|
411
|
+
class ApplicationController < ActionController::Base
|
|
412
|
+
log_at :debug, if: -> { cookies[:debug] }
|
|
413
|
+
end
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
*George Claghorn*
|
|
417
|
+
|
|
418
|
+
* Allow system test screen shots to be taken more than once in
|
|
419
|
+
a test by prefixing the file name with an incrementing counter.
|
|
420
|
+
|
|
421
|
+
Add an environment variable `RAILS_SYSTEM_TESTING_SCREENSHOT_HTML` to
|
|
422
|
+
enable saving of HTML during a screenshot in addition to the image.
|
|
423
|
+
This uses the same image name, with the extension replaced with `.html`
|
|
424
|
+
|
|
425
|
+
*Tom Fakes*
|
|
426
|
+
|
|
427
|
+
* Add `Vary: Accept` header when using `Accept` header for response.
|
|
428
|
+
|
|
429
|
+
For some requests like `/users/1`, Rails uses requests' `Accept`
|
|
430
|
+
header to determine what to return. And if we don't add `Vary`
|
|
431
|
+
in the response header, browsers might accidentally cache different
|
|
432
|
+
types of content, which would cause issues: e.g. javascript got displayed
|
|
433
|
+
instead of html content. This PR fixes these issues by adding `Vary: Accept`
|
|
434
|
+
in these types of requests. For more detailed problem description, please read:
|
|
435
|
+
|
|
436
|
+
https://github.com/rails/rails/pull/36213
|
|
437
|
+
|
|
438
|
+
Fixes #25842.
|
|
439
|
+
|
|
440
|
+
*Stan Lo*
|
|
441
|
+
|
|
442
|
+
* Fix IntegrationTest `follow_redirect!` to follow redirection using the same HTTP verb when following
|
|
443
|
+
a 307 redirection.
|
|
444
|
+
|
|
445
|
+
*Edouard Chin*
|
|
446
|
+
|
|
447
|
+
* System tests require Capybara 3.26 or newer.
|
|
448
|
+
|
|
449
|
+
*George Claghorn*
|
|
450
|
+
|
|
451
|
+
* Reduced log noise handling ActionController::RoutingErrors.
|
|
452
|
+
|
|
453
|
+
*Alberto Fernández-Capel*
|
|
454
|
+
|
|
455
|
+
* Add DSL for configuring HTTP Feature Policy.
|
|
456
|
+
|
|
457
|
+
This new DSL provides a way to configure an HTTP Feature Policy at a
|
|
458
|
+
global or per-controller level. Full details of HTTP Feature Policy
|
|
459
|
+
specification and guidelines can be found at MDN:
|
|
460
|
+
|
|
461
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
|
|
462
|
+
|
|
463
|
+
Example global policy:
|
|
464
|
+
|
|
465
|
+
```ruby
|
|
466
|
+
Rails.application.config.feature_policy do |f|
|
|
467
|
+
f.camera :none
|
|
468
|
+
f.gyroscope :none
|
|
469
|
+
f.microphone :none
|
|
470
|
+
f.usb :none
|
|
471
|
+
f.fullscreen :self
|
|
472
|
+
f.payment :self, "https://secure.example.com"
|
|
473
|
+
end
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Example controller level policy:
|
|
477
|
+
|
|
478
|
+
```ruby
|
|
479
|
+
class PagesController < ApplicationController
|
|
480
|
+
feature_policy do |p|
|
|
481
|
+
p.geolocation "https://example.com"
|
|
482
|
+
end
|
|
483
|
+
end
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
*Jacob Bednarz*
|
|
487
|
+
|
|
488
|
+
* Add the ability to set the CSP nonce only to the specified directives.
|
|
489
|
+
|
|
490
|
+
Fixes #35137.
|
|
491
|
+
|
|
492
|
+
*Yuji Yaginuma*
|
|
275
493
|
|
|
276
|
-
*
|
|
494
|
+
* Keep part when scope option has value.
|
|
277
495
|
|
|
278
|
-
|
|
279
|
-
|
|
496
|
+
When a route was defined within an optional scope, if that route didn't
|
|
497
|
+
take parameters the scope was lost when using path helpers. This commit
|
|
498
|
+
ensures scope is kept both when the route takes parameters or when it
|
|
499
|
+
doesn't.
|
|
280
500
|
|
|
281
|
-
|
|
501
|
+
Fixes #33219.
|
|
282
502
|
|
|
283
|
-
*
|
|
284
|
-
`ActiveSupport::Cache` stores and relies on the fact that Active Record has split `#cache_key` and `#cache_version`
|
|
285
|
-
to support it.
|
|
503
|
+
*Alberto Almagro*
|
|
286
504
|
|
|
287
|
-
|
|
505
|
+
* Added `deep_transform_keys` and `deep_transform_keys!` methods to ActionController::Parameters.
|
|
288
506
|
|
|
289
|
-
*
|
|
507
|
+
*Gustavo Gutierrez*
|
|
290
508
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
may not exist in a certain implementation.
|
|
509
|
+
* Calling `ActionController::Parameters#transform_keys`/`!` without a block now returns
|
|
510
|
+
an enumerator for the parameters instead of the underlying hash.
|
|
294
511
|
|
|
295
|
-
|
|
512
|
+
*Eugene Kenny*
|
|
296
513
|
|
|
297
|
-
|
|
514
|
+
* Fix strong parameters blocks all attributes even when only some keys are invalid (non-numerical).
|
|
515
|
+
It should only block invalid key's values instead.
|
|
298
516
|
|
|
299
|
-
*
|
|
517
|
+
*Stan Lo*
|
|
300
518
|
|
|
301
519
|
|
|
302
|
-
Please check [
|
|
520
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionpack/CHANGELOG.md) for previous changes.
|