actionpack 6.1.7 → 7.0.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.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +251 -406
- data/MIT-LICENSE +1 -0
- data/README.rdoc +2 -3
- data/lib/abstract_controller/asset_paths.rb +1 -1
- data/lib/abstract_controller/base.rb +13 -26
- data/lib/abstract_controller/caching/fragments.rb +2 -2
- data/lib/abstract_controller/caching.rb +1 -1
- data/lib/abstract_controller/callbacks.rb +21 -7
- data/lib/abstract_controller/collector.rb +2 -2
- data/lib/abstract_controller/error.rb +1 -1
- data/lib/abstract_controller/helpers.rb +4 -3
- data/lib/abstract_controller/logger.rb +1 -1
- data/lib/abstract_controller/railties/routes_helpers.rb +2 -0
- data/lib/abstract_controller/translation.rb +3 -2
- data/lib/abstract_controller/url_for.rb +4 -6
- data/lib/action_controller/api.rb +6 -6
- data/lib/action_controller/base.rb +5 -4
- data/lib/action_controller/form_builder.rb +2 -2
- data/lib/action_controller/log_subscriber.rb +4 -3
- data/lib/action_controller/metal/conditional_get.rb +39 -2
- data/lib/action_controller/metal/content_security_policy.rb +36 -2
- data/lib/action_controller/metal/cookies.rb +1 -1
- data/lib/action_controller/metal/data_streaming.rb +5 -13
- data/lib/action_controller/metal/exceptions.rb +19 -30
- data/lib/action_controller/metal/flash.rb +6 -2
- data/lib/action_controller/metal/helpers.rb +2 -2
- data/lib/action_controller/metal/http_authentication.rb +66 -39
- data/lib/action_controller/metal/instrumentation.rb +57 -52
- data/lib/action_controller/metal/live.rb +43 -2
- data/lib/action_controller/metal/mime_responds.rb +3 -3
- data/lib/action_controller/metal/params_wrapper.rb +20 -11
- data/lib/action_controller/metal/permissions_policy.rb +19 -28
- data/lib/action_controller/metal/redirecting.rb +89 -18
- data/lib/action_controller/metal/renderers.rb +10 -11
- data/lib/action_controller/metal/rendering.rb +8 -8
- data/lib/action_controller/metal/request_forgery_protection.rb +78 -29
- data/lib/action_controller/metal/rescue.rb +1 -1
- data/lib/action_controller/metal/streaming.rb +6 -8
- data/lib/action_controller/metal/strong_parameters.rb +100 -54
- data/lib/action_controller/metal/testing.rb +9 -2
- data/lib/action_controller/metal/url_for.rb +3 -3
- data/lib/action_controller/metal.rb +10 -13
- data/lib/action_controller/railtie.rb +49 -6
- data/lib/action_controller/renderer.rb +1 -1
- data/lib/action_controller/test_case.rb +28 -7
- data/lib/action_controller.rb +2 -5
- data/lib/action_dispatch/http/cache.rb +13 -6
- data/lib/action_dispatch/http/content_security_policy.rb +108 -35
- data/lib/action_dispatch/http/filter_parameters.rb +5 -0
- data/lib/action_dispatch/http/mime_negotiation.rb +15 -5
- data/lib/action_dispatch/http/mime_type.rb +9 -11
- data/lib/action_dispatch/http/parameters.rb +5 -5
- data/lib/action_dispatch/http/permissions_policy.rb +17 -1
- data/lib/action_dispatch/http/request.rb +12 -21
- data/lib/action_dispatch/http/response.rb +3 -16
- data/lib/action_dispatch/http/url.rb +11 -19
- data/lib/action_dispatch/journey/gtg/builder.rb +11 -12
- data/lib/action_dispatch/journey/gtg/simulator.rb +10 -4
- data/lib/action_dispatch/journey/gtg/transition_table.rb +77 -21
- data/lib/action_dispatch/journey/nodes/node.rb +70 -5
- data/lib/action_dispatch/journey/path/pattern.rb +22 -13
- data/lib/action_dispatch/journey/route.rb +6 -13
- data/lib/action_dispatch/journey/router/utils.rb +2 -2
- data/lib/action_dispatch/journey/router.rb +1 -1
- data/lib/action_dispatch/journey/routes.rb +3 -3
- data/lib/action_dispatch/journey/visualizer/fsm.js +49 -24
- data/lib/action_dispatch/journey/visualizer/index.html.erb +1 -1
- data/lib/action_dispatch/middleware/actionable_exceptions.rb +0 -1
- data/lib/action_dispatch/middleware/cookies.rb +14 -7
- data/lib/action_dispatch/middleware/debug_exceptions.rb +6 -4
- data/lib/action_dispatch/middleware/debug_locks.rb +3 -3
- data/lib/action_dispatch/middleware/exception_wrapper.rb +4 -0
- data/lib/action_dispatch/middleware/executor.rb +3 -0
- data/lib/action_dispatch/middleware/flash.rb +17 -18
- data/lib/action_dispatch/middleware/host_authorization.rb +1 -12
- data/lib/action_dispatch/middleware/remote_ip.rb +16 -4
- data/lib/action_dispatch/middleware/request_id.rb +1 -1
- data/lib/action_dispatch/middleware/server_timing.rb +76 -0
- data/lib/action_dispatch/middleware/session/abstract_store.rb +1 -1
- data/lib/action_dispatch/middleware/session/cookie_store.rb +9 -9
- data/lib/action_dispatch/middleware/show_exceptions.rb +7 -9
- data/lib/action_dispatch/middleware/stack.rb +27 -9
- data/lib/action_dispatch/middleware/static.rb +2 -6
- data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +4 -11
- data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +2 -2
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +3 -2
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +2 -0
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +4 -4
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/layout.erb +28 -18
- data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +5 -14
- data/lib/action_dispatch/railtie.rb +8 -2
- data/lib/action_dispatch/request/session.rb +43 -13
- data/lib/action_dispatch/routing/inspector.rb +1 -1
- data/lib/action_dispatch/routing/mapper.rb +59 -83
- data/lib/action_dispatch/routing/redirection.rb +5 -2
- data/lib/action_dispatch/routing/route_set.rb +17 -7
- data/lib/action_dispatch/routing/routes_proxy.rb +1 -1
- data/lib/action_dispatch/routing/url_for.rb +4 -5
- data/lib/action_dispatch/routing.rb +5 -6
- data/lib/action_dispatch/system_test_case.rb +5 -5
- data/lib/action_dispatch/system_testing/browser.rb +2 -12
- data/lib/action_dispatch/system_testing/driver.rb +35 -11
- data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +11 -7
- data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +0 -8
- data/lib/action_dispatch/testing/assertions/routing.rb +3 -2
- data/lib/action_dispatch/testing/assertions.rb +2 -5
- data/lib/action_dispatch/testing/integration.rb +6 -8
- data/lib/action_dispatch/testing/test_process.rb +3 -29
- data/lib/action_dispatch/testing/test_response.rb +20 -2
- data/lib/action_dispatch.rb +1 -0
- data/lib/action_pack/gem_version.rb +4 -4
- data/lib/action_pack/version.rb +1 -1
- metadata +14 -13
data/CHANGELOG.md
CHANGED
@@ -1,25 +1,37 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.4 (September 09, 2022) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Prevent `ActionDispatch::ServerTiming` from overwriting existing values in `Server-Timing`.
|
4
|
+
|
5
|
+
Previously, if another middleware down the chain set `Server-Timing` header,
|
6
|
+
it would overwritten by `ActionDispatch::ServerTiming`.
|
7
|
+
|
8
|
+
*Jakub Malinowski*
|
4
9
|
|
5
10
|
|
6
|
-
## Rails
|
11
|
+
## Rails 7.0.3.1 (July 12, 2022) ##
|
7
12
|
|
8
13
|
* No changes.
|
9
14
|
|
10
15
|
|
11
|
-
## Rails
|
16
|
+
## Rails 7.0.3 (May 09, 2022) ##
|
12
17
|
|
13
|
-
*
|
18
|
+
* Allow relative redirects when `raise_on_open_redirects` is enabled.
|
14
19
|
|
20
|
+
*Tom Hughes*
|
15
21
|
|
16
|
-
|
22
|
+
* Fix `authenticate_with_http_basic` to allow for missing password.
|
17
23
|
|
18
|
-
|
24
|
+
Before Rails 7.0 it was possible to handle basic authentication with only a username.
|
19
25
|
|
20
|
-
|
26
|
+
```ruby
|
27
|
+
authenticate_with_http_basic do |token, _|
|
28
|
+
ApiClient.authenticate(token)
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
This ability is restored.
|
21
33
|
|
22
|
-
|
34
|
+
*Jean Boussier*
|
23
35
|
|
24
36
|
* Fix `content_security_policy` returning invalid directives.
|
25
37
|
|
@@ -37,53 +49,52 @@
|
|
37
49
|
|
38
50
|
*Edouard Chin*
|
39
51
|
|
40
|
-
*
|
41
|
-
|
42
|
-
|
43
|
-
Also, blocked host info is always logged with level `error`.
|
44
|
-
|
45
|
-
Fixes #42813.
|
52
|
+
* Fix `skip_forgery_protection` to run without raising an error if forgery
|
53
|
+
protection has not been enabled / `verify_authenticity_token` is not a
|
54
|
+
defined callback.
|
46
55
|
|
47
|
-
|
48
|
-
|
49
|
-
* Dup arrays that get "converted".
|
56
|
+
This fix prevents the Rails 7.0 Welcome Page (`/`) from raising an
|
57
|
+
`ArgumentError` if `default_protect_from_forgery` is false.
|
50
58
|
|
51
|
-
|
59
|
+
*Brad Trick*
|
52
60
|
|
53
|
-
|
61
|
+
* Fix `ActionController::Live` to copy the IsolatedExecutionState in the ephemeral thread.
|
54
62
|
|
55
|
-
|
63
|
+
Since its inception `ActionController::Live` has been copying thread local variables
|
64
|
+
to keep things such as `CurrentAttributes` set from middlewares working in the controller action.
|
56
65
|
|
57
|
-
|
66
|
+
With the introduction of `IsolatedExecutionState` in 7.0, some of that global state was lost in
|
67
|
+
`ActionController::Live` controllers.
|
58
68
|
|
59
|
-
*
|
69
|
+
*Jean Boussier*
|
60
70
|
|
61
|
-
|
71
|
+
* Fix setting `trailing_slash: true` in route definition.
|
62
72
|
|
63
|
-
|
64
|
-
|
65
|
-
* Add fallback host for SystemTestCase driven by RackTest.
|
73
|
+
```ruby
|
74
|
+
get '/test' => "test#index", as: :test, trailing_slash: true
|
66
75
|
|
67
|
-
|
76
|
+
test_path() # => "/test/"
|
77
|
+
```
|
68
78
|
|
69
|
-
*
|
79
|
+
*Jean Boussier*
|
70
80
|
|
71
|
-
|
81
|
+
## Rails 7.0.2.4 (April 26, 2022) ##
|
72
82
|
|
73
|
-
|
83
|
+
* Allow Content Security Policy DSL to generate for API responses.
|
74
84
|
|
85
|
+
*Tim Wade*
|
75
86
|
|
76
|
-
## Rails
|
87
|
+
## Rails 7.0.2.3 (March 08, 2022) ##
|
77
88
|
|
78
89
|
* No changes.
|
79
90
|
|
80
91
|
|
81
|
-
## Rails
|
92
|
+
## Rails 7.0.2.2 (February 11, 2022) ##
|
82
93
|
|
83
94
|
* No changes.
|
84
95
|
|
85
96
|
|
86
|
-
## Rails
|
97
|
+
## Rails 7.0.2.1 (February 11, 2022) ##
|
87
98
|
|
88
99
|
* Under certain circumstances, the middleware isn't informed that the
|
89
100
|
response body has been fully closed which result in request state not
|
@@ -92,545 +103,379 @@
|
|
92
103
|
[CVE-2022-23633]
|
93
104
|
|
94
105
|
|
95
|
-
## Rails
|
96
|
-
|
97
|
-
* Fix issue with host protection not allowing host with port in development.
|
98
|
-
|
99
|
-
|
100
|
-
## Rails 6.1.4.3 (December 14, 2021) ##
|
101
|
-
|
102
|
-
* Fix issue with host protection not allowing localhost in development.
|
103
|
-
|
104
|
-
|
105
|
-
## Rails 6.1.4.2 (December 14, 2021) ##
|
106
|
-
|
107
|
-
* Fix X_FORWARDED_HOST protection. [CVE-2021-44528]
|
108
|
-
|
109
|
-
## Rails 6.1.4.1 (August 19, 2021) ##
|
110
|
-
|
111
|
-
* [CVE-2021-22942] Fix possible open redirect in Host Authorization middleware.
|
112
|
-
|
113
|
-
Specially crafted "X-Forwarded-Host" headers in combination with certain
|
114
|
-
"allowed host" formats can cause the Host Authorization middleware in Action
|
115
|
-
Pack to redirect users to a malicious website.
|
116
|
-
|
117
|
-
## Rails 6.1.4 (June 24, 2021) ##
|
118
|
-
|
119
|
-
* Ignore file fixtures on `db:fixtures:load`
|
120
|
-
|
121
|
-
*Kevin Sjöberg*
|
122
|
-
|
123
|
-
* Fix ActionController::Live controller test deadlocks by removing the body buffer size limit for tests.
|
124
|
-
|
125
|
-
*Dylan Thacker-Smith*
|
126
|
-
|
127
|
-
* Correctly place optional path parameter booleans.
|
128
|
-
|
129
|
-
Previously, if you specify a url parameter that is part of the path as false it would include that part
|
130
|
-
of the path as parameter for example:
|
131
|
-
|
132
|
-
```
|
133
|
-
get "(/optional/:optional_id)/things" => "foo#foo", as: :things
|
134
|
-
things_path(optional_id: false) # => /things?optional_id=false
|
135
|
-
```
|
136
|
-
|
137
|
-
After this change, true and false will be treated the same when used as optional path parameters. Meaning now:
|
138
|
-
|
139
|
-
```
|
140
|
-
get '(this/:my_bool)/that' as: :that
|
141
|
-
|
142
|
-
that_path(my_bool: true) # => `/this/true/that`
|
143
|
-
that_path(my_bool: false) # => `/this/false/that`
|
144
|
-
```
|
145
|
-
|
146
|
-
*Adam Hess*
|
147
|
-
|
148
|
-
* Add support for 'private, no-store' Cache-Control headers.
|
149
|
-
|
150
|
-
Previously, 'no-store' was exclusive; no other directives could be specified.
|
151
|
-
|
152
|
-
*Alex Smith*
|
153
|
-
|
154
|
-
|
155
|
-
## Rails 6.1.3.2 (May 05, 2021) ##
|
156
|
-
|
157
|
-
* Prevent open redirects by correctly escaping the host allow list
|
158
|
-
CVE-2021-22903
|
159
|
-
|
160
|
-
* Prevent catastrophic backtracking during mime parsing
|
161
|
-
CVE-2021-22902
|
162
|
-
|
163
|
-
* Prevent regex DoS in HTTP token authentication
|
164
|
-
CVE-2021-22904
|
165
|
-
|
166
|
-
* Prevent string polymorphic route arguments.
|
167
|
-
|
168
|
-
`url_for` supports building polymorphic URLs via an array
|
169
|
-
of arguments (usually symbols and records). If a developer passes a
|
170
|
-
user input array, strings can result in unwanted route helper calls.
|
171
|
-
|
172
|
-
CVE-2021-22885
|
173
|
-
|
174
|
-
*Gannon McGibbon*
|
175
|
-
|
176
|
-
## Rails 6.1.3.1 (March 26, 2021) ##
|
106
|
+
## Rails 7.0.2 (February 08, 2022) ##
|
177
107
|
|
178
108
|
* No changes.
|
179
109
|
|
180
110
|
|
181
|
-
## Rails
|
182
|
-
|
183
|
-
* Re-define routes when not set correctly via inheritance.
|
184
|
-
|
185
|
-
*John Hawthorn*
|
186
|
-
|
111
|
+
## Rails 7.0.1 (January 06, 2022) ##
|
187
112
|
|
188
|
-
|
113
|
+
* Fix `ActionController::Parameters` methods to keep the original logger context when creating a new copy
|
114
|
+
of the original object.
|
189
115
|
|
190
|
-
*
|
116
|
+
*Yutaka Kamei*
|
191
117
|
|
192
|
-
[CVE-2021-22881]
|
193
118
|
|
194
|
-
|
195
|
-
issue and the patch!
|
119
|
+
## Rails 7.0.0 (December 15, 2021) ##
|
196
120
|
|
197
|
-
|
121
|
+
* Deprecate `Rails.application.config.action_controller.urlsafe_csrf_tokens`. This config is now always enabled.
|
198
122
|
|
123
|
+
*Étienne Barrié*
|
199
124
|
|
200
|
-
|
201
|
-
|
202
|
-
* Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
|
203
|
-
|
204
|
-
*Janko Marohnić*
|
125
|
+
* Instance variables set in requests in a `ActionController::TestCase` are now cleared before the next request
|
205
126
|
|
206
|
-
|
127
|
+
This means if you make multiple requests in the same test, instance variables set in the first request will
|
128
|
+
not persist into the second one. (It's not recommended to make multiple requests in the same test.)
|
207
129
|
|
208
|
-
*
|
209
|
-
|
210
|
-
|
211
|
-
## Rails 6.1.1 (January 07, 2021) ##
|
212
|
-
|
213
|
-
* Fix nil translation key lookup in controllers/
|
214
|
-
|
215
|
-
*Jan Klimo*
|
130
|
+
*Alex Ghiculescu*
|
216
131
|
|
217
|
-
* Quietly handle unknown HTTP methods in Action Dispatch SSL middleware.
|
218
132
|
|
219
|
-
|
133
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
220
134
|
|
221
|
-
*
|
135
|
+
* No changes.
|
222
136
|
|
223
|
-
*Alex Robbin*
|
224
137
|
|
138
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
225
139
|
|
226
|
-
|
140
|
+
* Fix X_FORWARDED_HOST protection. [CVE-2021-44528]
|
227
141
|
|
228
|
-
* Support for the HTTP header `Feature-Policy` has been revised to reflect
|
229
|
-
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).
|
230
142
|
|
231
|
-
|
232
|
-
Rails.application.config.permissions_policy do |p|
|
233
|
-
p.camera :none
|
234
|
-
p.gyroscope :none
|
235
|
-
p.microphone :none
|
236
|
-
p.usb :none
|
237
|
-
p.fullscreen :self
|
238
|
-
p.payment :self, "https://secure-example.com"
|
239
|
-
end
|
240
|
-
```
|
143
|
+
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
241
144
|
|
242
|
-
|
145
|
+
* `Rails.application.executor` hooks can now be called around every request in a `ActionController::TestCase`
|
243
146
|
|
244
|
-
|
147
|
+
This helps to better simulate request or job local state being reset between requests and prevent state
|
148
|
+
leaking from one request to another.
|
245
149
|
|
246
|
-
|
150
|
+
To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
|
247
151
|
|
248
|
-
*
|
152
|
+
*Alex Ghiculescu*
|
249
153
|
|
250
|
-
*
|
251
|
-
the unique X-Request-Id header
|
154
|
+
* Consider onion services secure for cookies.
|
252
155
|
|
253
|
-
*
|
156
|
+
*Justin Tracey*
|
254
157
|
|
255
|
-
*
|
158
|
+
* Remove deprecated `Rails.config.action_view.raise_on_missing_translations`.
|
256
159
|
|
257
160
|
*Rafael Mendonça França*
|
258
161
|
|
259
|
-
*
|
162
|
+
* Remove deprecated support to passing a path to `fixture_file_upload` relative to `fixture_path`.
|
260
163
|
|
261
164
|
*Rafael Mendonça França*
|
262
165
|
|
263
|
-
* Remove deprecated `ActionDispatch::
|
166
|
+
* Remove deprecated `ActionDispatch::SystemTestCase#host!`.
|
264
167
|
|
265
168
|
*Rafael Mendonça França*
|
266
169
|
|
267
|
-
*
|
268
|
-
|
269
|
-
If `no-store` is set on Cache-Control header it is exclusive (all other cache directives are dropped).
|
270
|
-
|
271
|
-
*Chris Kruger*
|
272
|
-
|
273
|
-
* Catch invalid UTF-8 parameters for POST requests and respond with BadRequest.
|
274
|
-
|
275
|
-
Additionally, perform `#set_binary_encoding` in `ActionDispatch::Http::Request#GET` and
|
276
|
-
`ActionDispatch::Http::Request#POST` prior to validating encoding.
|
277
|
-
|
278
|
-
*Adrianna Chang*
|
279
|
-
|
280
|
-
* Allow `assert_recognizes` routing assertions to work on mounted root routes.
|
170
|
+
* Remove deprecated `Rails.config.action_dispatch.hosts_response_app`.
|
281
171
|
|
282
|
-
*
|
283
|
-
|
284
|
-
* Change default redirection status code for non-GET/HEAD requests to 308 Permanent Redirect for `ActionDispatch::SSL`.
|
285
|
-
|
286
|
-
*Alan Tan*, *Oz Ben-David*
|
287
|
-
|
288
|
-
* Fix `follow_redirect!` to follow redirection with same HTTP verb when following
|
289
|
-
a 308 redirection.
|
172
|
+
*Rafael Mendonça França*
|
290
173
|
|
291
|
-
|
174
|
+
* Remove deprecated `ActionDispatch::Response.return_only_media_type_on_content_type`.
|
292
175
|
|
293
|
-
*
|
294
|
-
chosen only if it is equal to or is a superdomain of the request host.
|
176
|
+
*Rafael Mendonça França*
|
295
177
|
|
296
|
-
|
178
|
+
* Raise `ActionController::Redirecting::UnsafeRedirectError` for unsafe `redirect_to` redirects.
|
297
179
|
|
298
|
-
|
180
|
+
This allows `rescue_from` to be used to add a default fallback route:
|
299
181
|
|
300
|
-
|
301
|
-
|
182
|
+
```ruby
|
183
|
+
rescue_from ActionController::Redirecting::UnsafeRedirectError do
|
184
|
+
redirect_to root_url
|
185
|
+
end
|
186
|
+
```
|
302
187
|
|
303
|
-
|
304
|
-
we check for public/some.js.br and serve that file, if present, with
|
305
|
-
`Content-Encoding: br` and `Vary: Accept-Encoding` headers.
|
188
|
+
*Kasper Timm Hansen*, *Chris Oliver*
|
306
189
|
|
307
|
-
|
190
|
+
* Add `url_from` to verify a redirect location is internal.
|
308
191
|
|
309
|
-
|
192
|
+
Takes the open redirect protection from `redirect_to` so users can wrap a
|
193
|
+
param, and fall back to an alternate redirect URL when the param provided
|
194
|
+
one is unsafe.
|
310
195
|
|
311
|
-
|
312
|
-
|
313
|
-
|
196
|
+
```ruby
|
197
|
+
def create
|
198
|
+
redirect_to url_from(params[:redirect_url]) || root_url
|
199
|
+
end
|
200
|
+
```
|
314
201
|
|
315
|
-
*
|
202
|
+
*dmcge*, *Kasper Timm Hansen*
|
316
203
|
|
317
|
-
*
|
204
|
+
* Allow Capybara driver name overrides in `SystemTestCase::driven_by`
|
318
205
|
|
319
|
-
|
206
|
+
Allow users to prevent conflicts among drivers that use the same driver
|
207
|
+
type (selenium, poltergeist, webkit, rack test).
|
320
208
|
|
321
|
-
|
322
|
-
without passing a block now returns an enumerator.
|
209
|
+
Fixes #42502
|
323
210
|
|
324
|
-
*
|
211
|
+
*Chris LaRose*
|
325
212
|
|
326
|
-
*
|
213
|
+
* Allow multiline to be passed in routes when using wildcard segments.
|
327
214
|
|
328
|
-
Previously
|
329
|
-
|
215
|
+
Previously routes with newlines weren't detected when using wildcard segments, returning
|
216
|
+
a `No route matches` error.
|
217
|
+
After this change, routes with newlines are detected on wildcard segments. Example
|
330
218
|
|
331
219
|
```ruby
|
332
|
-
|
333
|
-
|
220
|
+
draw do
|
221
|
+
get "/wildcard/*wildcard_segment", to: SimpleApp.new("foo#index"), as: :wildcard
|
222
|
+
end
|
334
223
|
|
335
|
-
|
336
|
-
|
224
|
+
# After the change, the path matches.
|
225
|
+
assert_equal "/wildcard/a%0Anewline", url_helpers.wildcard_path(wildcard_segment: "a\nnewline")
|
337
226
|
```
|
338
227
|
|
339
|
-
|
228
|
+
Fixes #39103
|
340
229
|
|
341
|
-
*
|
230
|
+
*Ignacio Chiazzo*
|
342
231
|
|
343
|
-
|
232
|
+
* Treat html suffix in controller translation.
|
344
233
|
|
345
|
-
*
|
346
|
-
strings/symbols with `String#constantize` instead of `require_dependency`.
|
234
|
+
*Rui Onodera*, *Gavin Miller*
|
347
235
|
|
348
|
-
|
349
|
-
always pass a module object:
|
236
|
+
* Allow permitting numeric params.
|
350
237
|
|
238
|
+
Previously it was impossible to permit different fields on numeric parameters.
|
239
|
+
After this change you can specify different fields for each numbered parameter.
|
240
|
+
For example params like,
|
351
241
|
```ruby
|
352
|
-
|
242
|
+
book: {
|
243
|
+
authors_attributes: {
|
244
|
+
'0': { name: "William Shakespeare", age_of_death: "52" },
|
245
|
+
'1': { name: "Unattributed Assistant" },
|
246
|
+
'2': "Not a hash",
|
247
|
+
'new_record': { name: "Some name" }
|
248
|
+
}
|
249
|
+
}
|
353
250
|
```
|
354
251
|
|
355
|
-
|
356
|
-
|
357
|
-
that same module object.
|
252
|
+
Before you could permit name on each author with,
|
253
|
+
`permit book: { authors_attributes: [ :name ] }`
|
358
254
|
|
359
|
-
|
255
|
+
After this change you can permit different keys on each numbered element,
|
256
|
+
`permit book: { authors_attributes: { '1': [ :name ], '0': [ :name, :age_of_death ] } }`
|
360
257
|
|
361
|
-
|
258
|
+
Fixes #41625
|
362
259
|
|
363
|
-
*
|
364
|
-
|
365
|
-
* `url_for` will now use "https://" as the default protocol when
|
366
|
-
`Rails.application.config.force_ssl` is set to true.
|
367
|
-
|
368
|
-
*Jonathan Hefner*
|
369
|
-
|
370
|
-
* Accept and default to base64_urlsafe CSRF tokens.
|
260
|
+
*Adam Hess*
|
371
261
|
|
372
|
-
|
373
|
-
|
374
|
-
the CSRF token to a browser in a client-readable cookie does not work properly
|
375
|
-
out of the box: the value has to be url-encoded and decoded to survive transport.
|
262
|
+
* Update `HostAuthorization` middleware to render debug info only
|
263
|
+
when `config.consider_all_requests_local` is set to true.
|
376
264
|
|
377
|
-
|
378
|
-
to transport. Validation accepts both urlsafe tokens, and strict-encoded tokens
|
379
|
-
for backwards compatibility.
|
265
|
+
Also, blocked host info is always logged with level `error`.
|
380
266
|
|
381
|
-
|
267
|
+
Fixes #42813
|
382
268
|
|
383
|
-
*
|
269
|
+
*Nikita Vyrko*
|
384
270
|
|
385
|
-
|
386
|
-
both old and new instances during deployment. Users may be served by a
|
387
|
-
new instance and then by an old instance.
|
271
|
+
* Add Server-Timing middleware
|
388
272
|
|
389
|
-
|
390
|
-
|
391
|
-
from `false` to `true`, users may lose their sessions if they access the
|
392
|
-
server during deployment.
|
273
|
+
Server-Timing specification defines how the server can communicate to browsers performance metrics
|
274
|
+
about the request it is responding to.
|
393
275
|
|
394
|
-
|
395
|
-
|
276
|
+
The ServerTiming middleware is enabled by default on `development` environment by default using the
|
277
|
+
`config.server_timing` setting and set the relevant duration metrics in the `Server-Timing` header
|
396
278
|
|
397
|
-
|
279
|
+
The full specification for Server-Timing header can be found in: https://www.w3.org/TR/server-timing/#dfn-server-timing-header-field
|
398
280
|
|
399
|
-
*
|
281
|
+
*Sebastian Sogamoso*, *Guillermo Iguaran*
|
400
282
|
|
401
|
-
Before, if all `X-Forwarded-For` sites were trusted, the `remote_ip` would default to `127.0.0.1`.
|
402
|
-
Now, the furthest proxy site is used. e.g.: It now gives an ip address when using curl from the load balancer.
|
403
283
|
|
404
|
-
|
284
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
405
285
|
|
406
|
-
*
|
286
|
+
* No changes.
|
407
287
|
|
408
|
-
The `ActionDispatch::Session::MemcacheStore` is still vulnerable given it requires the
|
409
|
-
gem dalli to be updated as well.
|
410
288
|
|
411
|
-
|
289
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
412
290
|
|
413
|
-
*
|
291
|
+
* Use a static error message when raising `ActionDispatch::Http::Parameters::ParseError`
|
292
|
+
to avoid inadvertently logging the HTTP request body at the `fatal` level when it contains
|
293
|
+
malformed JSON.
|
414
294
|
|
415
|
-
|
416
|
-
meant it had its own copy of `@assertions`. This prevented the assertions
|
417
|
-
from being correctly counted and reported.
|
295
|
+
Fixes #41145
|
418
296
|
|
419
|
-
|
420
|
-
root session.
|
297
|
+
*Aaron Lahey*
|
421
298
|
|
422
|
-
|
299
|
+
* Add `Middleware#delete!` to delete middleware or raise if not found.
|
423
300
|
|
424
|
-
|
301
|
+
`Middleware#delete!` works just like `Middleware#delete` but will
|
302
|
+
raise an error if the middleware isn't found.
|
425
303
|
|
426
|
-
*
|
304
|
+
*Alex Ghiculescu*, *Petrik de Heus*, *Junichi Sato*
|
427
305
|
|
428
|
-
|
429
|
-
where cookies won't be sent by browsers in cross-site POST requests when set to `:lax`.
|
306
|
+
* Raise error on unpermitted open redirects.
|
430
307
|
|
431
|
-
|
308
|
+
Add `allow_other_host` options to `redirect_to`.
|
309
|
+
Opt in to this behaviour with `ActionController::Base.raise_on_open_redirects = true`.
|
432
310
|
|
433
|
-
|
311
|
+
*Gannon McGibbon*
|
434
312
|
|
435
|
-
|
313
|
+
* Deprecate `poltergeist` and `webkit` (capybara-webkit) driver registration for system testing (they will be removed in Rails 7.1). Add `cuprite` instead.
|
436
314
|
|
437
|
-
|
315
|
+
[Poltergeist](https://github.com/teampoltergeist/poltergeist) and [capybara-webkit](https://github.com/thoughtbot/capybara-webkit) are already not maintained. These usage in Rails are removed for avoiding confusing users.
|
438
316
|
|
439
|
-
|
317
|
+
[Cuprite](https://github.com/rubycdp/cuprite) is a good alternative to Poltergeist. Some guide descriptions are replaced from Poltergeist to Cuprite.
|
440
318
|
|
441
|
-
*
|
319
|
+
*Yusuke Iwaki*
|
442
320
|
|
443
|
-
*
|
321
|
+
* Exclude additional flash types from `ActionController::Base.action_methods`.
|
444
322
|
|
445
|
-
|
446
|
-
|
447
|
-
that this wasn't fully the case and loading external route files from the router
|
448
|
-
can be helpful for applications with a really large set of routes.
|
449
|
-
Without this feature, application needs to implement routes reloading
|
450
|
-
themselves and it's not straightforward.
|
323
|
+
Ensures that additional flash types defined on ActionController::Base subclasses
|
324
|
+
are not listed as actions on that controller.
|
451
325
|
|
452
|
-
|
453
|
-
|
326
|
+
class MyController < ApplicationController
|
327
|
+
add_flash_types :hype
|
328
|
+
end
|
454
329
|
|
455
|
-
|
456
|
-
draw(:admin)
|
457
|
-
end
|
330
|
+
MyController.action_methods.include?('hype') # => false
|
458
331
|
|
459
|
-
|
332
|
+
*Gavin Morrice*
|
460
333
|
|
461
|
-
|
462
|
-
```
|
334
|
+
* OpenSSL constants are now used for Digest computations.
|
463
335
|
|
464
|
-
*
|
336
|
+
*Dirkjan Bussink*
|
465
337
|
|
466
|
-
*
|
338
|
+
* Remove IE6-7-8 file download related hack/fix from ActionController::DataStreaming module.
|
467
339
|
|
468
|
-
|
340
|
+
Due to the age of those versions of IE this fix is no longer relevant, more importantly it creates an edge-case for unexpected Cache-Control headers.
|
469
341
|
|
470
|
-
*
|
471
|
-
their payloads as `:request`.
|
342
|
+
*Tadas Sasnauskas*
|
472
343
|
|
473
|
-
|
344
|
+
* Configuration setting to skip logging an uncaught exception backtrace when the exception is
|
345
|
+
present in `rescued_responses`.
|
474
346
|
|
475
|
-
|
476
|
-
|
347
|
+
It may be too noisy to get all backtraces logged for applications that manage uncaught
|
348
|
+
exceptions via `rescued_responses` and `exceptions_app`.
|
349
|
+
`config.action_dispatch.log_rescued_responses` (defaults to `true`) can be set to `false` in
|
350
|
+
this case, so that only exceptions not found in `rescued_responses` will be logged.
|
477
351
|
|
478
|
-
|
352
|
+
*Alexander Azarov*, *Mike Dalessio*
|
479
353
|
|
480
|
-
|
481
|
-
def my_action
|
482
|
-
respond_to do |format|
|
483
|
-
format.any { render(json: { foo: 'bar' }) }
|
484
|
-
end
|
485
|
-
end
|
354
|
+
* Ignore file fixtures on `db:fixtures:load`.
|
486
355
|
|
487
|
-
|
488
|
-
```
|
356
|
+
*Kevin Sjöberg*
|
489
357
|
|
490
|
-
|
491
|
-
is inaccurate since a JSON response is being rendered.
|
358
|
+
* Fix ActionController::Live controller test deadlocks by removing the body buffer size limit for tests.
|
492
359
|
|
493
|
-
|
360
|
+
*Dylan Thacker-Smith*
|
494
361
|
|
495
|
-
|
362
|
+
* New `ActionController::ConditionalGet#no_store` method to set HTTP cache control `no-store` directive.
|
496
363
|
|
497
|
-
*
|
364
|
+
*Tadas Sasnauskas*
|
498
365
|
|
499
|
-
|
500
|
-
nested directory, causing issues with `tmp:clear`.
|
366
|
+
* Drop support for the `SERVER_ADDR` header.
|
501
367
|
|
502
|
-
|
368
|
+
Following up https://github.com/rack/rack/pull/1573 and https://github.com/rails/rails/pull/42349.
|
503
369
|
|
504
|
-
*
|
370
|
+
*Ricardo Díaz*
|
505
371
|
|
506
|
-
|
372
|
+
* Set session options when initializing a basic session.
|
507
373
|
|
508
|
-
*
|
374
|
+
*Gannon McGibbon*
|
509
375
|
|
510
|
-
|
511
|
-
* `:response` - the `ActionDispatch::Response`
|
376
|
+
* Add `cache_control: {}` option to `fresh_when` and `stale?`.
|
512
377
|
|
513
|
-
|
378
|
+
Works as a shortcut to set `response.cache_control` with the above methods.
|
514
379
|
|
515
|
-
*
|
516
|
-
`remote_ip` to `nil` before setting the header that the value is derived
|
517
|
-
from.
|
380
|
+
*Jacopo Beschi*
|
518
381
|
|
519
|
-
|
382
|
+
* Writing into a disabled session will now raise an error.
|
520
383
|
|
521
|
-
|
384
|
+
Previously when no session store was set, writing into the session would silently fail.
|
522
385
|
|
523
|
-
*
|
386
|
+
*Jean Boussier*
|
524
387
|
|
525
|
-
|
526
|
-
# Use the debug level if a particular cookie is set.
|
527
|
-
class ApplicationController < ActionController::Base
|
528
|
-
log_at :debug, if: -> { cookies[:debug] }
|
529
|
-
end
|
530
|
-
```
|
388
|
+
* Add support for 'require-trusted-types-for' and 'trusted-types' headers.
|
531
389
|
|
532
|
-
|
390
|
+
Fixes #42034.
|
533
391
|
|
534
|
-
*
|
535
|
-
a test by prefixing the file name with an incrementing counter.
|
392
|
+
*lfalcao*
|
536
393
|
|
537
|
-
|
538
|
-
enable saving of HTML during a screenshot in addition to the image.
|
539
|
-
This uses the same image name, with the extension replaced with `.html`
|
394
|
+
* Remove inline styles and address basic accessibility issues on rescue templates.
|
540
395
|
|
541
|
-
*
|
396
|
+
*Jacob Herrington*
|
542
397
|
|
543
|
-
* Add
|
398
|
+
* Add support for 'private, no-store' Cache-Control headers.
|
544
399
|
|
545
|
-
|
546
|
-
header to determine what to return. And if we don't add `Vary`
|
547
|
-
in the response header, browsers might accidentally cache different
|
548
|
-
types of content, which would cause issues: e.g. javascript got displayed
|
549
|
-
instead of html content. This PR fixes these issues by adding `Vary: Accept`
|
550
|
-
in these types of requests. For more detailed problem description, please read:
|
400
|
+
Previously, 'no-store' was exclusive; no other directives could be specified.
|
551
401
|
|
552
|
-
|
402
|
+
*Alex Smith*
|
553
403
|
|
554
|
-
|
404
|
+
* Expand payload of `unpermitted_parameters.action_controller` instrumentation to allow subscribers to
|
405
|
+
know which controller action received unpermitted parameters.
|
555
406
|
|
556
|
-
*
|
407
|
+
*bbuchalter*
|
557
408
|
|
558
|
-
*
|
559
|
-
a 307 redirection.
|
409
|
+
* Add `ActionController::Live#send_stream` that makes it more convenient to send generated streams:
|
560
410
|
|
561
|
-
|
411
|
+
```ruby
|
412
|
+
send_stream(filename: "subscribers.csv") do |stream|
|
413
|
+
stream.writeln "email_address,updated_at"
|
562
414
|
|
563
|
-
|
415
|
+
@subscribers.find_each do |subscriber|
|
416
|
+
stream.writeln [ subscriber.email_address, subscriber.updated_at ].join(",")
|
417
|
+
end
|
418
|
+
end
|
419
|
+
```
|
564
420
|
|
565
|
-
*
|
421
|
+
*DHH*
|
566
422
|
|
567
|
-
*
|
423
|
+
* Add `ActionController::Live::Buffer#writeln` to write a line to the stream with a newline included.
|
568
424
|
|
569
|
-
*
|
425
|
+
*DHH*
|
570
426
|
|
571
|
-
*
|
427
|
+
* `ActionDispatch::Request#content_type` now returned Content-Type header as it is.
|
572
428
|
|
573
|
-
|
574
|
-
|
575
|
-
specification and guidelines can be found at MDN:
|
429
|
+
Previously, `ActionDispatch::Request#content_type` returned value does NOT contain charset part.
|
430
|
+
This behavior changed to returned Content-Type header containing charset part as it is.
|
576
431
|
|
577
|
-
|
432
|
+
If you want just MIME type, please use `ActionDispatch::Request#media_type` instead.
|
578
433
|
|
579
|
-
|
434
|
+
Before:
|
580
435
|
|
581
436
|
```ruby
|
582
|
-
|
583
|
-
|
584
|
-
f.gyroscope :none
|
585
|
-
f.microphone :none
|
586
|
-
f.usb :none
|
587
|
-
f.fullscreen :self
|
588
|
-
f.payment :self, "https://secure.example.com"
|
589
|
-
end
|
437
|
+
request = ActionDispatch::Request.new("CONTENT_TYPE" => "text/csv; header=present; charset=utf-16", "REQUEST_METHOD" => "GET")
|
438
|
+
request.content_type #=> "text/csv"
|
590
439
|
```
|
591
440
|
|
592
|
-
|
441
|
+
After:
|
593
442
|
|
594
443
|
```ruby
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
end
|
599
|
-
end
|
444
|
+
request = ActionDispatch::Request.new("Content-Type" => "text/csv; header=present; charset=utf-16", "REQUEST_METHOD" => "GET")
|
445
|
+
request.content_type #=> "text/csv; header=present; charset=utf-16"
|
446
|
+
request.media_type #=> "text/csv"
|
600
447
|
```
|
601
448
|
|
602
|
-
*
|
449
|
+
*Rafael Mendonça França*
|
603
450
|
|
604
|
-
*
|
451
|
+
* Change `ActionDispatch::Request#media_type` to return `nil` when the request don't have a `Content-Type` header.
|
605
452
|
|
606
|
-
|
453
|
+
*Rafael Mendonça França*
|
607
454
|
|
608
|
-
|
455
|
+
* Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
|
609
456
|
|
610
|
-
*
|
457
|
+
*Janko Marohnić*
|
611
458
|
|
612
|
-
|
613
|
-
take parameters the scope was lost when using path helpers. This commit
|
614
|
-
ensures scope is kept both when the route takes parameters or when it
|
615
|
-
doesn't.
|
459
|
+
* Allow anything with `#to_str` (like `Addressable::URI`) as a `redirect_to` location.
|
616
460
|
|
617
|
-
|
461
|
+
*ojab*
|
618
462
|
|
619
|
-
|
463
|
+
* Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
|
620
464
|
|
621
|
-
*
|
465
|
+
*Alex Robbin*
|
622
466
|
|
623
|
-
|
467
|
+
* Deprecate the ability to assign a single value to `config.action_dispatch.trusted_proxies`
|
468
|
+
as `RemoteIp` middleware behaves inconsistently depending on whether this is configured
|
469
|
+
with a single value or an enumerable.
|
624
470
|
|
625
|
-
|
626
|
-
an enumerator for the parameters instead of the underlying hash.
|
471
|
+
Fixes #40772.
|
627
472
|
|
628
|
-
*
|
473
|
+
*Christian Sutter*
|
629
474
|
|
630
|
-
*
|
631
|
-
|
475
|
+
* Add `redirect_back_or_to(fallback_location, **)` as a more aesthetically pleasing version of `redirect_back fallback_location:, **`.
|
476
|
+
The old method name is retained without explicit deprecation.
|
632
477
|
|
633
|
-
*
|
478
|
+
*DHH*
|
634
479
|
|
635
480
|
|
636
|
-
Please check [6-
|
481
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionpack/CHANGELOG.md) for previous changes.
|