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