actionpack 6.1.7.5 → 7.1.3.1
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 +355 -435
- data/MIT-LICENSE +2 -1
- data/README.rdoc +6 -7
- data/lib/abstract_controller/asset_paths.rb +1 -1
- data/lib/abstract_controller/base.rb +33 -37
- data/lib/abstract_controller/caching/fragments.rb +4 -2
- data/lib/abstract_controller/caching.rb +1 -1
- data/lib/abstract_controller/callbacks.rb +50 -11
- data/lib/abstract_controller/collector.rb +2 -2
- data/lib/abstract_controller/deprecator.rb +7 -0
- data/lib/abstract_controller/error.rb +1 -1
- data/lib/abstract_controller/helpers.rb +78 -30
- data/lib/abstract_controller/logger.rb +1 -1
- data/lib/abstract_controller/railties/routes_helpers.rb +3 -16
- data/lib/abstract_controller/rendering.rb +12 -14
- data/lib/abstract_controller/translation.rb +26 -7
- data/lib/abstract_controller/url_for.rb +6 -6
- data/lib/abstract_controller.rb +6 -0
- data/lib/action_controller/api.rb +12 -10
- data/lib/action_controller/base.rb +8 -21
- data/lib/action_controller/caching.rb +2 -0
- data/lib/action_controller/deprecator.rb +7 -0
- data/lib/action_controller/form_builder.rb +4 -2
- data/lib/action_controller/log_subscriber.rb +20 -7
- data/lib/action_controller/metal/basic_implicit_render.rb +3 -1
- data/lib/action_controller/metal/conditional_get.rb +137 -102
- data/lib/action_controller/metal/content_security_policy.rb +37 -3
- data/lib/action_controller/metal/cookies.rb +1 -1
- data/lib/action_controller/metal/data_streaming.rb +25 -31
- data/lib/action_controller/metal/default_headers.rb +2 -0
- data/lib/action_controller/metal/etag_with_flash.rb +3 -1
- data/lib/action_controller/metal/etag_with_template_digest.rb +2 -0
- data/lib/action_controller/metal/exceptions.rb +27 -30
- data/lib/action_controller/metal/flash.rb +6 -2
- data/lib/action_controller/metal/head.rb +9 -7
- data/lib/action_controller/metal/helpers.rb +5 -16
- data/lib/action_controller/metal/http_authentication.rb +78 -42
- data/lib/action_controller/metal/implicit_render.rb +5 -3
- data/lib/action_controller/metal/instrumentation.rb +62 -50
- data/lib/action_controller/metal/live.rb +67 -2
- data/lib/action_controller/metal/mime_responds.rb +5 -5
- data/lib/action_controller/metal/params_wrapper.rb +24 -13
- data/lib/action_controller/metal/permissions_policy.rb +20 -29
- data/lib/action_controller/metal/redirecting.rb +96 -23
- data/lib/action_controller/metal/renderers.rb +14 -15
- data/lib/action_controller/metal/rendering.rb +121 -16
- data/lib/action_controller/metal/request_forgery_protection.rb +208 -68
- data/lib/action_controller/metal/rescue.rb +7 -4
- data/lib/action_controller/metal/streaming.rb +74 -36
- data/lib/action_controller/metal/strong_parameters.rb +254 -151
- data/lib/action_controller/metal/testing.rb +9 -2
- data/lib/action_controller/metal/url_for.rb +10 -5
- data/lib/action_controller/metal.rb +89 -34
- data/lib/action_controller/railtie.rb +66 -9
- data/lib/action_controller/renderer.rb +99 -85
- data/lib/action_controller/test_case.rb +42 -11
- data/lib/action_controller.rb +10 -6
- data/lib/action_dispatch/constants.rb +32 -0
- data/lib/action_dispatch/deprecator.rb +7 -0
- data/lib/action_dispatch/http/cache.rb +21 -16
- data/lib/action_dispatch/http/content_security_policy.rb +122 -44
- data/lib/action_dispatch/http/filter_parameters.rb +14 -23
- data/lib/action_dispatch/http/headers.rb +3 -1
- data/lib/action_dispatch/http/mime_negotiation.rb +25 -15
- data/lib/action_dispatch/http/mime_type.rb +43 -22
- data/lib/action_dispatch/http/mime_types.rb +3 -1
- data/lib/action_dispatch/http/parameters.rb +6 -6
- data/lib/action_dispatch/http/permissions_policy.rb +57 -19
- data/lib/action_dispatch/http/rack_cache.rb +2 -0
- data/lib/action_dispatch/http/request.rb +75 -51
- data/lib/action_dispatch/http/response.rb +81 -77
- data/lib/action_dispatch/http/upload.rb +15 -2
- data/lib/action_dispatch/http/url.rb +11 -19
- data/lib/action_dispatch/journey/formatter.rb +8 -2
- 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 +36 -27
- data/lib/action_dispatch/journey/route.rb +8 -14
- data/lib/action_dispatch/journey/router/utils.rb +2 -2
- data/lib/action_dispatch/journey/router.rb +10 -9
- data/lib/action_dispatch/journey/routes.rb +5 -5
- 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/log_subscriber.rb +23 -0
- data/lib/action_dispatch/middleware/actionable_exceptions.rb +5 -7
- data/lib/action_dispatch/middleware/assume_ssl.rb +24 -0
- data/lib/action_dispatch/middleware/callbacks.rb +2 -0
- data/lib/action_dispatch/middleware/cookies.rb +97 -107
- data/lib/action_dispatch/middleware/debug_exceptions.rb +31 -28
- data/lib/action_dispatch/middleware/debug_locks.rb +7 -4
- data/lib/action_dispatch/middleware/debug_view.rb +7 -2
- data/lib/action_dispatch/middleware/exception_wrapper.rb +190 -27
- data/lib/action_dispatch/middleware/executor.rb +3 -0
- data/lib/action_dispatch/middleware/flash.rb +24 -18
- data/lib/action_dispatch/middleware/host_authorization.rb +19 -20
- data/lib/action_dispatch/middleware/public_exceptions.rb +5 -3
- data/lib/action_dispatch/middleware/reloader.rb +7 -5
- data/lib/action_dispatch/middleware/remote_ip.rb +32 -19
- data/lib/action_dispatch/middleware/request_id.rb +5 -3
- data/lib/action_dispatch/middleware/server_timing.rb +76 -0
- data/lib/action_dispatch/middleware/session/abstract_store.rb +6 -1
- data/lib/action_dispatch/middleware/session/cache_store.rb +2 -0
- data/lib/action_dispatch/middleware/session/cookie_store.rb +19 -13
- data/lib/action_dispatch/middleware/session/mem_cache_store.rb +3 -1
- data/lib/action_dispatch/middleware/show_exceptions.rb +30 -25
- data/lib/action_dispatch/middleware/ssl.rb +18 -6
- data/lib/action_dispatch/middleware/stack.rb +34 -11
- data/lib/action_dispatch/middleware/static.rb +16 -16
- data/lib/action_dispatch/middleware/templates/rescues/_actions.html.erb +2 -2
- data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +5 -5
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +4 -11
- data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +8 -1
- data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +2 -2
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +10 -5
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +7 -3
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +9 -9
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +2 -2
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +3 -3
- data/lib/action_dispatch/middleware/templates/rescues/layout.erb +45 -18
- data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +19 -15
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +4 -4
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +6 -6
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +7 -7
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +4 -4
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +1 -1
- data/lib/action_dispatch/middleware/templates/routes/_route.html.erb +3 -0
- data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +64 -55
- data/lib/action_dispatch/railtie.rb +20 -4
- data/lib/action_dispatch/request/session.rb +59 -19
- data/lib/action_dispatch/request/utils.rb +8 -3
- data/lib/action_dispatch/routing/inspector.rb +55 -7
- data/lib/action_dispatch/routing/mapper.rb +117 -107
- data/lib/action_dispatch/routing/polymorphic_routes.rb +2 -0
- data/lib/action_dispatch/routing/redirection.rb +20 -8
- data/lib/action_dispatch/routing/route_set.rb +67 -27
- data/lib/action_dispatch/routing/routes_proxy.rb +11 -16
- data/lib/action_dispatch/routing/url_for.rb +29 -26
- data/lib/action_dispatch/routing.rb +12 -13
- data/lib/action_dispatch/system_test_case.rb +8 -8
- data/lib/action_dispatch/system_testing/browser.rb +20 -29
- data/lib/action_dispatch/system_testing/driver.rb +34 -18
- data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +35 -20
- data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +0 -8
- data/lib/action_dispatch/testing/assertion_response.rb +1 -1
- data/lib/action_dispatch/testing/assertions/response.rb +14 -7
- data/lib/action_dispatch/testing/assertions/routing.rb +70 -30
- data/lib/action_dispatch/testing/assertions.rb +3 -4
- data/lib/action_dispatch/testing/integration.rb +33 -25
- data/lib/action_dispatch/testing/request_encoder.rb +4 -1
- data/lib/action_dispatch/testing/test_process.rb +5 -30
- data/lib/action_dispatch/testing/test_request.rb +1 -1
- data/lib/action_dispatch/testing/test_response.rb +34 -2
- data/lib/action_dispatch.rb +38 -4
- data/lib/action_pack/gem_version.rb +4 -4
- data/lib/action_pack/version.rb +1 -1
- data/lib/action_pack.rb +1 -1
- metadata +67 -30
data/CHANGELOG.md
CHANGED
@@ -1,673 +1,593 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.1.3.1 (February 21, 2024) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Fix possible XSS vulnerability with the `translate` method in controllers
|
4
4
|
|
5
|
+
CVE-2024-26143
|
5
6
|
|
6
|
-
|
7
|
+
* Fix ReDoS in Accept header parsing
|
7
8
|
|
8
|
-
|
9
|
-
[CVE-2023-28362]
|
9
|
+
CVE-2024-26142
|
10
10
|
|
11
|
-
|
11
|
+
## Rails 7.1.3 (January 16, 2024) ##
|
12
12
|
|
13
|
-
|
13
|
+
* Fix including `Rails.application.routes.url_helpers` directly in an
|
14
|
+
`ActiveSupport::Concern.`
|
14
15
|
|
15
|
-
*
|
16
|
+
*Jonathan Hefner*
|
16
17
|
|
18
|
+
* Fix system tests when using a Chrome binary that has been downloaded by
|
19
|
+
Selenium.
|
17
20
|
|
18
|
-
|
21
|
+
*Jonathan Hefner*
|
19
22
|
|
20
|
-
* Fix `domain: :all` for two letter TLD
|
21
23
|
|
22
|
-
|
23
|
-
release when using `domain: :all` with a two letter but single level top
|
24
|
-
level domain domain (like `.ca`, rather than `.co.uk`).
|
24
|
+
## Rails 7.1.2 (November 10, 2023) ##
|
25
25
|
|
26
|
+
* Fix a race condition that could cause a `Text file busy - chromedriver`
|
27
|
+
error with parallel system tests
|
26
28
|
|
27
|
-
|
29
|
+
*Matt Brictson*
|
28
30
|
|
29
|
-
*
|
31
|
+
* Fix `StrongParameters#extract_value` to include blank values
|
30
32
|
|
31
|
-
|
33
|
+
Otherwise composite parameters may not be parsed correctly when one of the
|
34
|
+
component is blank.
|
32
35
|
|
33
|
-
*
|
36
|
+
*fatkodima*, *Yasha Krasnou*, *Matthias Eiglsperger*
|
34
37
|
|
35
|
-
|
38
|
+
* Add `racc` as a dependency since it will become a bundled gem in Ruby 3.4.0
|
36
39
|
|
40
|
+
*Hartley McGuire*
|
37
41
|
|
38
|
-
|
42
|
+
* Support handling Enumerator for non-buffered responses.
|
39
43
|
|
40
|
-
*
|
44
|
+
*Zachary Scott*
|
41
45
|
|
42
46
|
|
43
|
-
## Rails
|
47
|
+
## Rails 7.1.1 (October 11, 2023) ##
|
44
48
|
|
45
49
|
* No changes.
|
46
50
|
|
47
51
|
|
48
|
-
## Rails
|
52
|
+
## Rails 7.1.0 (October 05, 2023) ##
|
49
53
|
|
50
54
|
* No changes.
|
51
55
|
|
52
56
|
|
53
|
-
## Rails
|
57
|
+
## Rails 7.1.0.rc2 (October 01, 2023) ##
|
54
58
|
|
55
|
-
*
|
56
|
-
|
57
|
-
*Tim Wade*
|
58
|
-
|
59
|
-
## Rails 6.1.5 (March 09, 2022) ##
|
60
|
-
|
61
|
-
* Fix `content_security_policy` returning invalid directives.
|
62
|
-
|
63
|
-
Directives such as `self`, `unsafe-eval` and few others were not
|
64
|
-
single quoted when the directive was the result of calling a lambda
|
65
|
-
returning an array.
|
66
|
-
|
67
|
-
```ruby
|
68
|
-
content_security_policy do |policy|
|
69
|
-
policy.frame_ancestors lambda { [:self, "https://example.com"] }
|
70
|
-
end
|
71
|
-
```
|
72
|
-
|
73
|
-
With this fix the policy generated from above will now be valid.
|
74
|
-
|
75
|
-
*Edouard Chin*
|
76
|
-
|
77
|
-
* Update `HostAuthorization` middleware to render debug info only
|
78
|
-
when `config.consider_all_requests_local` is set to true.
|
79
|
-
|
80
|
-
Also, blocked host info is always logged with level `error`.
|
81
|
-
|
82
|
-
Fixes #42813.
|
83
|
-
|
84
|
-
*Nikita Vyrko*
|
85
|
-
|
86
|
-
* Dup arrays that get "converted".
|
87
|
-
|
88
|
-
Fixes #43681.
|
89
|
-
|
90
|
-
*Aaron Patterson*
|
59
|
+
* No changes.
|
91
60
|
|
92
|
-
* Don't show deprecation warning for equal paths.
|
93
61
|
|
94
|
-
|
62
|
+
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
95
63
|
|
96
|
-
*
|
64
|
+
* Add support for `#deep_merge` and `#deep_merge!` to
|
65
|
+
`ActionController::Parameters`.
|
97
66
|
|
98
|
-
|
67
|
+
*Sean Doyle*
|
99
68
|
|
100
|
-
*Alex Ghiculescu*
|
101
69
|
|
102
|
-
|
70
|
+
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
103
71
|
|
104
|
-
|
72
|
+
* `AbstractController::Translation.raise_on_missing_translations` removed
|
105
73
|
|
106
|
-
|
107
|
-
|
108
|
-
* Add more detail about what hosts are allowed.
|
74
|
+
This was a private API, and has been removed in favour of a more broadly applicable
|
75
|
+
`config.i18n.raise_on_missing_translations`. See the upgrading guide for more information.
|
109
76
|
|
110
77
|
*Alex Ghiculescu*
|
111
78
|
|
79
|
+
* Add `ActionController::Parameters#extract_value` method to allow extracting serialized values from params
|
112
80
|
|
113
|
-
|
114
|
-
|
115
|
-
|
81
|
+
```ruby
|
82
|
+
params = ActionController::Parameters.new(id: "1_123", tags: "ruby,rails")
|
83
|
+
params.extract_value(:id) # => ["1", "123"]
|
84
|
+
params.extract_value(:tags, delimiter: ",") # => ["ruby", "rails"]
|
85
|
+
```
|
116
86
|
|
87
|
+
*Nikita Vasilevsky*
|
117
88
|
|
118
|
-
|
89
|
+
* Parse JSON `response.parsed_body` with `ActiveSupport::HashWithIndifferentAccess`
|
119
90
|
|
120
|
-
|
91
|
+
Integrate with Minitest's new `assert_pattern` by parsing the JSON contents
|
92
|
+
of `response.parsed_body` with `ActiveSupport::HashWithIndifferentAccess`, so
|
93
|
+
that it's pattern-matching compatible.
|
121
94
|
|
95
|
+
*Sean Doyle*
|
122
96
|
|
123
|
-
|
97
|
+
* Add support for Playwright as a driver for system tests.
|
124
98
|
|
125
|
-
*
|
126
|
-
response body has been fully closed which result in request state not
|
127
|
-
being fully reset before the next request
|
99
|
+
*Yuki Nishijima*
|
128
100
|
|
129
|
-
|
101
|
+
* Fix `HostAuthorization` potentially displaying the value of the
|
102
|
+
X_FORWARDED_HOST header when the HTTP_HOST header is being blocked.
|
130
103
|
|
104
|
+
*Hartley McGuire*, *Daniel Schlosser*
|
131
105
|
|
132
|
-
|
106
|
+
* Rename `fixture_file_upload` method to `file_fixture_upload`
|
133
107
|
|
134
|
-
|
108
|
+
Declare an alias to preserve the backwards compatibility of `fixture_file_upload`
|
135
109
|
|
110
|
+
*Sean Doyle*
|
136
111
|
|
137
|
-
|
112
|
+
* `ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper` saves the screenshot path in test metadata on failure.
|
138
113
|
|
139
|
-
*
|
114
|
+
*Matija Čupić*
|
140
115
|
|
116
|
+
* `config.dom_testing_default_html_version` controls the HTML parser used by
|
117
|
+
`ActionDispatch::Assertions#html_document`.
|
141
118
|
|
142
|
-
|
119
|
+
The Rails 7.1 default configuration opts into the HTML5 parser when it is supported, to better
|
120
|
+
represent what the DOM would be in a browser user agent. Previously this test helper always used
|
121
|
+
Nokogiri's HTML4 parser.
|
143
122
|
|
144
|
-
*
|
123
|
+
*Mike Dalessio*
|
145
124
|
|
146
|
-
|
125
|
+
* The `with_routing` helper can now be called at the class level. When called at the class level, the routes will
|
126
|
+
be setup before each test, and reset after every test. For example:
|
147
127
|
|
148
|
-
|
128
|
+
```ruby
|
129
|
+
class RoutingTest < ActionController::TestCase
|
130
|
+
with_routing do |routes|
|
131
|
+
routes.draw do
|
132
|
+
resources :articles
|
133
|
+
resources :authors
|
134
|
+
end
|
135
|
+
end
|
149
136
|
|
150
|
-
|
151
|
-
|
152
|
-
|
137
|
+
def test_articles_route
|
138
|
+
assert_routing("/articles", controller: "articles", action: "index")
|
139
|
+
end
|
153
140
|
|
154
|
-
|
141
|
+
def test_authors_route
|
142
|
+
assert_routing("/authors", controller: "authors", action: "index")
|
143
|
+
end
|
144
|
+
end
|
145
|
+
```
|
155
146
|
|
156
|
-
*
|
147
|
+
*Andrew Novoselac*
|
157
148
|
|
158
|
-
|
149
|
+
* The `Mime::Type` now supports handling types with parameters and correctly handles quotes.
|
150
|
+
When parsing the accept header, the parameters before the q-parameter are kept and if a matching mime-type exists it is used.
|
151
|
+
To keep the current functionality, a fallback is created to look for the media-type without the parameters.
|
159
152
|
|
160
|
-
|
153
|
+
This change allows for custom MIME-types that are more complex like `application/vnd.api+json; profile="https://jsonapi.org/profiles/ethanresnick/cursor-pagination/" ext="https://jsonapi.org/ext/atomic"` for the [JSON API](https://jsonapi.org/).
|
161
154
|
|
162
|
-
*
|
155
|
+
*Nicolas Erni*
|
163
156
|
|
164
|
-
*
|
157
|
+
* The url_for helpers now support a new option called `path_params`.
|
158
|
+
This is very useful in situations where you only want to add a required param that is part of the route's URL but for other route not append an extraneous query param.
|
165
159
|
|
166
|
-
|
167
|
-
of the path as parameter for example:
|
160
|
+
Given the following router...
|
168
161
|
|
169
|
-
```
|
170
|
-
|
171
|
-
|
162
|
+
```ruby
|
163
|
+
Rails.application.routes.draw do
|
164
|
+
scope ":account_id" do
|
165
|
+
get "dashboard" => "pages#dashboard", as: :dashboard
|
166
|
+
get "search/:term" => "search#search", as: :search
|
167
|
+
end
|
168
|
+
delete "signout" => "sessions#destroy", as: :signout
|
169
|
+
end
|
172
170
|
```
|
173
171
|
|
174
|
-
|
172
|
+
And given the following `ApplicationController`
|
175
173
|
|
174
|
+
```ruby
|
175
|
+
class ApplicationController < ActionController::Base
|
176
|
+
def default_url_options
|
177
|
+
{ path_params: { account_id: "foo" } }
|
178
|
+
end
|
179
|
+
end
|
176
180
|
```
|
177
|
-
get '(this/:my_bool)/that' as: :that
|
178
|
-
|
179
|
-
that_path(my_bool: true) # => `/this/true/that`
|
180
|
-
that_path(my_bool: false) # => `/this/false/that`
|
181
|
-
```
|
182
|
-
|
183
|
-
*Adam Hess*
|
184
|
-
|
185
|
-
* Add support for 'private, no-store' Cache-Control headers.
|
186
|
-
|
187
|
-
Previously, 'no-store' was exclusive; no other directives could be specified.
|
188
|
-
|
189
|
-
*Alex Smith*
|
190
|
-
|
191
|
-
|
192
|
-
## Rails 6.1.3.2 (May 05, 2021) ##
|
193
|
-
|
194
|
-
* Prevent open redirects by correctly escaping the host allow list
|
195
|
-
CVE-2021-22903
|
196
|
-
|
197
|
-
* Prevent catastrophic backtracking during mime parsing
|
198
|
-
CVE-2021-22902
|
199
|
-
|
200
|
-
* Prevent regex DoS in HTTP token authentication
|
201
|
-
CVE-2021-22904
|
202
|
-
|
203
|
-
* Prevent string polymorphic route arguments.
|
204
|
-
|
205
|
-
`url_for` supports building polymorphic URLs via an array
|
206
|
-
of arguments (usually symbols and records). If a developer passes a
|
207
|
-
user input array, strings can result in unwanted route helper calls.
|
208
|
-
|
209
|
-
CVE-2021-22885
|
210
|
-
|
211
|
-
*Gannon McGibbon*
|
212
|
-
|
213
|
-
## Rails 6.1.3.1 (March 26, 2021) ##
|
214
|
-
|
215
|
-
* No changes.
|
216
|
-
|
217
|
-
|
218
|
-
## Rails 6.1.3 (February 17, 2021) ##
|
219
|
-
|
220
|
-
* Re-define routes when not set correctly via inheritance.
|
221
|
-
|
222
|
-
*John Hawthorn*
|
223
|
-
|
224
|
-
|
225
|
-
## Rails 6.1.2.1 (February 10, 2021) ##
|
226
|
-
|
227
|
-
* Prevent open redirect when allowed host starts with a dot
|
228
181
|
|
229
|
-
|
182
|
+
The standard url_for helper and friends will now behave as follows:
|
230
183
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
*Aaron Patterson*
|
235
|
-
|
236
|
-
|
237
|
-
## Rails 6.1.2 (February 09, 2021) ##
|
184
|
+
```ruby
|
185
|
+
dashboard_path # => /foo/dashboard
|
186
|
+
dashboard_path(account_id: "bar") # => /bar/dashboard
|
238
187
|
|
239
|
-
|
188
|
+
signout_path # => /signout
|
189
|
+
signout_path(account_id: "bar") # => /signout?account_id=bar
|
190
|
+
signout_path(account_id: "bar", path_params: { account_id: "baz" }) # => /signout?account_id=bar
|
191
|
+
search_path("quin") # => /foo/search/quin
|
192
|
+
```
|
240
193
|
|
241
|
-
*
|
194
|
+
*Jason Meller, Jeremy Beker*
|
242
195
|
|
243
|
-
*
|
196
|
+
* Change `action_dispatch.show_exceptions` to one of `:all`, `:rescuable`, or
|
197
|
+
`:none`. `:all` and `:none` behave the same as the previous `true` and
|
198
|
+
`false` respectively. The new `:rescuable` option will only show exceptions
|
199
|
+
that can be rescued (e.g. `ActiveRecord::RecordNotFound`). `:rescuable` is
|
200
|
+
now the default for the test environment.
|
244
201
|
|
245
|
-
*
|
202
|
+
*Jon Dufresne*
|
246
203
|
|
204
|
+
* `config.action_dispatch.cookies_serializer` now accepts `:message_pack` and
|
205
|
+
`:message_pack_allow_marshal` as serializers. These serializers require the
|
206
|
+
[`msgpack` gem](https://rubygems.org/gems/msgpack) (>= 1.7.0).
|
247
207
|
|
248
|
-
|
208
|
+
The Message Pack format can provide improved performance and smaller payload
|
209
|
+
sizes. It also supports roundtripping some Ruby types that are not supported
|
210
|
+
by JSON. For example:
|
249
211
|
|
250
|
-
|
212
|
+
```ruby
|
213
|
+
cookies.encrypted[:foo] = [{ a: 1 }, { b: 2 }.with_indifferent_access, 1.to_d, Time.at(0, 123)]
|
251
214
|
|
252
|
-
|
215
|
+
# BEFORE with config.action_dispatch.cookies_serializer = :json
|
216
|
+
cookies.encrypted[:foo]
|
217
|
+
# => [{"a"=>1}, {"b"=>2}, "1.0", "1969-12-31T18:00:00.000-06:00"]
|
218
|
+
cookies.encrypted[:foo].map(&:class)
|
219
|
+
# => [Hash, Hash, String, String]
|
253
220
|
|
254
|
-
|
221
|
+
# AFTER with config.action_dispatch.cookies_serializer = :message_pack
|
222
|
+
cookies.encrypted[:foo]
|
223
|
+
# => [{:a=>1}, {"b"=>2}, 0.1e1, 1969-12-31 18:00:00.000123 -0600]
|
224
|
+
cookies.encrypted[:foo].map(&:class)
|
225
|
+
# => [Hash, ActiveSupport::HashWithIndifferentAccess, BigDecimal, Time]
|
226
|
+
```
|
255
227
|
|
256
|
-
|
228
|
+
The `:message_pack` serializer can fall back to deserializing with
|
229
|
+
`ActiveSupport::JSON` when necessary, and the `:message_pack_allow_marshal`
|
230
|
+
serializer can fall back to deserializing with `Marshal` as well as
|
231
|
+
`ActiveSupport::JSON`. Additionally, the `:marshal`, `:json`, and
|
232
|
+
`:json_allow_marshal` (AKA `:hybrid`) serializers can now fall back to
|
233
|
+
deserializing with `ActiveSupport::MessagePack` when necessary. These
|
234
|
+
behaviors ensure old cookies can still be read so that migration is easier.
|
257
235
|
|
258
|
-
*
|
236
|
+
*Jonathan Hefner*
|
259
237
|
|
260
|
-
|
238
|
+
* Remove leading dot from domains on cookies set with `domain: :all`, to meet RFC6265 requirements
|
261
239
|
|
240
|
+
*Gareth Adams*
|
262
241
|
|
263
|
-
|
242
|
+
* Include source location in routes extended view.
|
264
243
|
|
265
|
-
|
266
|
-
|
244
|
+
```bash
|
245
|
+
$ bin/rails routes --expanded
|
267
246
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
p.payment :self, "https://secure-example.com"
|
276
|
-
end
|
247
|
+
...
|
248
|
+
--[ Route 14 ]----------
|
249
|
+
Prefix | new_gist
|
250
|
+
Verb | GET
|
251
|
+
URI | /gist(.:format)
|
252
|
+
Controller#Action | gists/gists#new
|
253
|
+
Source Location | config/routes/gist.rb:3
|
277
254
|
```
|
278
255
|
|
279
|
-
*
|
280
|
-
|
281
|
-
* Allow `ActionDispatch::HostAuthorization` to exclude specific requests.
|
256
|
+
*Luan Vieira, John Hawthorn and Daniel Colson*
|
282
257
|
|
283
|
-
|
258
|
+
* Add `without` as an alias of `except` on `ActiveController::Parameters`.
|
284
259
|
|
285
|
-
*
|
260
|
+
*Hidde-Jan Jongsma*
|
286
261
|
|
287
|
-
*
|
288
|
-
the unique X-Request-Id header
|
262
|
+
* Expand search field on `rails/info/routes` to also search **route name**, **http verb** and **controller#action**.
|
289
263
|
|
290
|
-
*
|
264
|
+
*Jason Kotchoff*
|
291
265
|
|
292
|
-
*
|
266
|
+
* Remove deprecated `poltergeist` and `webkit` (capybara-webkit) driver registration for system testing.
|
293
267
|
|
294
268
|
*Rafael Mendonça França*
|
295
269
|
|
296
|
-
*
|
270
|
+
* Remove deprecated ability to assign a single value to `config.action_dispatch.trusted_proxies`.
|
297
271
|
|
298
272
|
*Rafael Mendonça França*
|
299
273
|
|
300
|
-
*
|
274
|
+
* Deprecate `config.action_dispatch.return_only_request_media_type_on_content_type`.
|
301
275
|
|
302
276
|
*Rafael Mendonça França*
|
303
277
|
|
304
|
-
*
|
278
|
+
* Remove deprecated behavior on `Request#content_type`.
|
305
279
|
|
306
|
-
|
280
|
+
*Rafael Mendonça França*
|
307
281
|
|
308
|
-
|
282
|
+
* Change `ActionController::Instrumentation` to pass `filtered_path` instead of `fullpath` in the event payload to filter sensitive query params
|
309
283
|
|
310
|
-
|
284
|
+
```ruby
|
285
|
+
get "/posts?password=test"
|
286
|
+
request.fullpath # => "/posts?password=test"
|
287
|
+
request.filtered_path # => "/posts?password=[FILTERED]"
|
288
|
+
```
|
311
289
|
|
312
|
-
|
313
|
-
`ActionDispatch::Http::Request#POST` prior to validating encoding.
|
290
|
+
*Ritikesh G*
|
314
291
|
|
315
|
-
|
292
|
+
* Deprecate `AbstractController::Helpers::MissingHelperError`
|
316
293
|
|
317
|
-
*
|
294
|
+
*Hartley McGuire*
|
318
295
|
|
319
|
-
|
296
|
+
* Change `ActionDispatch::Testing::TestResponse#parsed_body` to parse HTML as
|
297
|
+
a Nokogiri document
|
320
298
|
|
321
|
-
|
299
|
+
```ruby
|
300
|
+
get "/posts"
|
301
|
+
response.content_type # => "text/html; charset=utf-8"
|
302
|
+
response.parsed_body.class # => Nokogiri::HTML5::Document
|
303
|
+
response.parsed_body.to_html # => "<!DOCTYPE html>\n<html>\n..."
|
304
|
+
```
|
322
305
|
|
323
|
-
*
|
306
|
+
*Sean Doyle*
|
324
307
|
|
325
|
-
*
|
326
|
-
a 308 redirection.
|
308
|
+
* Deprecate `ActionDispatch::IllegalStateError`.
|
327
309
|
|
328
|
-
*
|
310
|
+
*Samuel Williams*
|
329
311
|
|
330
|
-
*
|
331
|
-
chosen only if it is equal to or is a superdomain of the request host.
|
312
|
+
* Add HTTP::Request#route_uri_pattern that returns URI pattern of matched route.
|
332
313
|
|
333
|
-
*
|
314
|
+
*Joel Hawksley*, *Kate Higa*
|
334
315
|
|
335
|
-
* `ActionDispatch::
|
316
|
+
* Add `ActionDispatch::AssumeSSL` middleware that can be turned on via `config.assume_ssl`.
|
317
|
+
It makes the application believe that all requests are arriving over SSL. This is useful
|
318
|
+
when proxying through a load balancer that terminates SSL, the forwarded request will appear
|
319
|
+
as though its HTTP instead of HTTPS to the application. This makes redirects and cookie
|
320
|
+
security target HTTP instead of HTTPS. This middleware makes the server assume that the
|
321
|
+
proxy already terminated SSL, and that the request really is HTTPS.
|
336
322
|
|
337
|
-
|
338
|
-
Brotli files are preferred due to much better compression.
|
323
|
+
*DHH*
|
339
324
|
|
340
|
-
|
341
|
-
we check for public/some.js.br and serve that file, if present, with
|
342
|
-
`Content-Encoding: br` and `Vary: Accept-Encoding` headers.
|
325
|
+
* Only use HostAuthorization middleware if `config.hosts` is not empty
|
343
326
|
|
344
|
-
*
|
327
|
+
*Hartley McGuire*
|
345
328
|
|
346
|
-
*
|
329
|
+
* Allow raising an error when a callback's only/unless symbols aren't existing methods.
|
347
330
|
|
348
|
-
|
349
|
-
It can be enabled through `config.i18n.raise_on_missing_translations`. Note that described
|
350
|
-
configuration also affects raising error for missing translations in views.
|
331
|
+
When `before_action :callback, only: :action_name` is declared on a controller that doesn't respond to `action_name`, raise an exception at request time. This is a safety measure to ensure that typos or forgetfulness don't prevent a crucial callback from being run when it should.
|
351
332
|
|
352
|
-
|
333
|
+
For new applications, raising an error for undefined actions is turned on by default. If you do not want to opt-in to this behavior set `config.action_controller.raise_on_missing_callback_actions` to `false` in your application configuration. See #43487 for more details.
|
353
334
|
|
354
|
-
*
|
335
|
+
*Jess Bees*
|
355
336
|
|
356
|
-
|
337
|
+
* Allow cookie options[:domain] to accept a proc to set the cookie domain on a more flexible per-request basis
|
357
338
|
|
358
|
-
*
|
359
|
-
without passing a block now returns an enumerator.
|
339
|
+
*RobL*
|
360
340
|
|
361
|
-
|
341
|
+
* When a host is not specified for an `ActionController::Renderer`'s env,
|
342
|
+
the host and related options will now be derived from the routes'
|
343
|
+
`default_url_options` and `ActionDispatch::Http::URL.secure_protocol`.
|
362
344
|
|
363
|
-
|
345
|
+
This means that for an application with a configuration like:
|
364
346
|
|
365
|
-
|
366
|
-
|
347
|
+
```ruby
|
348
|
+
Rails.application.default_url_options = { host: "rubyonrails.org" }
|
349
|
+
Rails.application.config.force_ssl = true
|
350
|
+
```
|
367
351
|
|
368
|
-
|
369
|
-
# Before
|
370
|
-
fixture_file_upload('files/dog.png')
|
352
|
+
rendering a URL like:
|
371
353
|
|
372
|
-
|
373
|
-
|
374
|
-
|
354
|
+
```ruby
|
355
|
+
ApplicationController.renderer.render inline: "<%= blog_url %>"
|
356
|
+
```
|
375
357
|
|
376
|
-
|
358
|
+
will now return `"https://rubyonrails.org/blog"` instead of
|
359
|
+
`"http://example.org/blog"`.
|
377
360
|
|
378
|
-
*
|
361
|
+
*Jonathan Hefner*
|
379
362
|
|
380
|
-
|
363
|
+
* Add details of cookie name and size to `CookieOverflow` exception.
|
381
364
|
|
382
|
-
*
|
383
|
-
strings/symbols with `String#constantize` instead of `require_dependency`.
|
365
|
+
*Andy Waite*
|
384
366
|
|
385
|
-
|
386
|
-
always pass a module object:
|
367
|
+
* Don't double log the `controller`, `action`, or `namespaced_controller` when using `ActiveRecord::QueryLog`
|
387
368
|
|
388
|
-
|
389
|
-
|
390
|
-
|
369
|
+
Previously if you set `config.active_record.query_log_tags` to an array that included
|
370
|
+
`:controller`, `:namespaced_controller`, or `:action`, that item would get logged twice.
|
371
|
+
This bug has been fixed.
|
391
372
|
|
392
|
-
|
393
|
-
is received, `helper` just manipulates and inflects the argument to obtain
|
394
|
-
that same module object.
|
373
|
+
*Alex Ghiculescu*
|
395
374
|
|
396
|
-
|
375
|
+
* Add the following permissions policy directives: `hid`, `idle-detection`, `screen-wake-lock`,
|
376
|
+
`serial`, `sync-xhr`, `web-share`.
|
397
377
|
|
398
|
-
*
|
378
|
+
*Guillaume Cabanel*
|
399
379
|
|
400
|
-
|
380
|
+
* The `speaker`, `vibrate`, and `vr` permissions policy directives are now
|
381
|
+
deprecated.
|
401
382
|
|
402
|
-
|
403
|
-
|
383
|
+
There is no browser support for these directives, and no plan for browser
|
384
|
+
support in the future. You can just remove these directives from your
|
385
|
+
application.
|
404
386
|
|
405
387
|
*Jonathan Hefner*
|
406
388
|
|
407
|
-
*
|
408
|
-
|
409
|
-
|
410
|
-
them difficult to deal with. For example, the common practice of sending
|
411
|
-
the CSRF token to a browser in a client-readable cookie does not work properly
|
412
|
-
out of the box: the value has to be url-encoded and decoded to survive transport.
|
413
|
-
|
414
|
-
Now, we generate Base64 urlsafe-encoded CSRF tokens, which are inherently safe
|
415
|
-
to transport. Validation accepts both urlsafe tokens, and strict-encoded tokens
|
416
|
-
for backwards compatibility.
|
417
|
-
|
418
|
-
*Scott Blum*
|
419
|
-
|
420
|
-
* Support rolling deploys for cookie serialization/encryption changes.
|
421
|
-
|
422
|
-
In a distributed configuration like rolling update, users may observe
|
423
|
-
both old and new instances during deployment. Users may be served by a
|
424
|
-
new instance and then by an old instance.
|
389
|
+
* Added the `:status` option to `assert_redirected_to` to specify the precise
|
390
|
+
HTTP status of the redirect. Defaults to `:redirect` for backwards
|
391
|
+
compatibility.
|
425
392
|
|
426
|
-
|
427
|
-
to `:hybrid` or the server changes `use_authenticated_cookie_encryption`
|
428
|
-
from `false` to `true`, users may lose their sessions if they access the
|
429
|
-
server during deployment.
|
393
|
+
*Jon Dufresne*
|
430
394
|
|
431
|
-
|
432
|
-
deployment, ensuring compatibility on both old and new instances.
|
395
|
+
* Rescue `JSON::ParserError` in Cookies JSON deserializer to discards marshal dumps:
|
433
396
|
|
434
|
-
|
397
|
+
Without this change, if `action_dispatch.cookies_serializer` is set to `:json` and
|
398
|
+
the app tries to read a `:marshal` serialized cookie, it would error out which wouldn't
|
399
|
+
clear the cookie and force app users to manually clear it in their browser.
|
435
400
|
|
436
|
-
|
401
|
+
(See #45127 for original bug discussion)
|
437
402
|
|
438
|
-
|
439
|
-
Now, the furthest proxy site is used. e.g.: It now gives an ip address when using curl from the load balancer.
|
403
|
+
*Nathan Bardoux*
|
440
404
|
|
441
|
-
|
405
|
+
* Add `HTTP_REFERER` when following redirects on integration tests
|
442
406
|
|
443
|
-
|
407
|
+
This makes `follow_redirect!` a closer simulation of what happens in a real browser
|
444
408
|
|
445
|
-
|
446
|
-
gem dalli to be updated as well.
|
409
|
+
*Felipe Sateler*
|
447
410
|
|
448
|
-
|
411
|
+
* Added `exclude?` method to `ActionController::Parameters`.
|
449
412
|
|
450
|
-
*
|
413
|
+
*Ian Neubert*
|
451
414
|
|
452
|
-
|
453
|
-
meant it had its own copy of `@assertions`. This prevented the assertions
|
454
|
-
from being correctly counted and reported.
|
415
|
+
* Rescue `EOFError` exception from `rack` on a multipart request.
|
455
416
|
|
456
|
-
|
457
|
-
root session.
|
417
|
+
*Nikita Vasilevsky*
|
458
418
|
|
459
|
-
|
419
|
+
* Log redirects from routes the same way as redirects from controllers.
|
460
420
|
|
461
|
-
*
|
462
|
-
|
463
|
-
* Add SameSite protection to every written cookie.
|
421
|
+
*Dennis Paagman*
|
464
422
|
|
465
|
-
|
466
|
-
|
423
|
+
* Prevent `ActionDispatch::ServerTiming` from overwriting existing values in `Server-Timing`.
|
424
|
+
Previously, if another middleware down the chain set `Server-Timing` header,
|
425
|
+
it would overwritten by `ActionDispatch::ServerTiming`.
|
467
426
|
|
468
|
-
|
427
|
+
*Jakub Malinowski*
|
469
428
|
|
470
|
-
|
429
|
+
* Allow opting out of the `SameSite` cookie attribute when setting a cookie.
|
471
430
|
|
472
|
-
|
431
|
+
You can opt out of `SameSite` by passing `same_site: nil`.
|
473
432
|
|
474
|
-
|
433
|
+
`cookies[:foo] = { value: "bar", same_site: nil }`
|
475
434
|
|
476
|
-
|
435
|
+
Previously, this incorrectly set the `SameSite` attribute to the value of the `cookies_same_site_protection` setting.
|
477
436
|
|
478
|
-
*
|
437
|
+
*Alex Ghiculescu*
|
479
438
|
|
480
|
-
*
|
439
|
+
* Allow using `helper_method`s in `content_security_policy` and `permissions_policy`
|
481
440
|
|
482
|
-
|
483
|
-
|
484
|
-
that this wasn't fully the case and loading external route files from the router
|
485
|
-
can be helpful for applications with a really large set of routes.
|
486
|
-
Without this feature, application needs to implement routes reloading
|
487
|
-
themselves and it's not straightforward.
|
441
|
+
Previously you could access basic helpers (defined in helper modules), but not
|
442
|
+
helper methods defined using `helper_method`. Now you can use either.
|
488
443
|
|
489
444
|
```ruby
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
draw(:admin)
|
445
|
+
content_security_policy do |p|
|
446
|
+
p.default_src "https://example.com"
|
447
|
+
p.script_src "https://example.com" if helpers.script_csp?
|
494
448
|
end
|
495
|
-
|
496
|
-
# config/routes/admin.rb
|
497
|
-
|
498
|
-
get :foo, to: 'foo#bar'
|
499
449
|
```
|
500
450
|
|
501
|
-
*
|
451
|
+
*Alex Ghiculescu*
|
502
452
|
|
503
|
-
*
|
453
|
+
* Reimplement `ActionController::Parameters#has_value?` and `#value?` to avoid parameters and hashes comparison.
|
504
454
|
|
505
|
-
|
455
|
+
Deprecated equality between parameters and hashes is going to be removed in Rails 7.2.
|
456
|
+
The new implementation takes care of conversions.
|
506
457
|
|
507
|
-
*
|
508
|
-
their payloads as `:request`.
|
458
|
+
*Seva Stefkin*
|
509
459
|
|
510
|
-
|
460
|
+
* Allow only String and Symbol keys in `ActionController::Parameters`.
|
461
|
+
Raise `ActionController::InvalidParameterKey` when initializing Parameters
|
462
|
+
with keys that aren't strings or symbols.
|
511
463
|
|
512
|
-
*
|
513
|
-
request format but based on the block given.
|
464
|
+
*Seva Stefkin*
|
514
465
|
|
515
|
-
|
466
|
+
* Add the ability to use custom logic for storing and retrieving CSRF tokens.
|
516
467
|
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
format.any { render(json: { foo: 'bar' }) }
|
521
|
-
end
|
522
|
-
end
|
468
|
+
By default, the token will be stored in the session. Custom classes can be
|
469
|
+
defined to specify arbitrary behavior, but the ability to store them in
|
470
|
+
encrypted cookies is built in.
|
523
471
|
|
524
|
-
|
525
|
-
```
|
472
|
+
*Andrew Kowpak*
|
526
473
|
|
527
|
-
|
528
|
-
is inaccurate since a JSON response is being rendered.
|
474
|
+
* Make ActionController::Parameters#values cast nested hashes into parameters.
|
529
475
|
|
530
|
-
|
476
|
+
*Gannon McGibbon*
|
531
477
|
|
532
|
-
|
478
|
+
* Introduce `html:` and `screenshot:` kwargs for system test screenshot helper
|
533
479
|
|
534
|
-
|
480
|
+
Use these as an alternative to the already-available environment variables.
|
535
481
|
|
536
|
-
|
537
|
-
|
482
|
+
For example, this will display a screenshot in iTerm, save the HTML, and output
|
483
|
+
its path.
|
538
484
|
|
539
|
-
|
485
|
+
```ruby
|
486
|
+
take_screenshot(html: true, screenshot: "inline")
|
487
|
+
```
|
540
488
|
|
541
|
-
*
|
489
|
+
*Alex Ghiculescu*
|
542
490
|
|
543
|
-
|
491
|
+
* Allow `ActionController::Parameters#to_h` to receive a block.
|
544
492
|
|
545
|
-
*
|
493
|
+
*Bob Farrell*
|
546
494
|
|
547
|
-
|
548
|
-
* `:response` - the `ActionDispatch::Response`
|
495
|
+
* Allow relative redirects when `raise_on_open_redirects` is enabled
|
549
496
|
|
550
|
-
*
|
497
|
+
*Tom Hughes*
|
551
498
|
|
552
|
-
*
|
553
|
-
`remote_ip` to `nil` before setting the header that the value is derived
|
554
|
-
from.
|
499
|
+
* Allow Content Security Policy DSL to generate for API responses.
|
555
500
|
|
556
|
-
|
501
|
+
*Tim Wade*
|
557
502
|
|
558
|
-
|
503
|
+
* Fix `authenticate_with_http_basic` to allow for missing password.
|
559
504
|
|
560
|
-
|
505
|
+
Before Rails 7.0 it was possible to handle basic authentication with only a username.
|
561
506
|
|
562
507
|
```ruby
|
563
|
-
|
564
|
-
|
565
|
-
log_at :debug, if: -> { cookies[:debug] }
|
508
|
+
authenticate_with_http_basic do |token, _|
|
509
|
+
ApiClient.authenticate(token)
|
566
510
|
end
|
567
511
|
```
|
568
512
|
|
569
|
-
|
513
|
+
This ability is restored.
|
570
514
|
|
571
|
-
*
|
572
|
-
a test by prefixing the file name with an incrementing counter.
|
515
|
+
*Jean Boussier*
|
573
516
|
|
574
|
-
|
575
|
-
enable saving of HTML during a screenshot in addition to the image.
|
576
|
-
This uses the same image name, with the extension replaced with `.html`
|
577
|
-
|
578
|
-
*Tom Fakes*
|
579
|
-
|
580
|
-
* Add `Vary: Accept` header when using `Accept` header for response.
|
581
|
-
|
582
|
-
For some requests like `/users/1`, Rails uses requests' `Accept`
|
583
|
-
header to determine what to return. And if we don't add `Vary`
|
584
|
-
in the response header, browsers might accidentally cache different
|
585
|
-
types of content, which would cause issues: e.g. javascript got displayed
|
586
|
-
instead of html content. This PR fixes these issues by adding `Vary: Accept`
|
587
|
-
in these types of requests. For more detailed problem description, please read:
|
588
|
-
|
589
|
-
https://github.com/rails/rails/pull/36213
|
517
|
+
* Fix `content_security_policy` returning invalid directives.
|
590
518
|
|
591
|
-
|
519
|
+
Directives such as `self`, `unsafe-eval` and few others were not
|
520
|
+
single quoted when the directive was the result of calling a lambda
|
521
|
+
returning an array.
|
592
522
|
|
593
|
-
|
523
|
+
```ruby
|
524
|
+
content_security_policy do |policy|
|
525
|
+
policy.frame_ancestors lambda { [:self, "https://example.com"] }
|
526
|
+
end
|
527
|
+
```
|
594
528
|
|
595
|
-
|
596
|
-
a 307 redirection.
|
529
|
+
With this fix the policy generated from above will now be valid.
|
597
530
|
|
598
531
|
*Edouard Chin*
|
599
532
|
|
600
|
-
*
|
601
|
-
|
602
|
-
|
533
|
+
* Fix `skip_forgery_protection` to run without raising an error if forgery
|
534
|
+
protection has not been enabled / `verify_authenticity_token` is not a
|
535
|
+
defined callback.
|
603
536
|
|
604
|
-
|
537
|
+
This fix prevents the Rails 7.0 Welcome Page (`/`) from raising an
|
538
|
+
`ArgumentError` if `default_protect_from_forgery` is false.
|
605
539
|
|
606
|
-
*
|
540
|
+
*Brad Trick*
|
607
541
|
|
608
|
-
*
|
542
|
+
* Make `redirect_to` return an empty response body.
|
609
543
|
|
610
|
-
|
611
|
-
|
612
|
-
specification and guidelines can be found at MDN:
|
544
|
+
Application controllers that wish to add a response body after calling
|
545
|
+
`redirect_to` can continue to do so.
|
613
546
|
|
614
|
-
|
547
|
+
*Jon Dufresne*
|
615
548
|
|
616
|
-
|
549
|
+
* Use non-capturing group for subdomain matching in `ActionDispatch::HostAuthorization`
|
617
550
|
|
618
|
-
|
619
|
-
Rails.application.config.feature_policy do |f|
|
620
|
-
f.camera :none
|
621
|
-
f.gyroscope :none
|
622
|
-
f.microphone :none
|
623
|
-
f.usb :none
|
624
|
-
f.fullscreen :self
|
625
|
-
f.payment :self, "https://secure.example.com"
|
626
|
-
end
|
627
|
-
```
|
551
|
+
Since we do nothing with the captured subdomain group, we can use a non-capturing group instead.
|
628
552
|
|
629
|
-
|
630
|
-
|
631
|
-
```ruby
|
632
|
-
class PagesController < ApplicationController
|
633
|
-
feature_policy do |p|
|
634
|
-
p.geolocation "https://example.com"
|
635
|
-
end
|
636
|
-
end
|
637
|
-
```
|
553
|
+
*Sam Bostock*
|
638
554
|
|
639
|
-
|
555
|
+
* Fix `ActionController::Live` to copy the IsolatedExecutionState in the ephemeral thread.
|
640
556
|
|
641
|
-
|
557
|
+
Since its inception `ActionController::Live` has been copying thread local variables
|
558
|
+
to keep things such as `CurrentAttributes` set from middlewares working in the controller action.
|
642
559
|
|
643
|
-
|
560
|
+
With the introduction of `IsolatedExecutionState` in 7.0, some of that global state was lost in
|
561
|
+
`ActionController::Live` controllers.
|
644
562
|
|
645
|
-
*
|
563
|
+
*Jean Boussier*
|
646
564
|
|
647
|
-
*
|
565
|
+
* Fix setting `trailing_slash: true` in route definition.
|
648
566
|
|
649
|
-
|
650
|
-
|
651
|
-
ensures scope is kept both when the route takes parameters or when it
|
652
|
-
doesn't.
|
567
|
+
```ruby
|
568
|
+
get '/test' => "test#index", as: :test, trailing_slash: true
|
653
569
|
|
654
|
-
|
570
|
+
test_path() # => "/test/"
|
571
|
+
```
|
655
572
|
|
656
|
-
*
|
573
|
+
*Jean Boussier*
|
657
574
|
|
658
|
-
*
|
575
|
+
* Make `Session#merge!` stringify keys.
|
659
576
|
|
660
|
-
|
577
|
+
Previously `Session#update` would, but `merge!` wouldn't.
|
661
578
|
|
662
|
-
*
|
663
|
-
an enumerator for the parameters instead of the underlying hash.
|
579
|
+
*Drew Bragg*
|
664
580
|
|
665
|
-
|
581
|
+
* Add `:unsafe_hashes` mapping for `content_security_policy`
|
666
582
|
|
667
|
-
|
668
|
-
|
583
|
+
```ruby
|
584
|
+
# Before
|
585
|
+
policy.script_src :strict_dynamic, "'unsafe-hashes'", "'sha256-rRMdkshZyJlCmDX27XnL7g3zXaxv7ei6Sg+yt4R3svU='"
|
669
586
|
|
670
|
-
|
587
|
+
# After
|
588
|
+
policy.script_src :strict_dynamic, :unsafe_hashes, "'sha256-rRMdkshZyJlCmDX27XnL7g3zXaxv7ei6Sg+yt4R3svU='"
|
589
|
+
```
|
671
590
|
|
591
|
+
*Igor Morozov*
|
672
592
|
|
673
|
-
Please check [
|
593
|
+
Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionpack/CHANGELOG.md) for previous changes.
|