actionpack 6.1.7.5 → 7.1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +355 -435
  3. data/MIT-LICENSE +2 -1
  4. data/README.rdoc +6 -7
  5. data/lib/abstract_controller/asset_paths.rb +1 -1
  6. data/lib/abstract_controller/base.rb +33 -37
  7. data/lib/abstract_controller/caching/fragments.rb +4 -2
  8. data/lib/abstract_controller/caching.rb +1 -1
  9. data/lib/abstract_controller/callbacks.rb +50 -11
  10. data/lib/abstract_controller/collector.rb +2 -2
  11. data/lib/abstract_controller/deprecator.rb +7 -0
  12. data/lib/abstract_controller/error.rb +1 -1
  13. data/lib/abstract_controller/helpers.rb +78 -30
  14. data/lib/abstract_controller/logger.rb +1 -1
  15. data/lib/abstract_controller/railties/routes_helpers.rb +3 -16
  16. data/lib/abstract_controller/rendering.rb +12 -14
  17. data/lib/abstract_controller/translation.rb +26 -7
  18. data/lib/abstract_controller/url_for.rb +6 -6
  19. data/lib/abstract_controller.rb +6 -0
  20. data/lib/action_controller/api.rb +12 -10
  21. data/lib/action_controller/base.rb +8 -21
  22. data/lib/action_controller/caching.rb +2 -0
  23. data/lib/action_controller/deprecator.rb +7 -0
  24. data/lib/action_controller/form_builder.rb +4 -2
  25. data/lib/action_controller/log_subscriber.rb +20 -7
  26. data/lib/action_controller/metal/basic_implicit_render.rb +3 -1
  27. data/lib/action_controller/metal/conditional_get.rb +137 -102
  28. data/lib/action_controller/metal/content_security_policy.rb +37 -3
  29. data/lib/action_controller/metal/cookies.rb +1 -1
  30. data/lib/action_controller/metal/data_streaming.rb +25 -31
  31. data/lib/action_controller/metal/default_headers.rb +2 -0
  32. data/lib/action_controller/metal/etag_with_flash.rb +3 -1
  33. data/lib/action_controller/metal/etag_with_template_digest.rb +2 -0
  34. data/lib/action_controller/metal/exceptions.rb +27 -30
  35. data/lib/action_controller/metal/flash.rb +6 -2
  36. data/lib/action_controller/metal/head.rb +9 -7
  37. data/lib/action_controller/metal/helpers.rb +5 -16
  38. data/lib/action_controller/metal/http_authentication.rb +78 -42
  39. data/lib/action_controller/metal/implicit_render.rb +5 -3
  40. data/lib/action_controller/metal/instrumentation.rb +62 -50
  41. data/lib/action_controller/metal/live.rb +67 -2
  42. data/lib/action_controller/metal/mime_responds.rb +5 -5
  43. data/lib/action_controller/metal/params_wrapper.rb +24 -13
  44. data/lib/action_controller/metal/permissions_policy.rb +20 -29
  45. data/lib/action_controller/metal/redirecting.rb +96 -23
  46. data/lib/action_controller/metal/renderers.rb +14 -15
  47. data/lib/action_controller/metal/rendering.rb +121 -16
  48. data/lib/action_controller/metal/request_forgery_protection.rb +208 -68
  49. data/lib/action_controller/metal/rescue.rb +7 -4
  50. data/lib/action_controller/metal/streaming.rb +74 -36
  51. data/lib/action_controller/metal/strong_parameters.rb +254 -151
  52. data/lib/action_controller/metal/testing.rb +9 -2
  53. data/lib/action_controller/metal/url_for.rb +10 -5
  54. data/lib/action_controller/metal.rb +89 -34
  55. data/lib/action_controller/railtie.rb +66 -9
  56. data/lib/action_controller/renderer.rb +99 -85
  57. data/lib/action_controller/test_case.rb +42 -11
  58. data/lib/action_controller.rb +10 -6
  59. data/lib/action_dispatch/constants.rb +32 -0
  60. data/lib/action_dispatch/deprecator.rb +7 -0
  61. data/lib/action_dispatch/http/cache.rb +21 -16
  62. data/lib/action_dispatch/http/content_security_policy.rb +122 -44
  63. data/lib/action_dispatch/http/filter_parameters.rb +14 -23
  64. data/lib/action_dispatch/http/headers.rb +3 -1
  65. data/lib/action_dispatch/http/mime_negotiation.rb +25 -15
  66. data/lib/action_dispatch/http/mime_type.rb +43 -22
  67. data/lib/action_dispatch/http/mime_types.rb +3 -1
  68. data/lib/action_dispatch/http/parameters.rb +6 -6
  69. data/lib/action_dispatch/http/permissions_policy.rb +57 -19
  70. data/lib/action_dispatch/http/rack_cache.rb +2 -0
  71. data/lib/action_dispatch/http/request.rb +75 -51
  72. data/lib/action_dispatch/http/response.rb +81 -77
  73. data/lib/action_dispatch/http/upload.rb +15 -2
  74. data/lib/action_dispatch/http/url.rb +11 -19
  75. data/lib/action_dispatch/journey/formatter.rb +8 -2
  76. data/lib/action_dispatch/journey/gtg/builder.rb +11 -12
  77. data/lib/action_dispatch/journey/gtg/simulator.rb +10 -4
  78. data/lib/action_dispatch/journey/gtg/transition_table.rb +77 -21
  79. data/lib/action_dispatch/journey/nodes/node.rb +70 -5
  80. data/lib/action_dispatch/journey/path/pattern.rb +36 -27
  81. data/lib/action_dispatch/journey/route.rb +8 -14
  82. data/lib/action_dispatch/journey/router/utils.rb +2 -2
  83. data/lib/action_dispatch/journey/router.rb +10 -9
  84. data/lib/action_dispatch/journey/routes.rb +5 -5
  85. data/lib/action_dispatch/journey/visualizer/fsm.js +49 -24
  86. data/lib/action_dispatch/journey/visualizer/index.html.erb +1 -1
  87. data/lib/action_dispatch/log_subscriber.rb +23 -0
  88. data/lib/action_dispatch/middleware/actionable_exceptions.rb +5 -7
  89. data/lib/action_dispatch/middleware/assume_ssl.rb +24 -0
  90. data/lib/action_dispatch/middleware/callbacks.rb +2 -0
  91. data/lib/action_dispatch/middleware/cookies.rb +97 -107
  92. data/lib/action_dispatch/middleware/debug_exceptions.rb +31 -28
  93. data/lib/action_dispatch/middleware/debug_locks.rb +7 -4
  94. data/lib/action_dispatch/middleware/debug_view.rb +7 -2
  95. data/lib/action_dispatch/middleware/exception_wrapper.rb +190 -27
  96. data/lib/action_dispatch/middleware/executor.rb +3 -0
  97. data/lib/action_dispatch/middleware/flash.rb +24 -18
  98. data/lib/action_dispatch/middleware/host_authorization.rb +19 -20
  99. data/lib/action_dispatch/middleware/public_exceptions.rb +5 -3
  100. data/lib/action_dispatch/middleware/reloader.rb +7 -5
  101. data/lib/action_dispatch/middleware/remote_ip.rb +32 -19
  102. data/lib/action_dispatch/middleware/request_id.rb +5 -3
  103. data/lib/action_dispatch/middleware/server_timing.rb +76 -0
  104. data/lib/action_dispatch/middleware/session/abstract_store.rb +6 -1
  105. data/lib/action_dispatch/middleware/session/cache_store.rb +2 -0
  106. data/lib/action_dispatch/middleware/session/cookie_store.rb +19 -13
  107. data/lib/action_dispatch/middleware/session/mem_cache_store.rb +3 -1
  108. data/lib/action_dispatch/middleware/show_exceptions.rb +30 -25
  109. data/lib/action_dispatch/middleware/ssl.rb +18 -6
  110. data/lib/action_dispatch/middleware/stack.rb +34 -11
  111. data/lib/action_dispatch/middleware/static.rb +16 -16
  112. data/lib/action_dispatch/middleware/templates/rescues/_actions.html.erb +2 -2
  113. data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +5 -5
  114. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +4 -11
  115. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +8 -1
  116. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +2 -2
  117. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +10 -5
  118. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +7 -3
  119. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +9 -9
  120. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +2 -2
  121. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +3 -3
  122. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +45 -18
  123. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +19 -15
  124. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +4 -4
  125. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +6 -6
  126. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +7 -7
  127. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +4 -4
  128. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +1 -1
  129. data/lib/action_dispatch/middleware/templates/routes/_route.html.erb +3 -0
  130. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +64 -55
  131. data/lib/action_dispatch/railtie.rb +20 -4
  132. data/lib/action_dispatch/request/session.rb +59 -19
  133. data/lib/action_dispatch/request/utils.rb +8 -3
  134. data/lib/action_dispatch/routing/inspector.rb +55 -7
  135. data/lib/action_dispatch/routing/mapper.rb +117 -107
  136. data/lib/action_dispatch/routing/polymorphic_routes.rb +2 -0
  137. data/lib/action_dispatch/routing/redirection.rb +20 -8
  138. data/lib/action_dispatch/routing/route_set.rb +67 -27
  139. data/lib/action_dispatch/routing/routes_proxy.rb +11 -16
  140. data/lib/action_dispatch/routing/url_for.rb +29 -26
  141. data/lib/action_dispatch/routing.rb +12 -13
  142. data/lib/action_dispatch/system_test_case.rb +8 -8
  143. data/lib/action_dispatch/system_testing/browser.rb +20 -29
  144. data/lib/action_dispatch/system_testing/driver.rb +34 -18
  145. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +35 -20
  146. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +0 -8
  147. data/lib/action_dispatch/testing/assertion_response.rb +1 -1
  148. data/lib/action_dispatch/testing/assertions/response.rb +14 -7
  149. data/lib/action_dispatch/testing/assertions/routing.rb +70 -30
  150. data/lib/action_dispatch/testing/assertions.rb +3 -4
  151. data/lib/action_dispatch/testing/integration.rb +33 -25
  152. data/lib/action_dispatch/testing/request_encoder.rb +4 -1
  153. data/lib/action_dispatch/testing/test_process.rb +5 -30
  154. data/lib/action_dispatch/testing/test_request.rb +1 -1
  155. data/lib/action_dispatch/testing/test_response.rb +34 -2
  156. data/lib/action_dispatch.rb +38 -4
  157. data/lib/action_pack/gem_version.rb +4 -4
  158. data/lib/action_pack/version.rb +1 -1
  159. data/lib/action_pack.rb +1 -1
  160. metadata +67 -30
data/CHANGELOG.md CHANGED
@@ -1,673 +1,593 @@
1
- ## Rails 6.1.7.5 (August 22, 2023) ##
1
+ ## Rails 7.1.3.1 (February 21, 2024) ##
2
2
 
3
- * No changes.
3
+ * Fix possible XSS vulnerability with the `translate` method in controllers
4
4
 
5
+ CVE-2024-26143
5
6
 
6
- ## Rails 6.1.7.4 (June 26, 2023) ##
7
+ * Fix ReDoS in Accept header parsing
7
8
 
8
- * Raise an exception if illegal characters are provide to redirect_to
9
- [CVE-2023-28362]
9
+ CVE-2024-26142
10
10
 
11
- *Zack Deveau*
11
+ ## Rails 7.1.3 (January 16, 2024) ##
12
12
 
13
- ## Rails 6.1.7.3 (March 13, 2023) ##
13
+ * Fix including `Rails.application.routes.url_helpers` directly in an
14
+ `ActiveSupport::Concern.`
14
15
 
15
- * No changes.
16
+ *Jonathan Hefner*
16
17
 
18
+ * Fix system tests when using a Chrome binary that has been downloaded by
19
+ Selenium.
17
20
 
18
- ## Rails 6.1.7.2 (January 24, 2023) ##
21
+ *Jonathan Hefner*
19
22
 
20
- * Fix `domain: :all` for two letter TLD
21
23
 
22
- This fixes a compatibility issue introduced in our previous security
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
- ## Rails 6.1.7.1 (January 17, 2023) ##
29
+ *Matt Brictson*
28
30
 
29
- * Avoid regex backtracking on If-None-Match header
31
+ * Fix `StrongParameters#extract_value` to include blank values
30
32
 
31
- [CVE-2023-22795]
33
+ Otherwise composite parameters may not be parsed correctly when one of the
34
+ component is blank.
32
35
 
33
- * Use string#split instead of regex for domain parts
36
+ *fatkodima*, *Yasha Krasnou*, *Matthias Eiglsperger*
34
37
 
35
- [CVE-2023-22792]
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
- ## Rails 6.1.7 (September 09, 2022) ##
42
+ * Support handling Enumerator for non-buffered responses.
39
43
 
40
- * No changes.
44
+ *Zachary Scott*
41
45
 
42
46
 
43
- ## Rails 6.1.6.1 (July 12, 2022) ##
47
+ ## Rails 7.1.1 (October 11, 2023) ##
44
48
 
45
49
  * No changes.
46
50
 
47
51
 
48
- ## Rails 6.1.6 (May 09, 2022) ##
52
+ ## Rails 7.1.0 (October 05, 2023) ##
49
53
 
50
54
  * No changes.
51
55
 
52
56
 
53
- ## Rails 6.1.5.1 (April 26, 2022) ##
57
+ ## Rails 7.1.0.rc2 (October 01, 2023) ##
54
58
 
55
- * Allow Content Security Policy DSL to generate for API responses.
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
- *Anton Rieder*
62
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
95
63
 
96
- * Fix crash in `ActionController::Instrumentation` with invalid HTTP formats.
64
+ * Add support for `#deep_merge` and `#deep_merge!` to
65
+ `ActionController::Parameters`.
97
66
 
98
- Fixes #43094.
67
+ *Sean Doyle*
99
68
 
100
- *Alex Ghiculescu*
101
69
 
102
- * Add fallback host for SystemTestCase driven by RackTest.
70
+ ## Rails 7.1.0.beta1 (September 13, 2023) ##
103
71
 
104
- Fixes #42780.
72
+ * `AbstractController::Translation.raise_on_missing_translations` removed
105
73
 
106
- *Petrik de Heus*
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
- ## Rails 6.1.4.7 (March 08, 2022) ##
114
-
115
- * No changes.
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
- ## Rails 6.1.4.6 (February 11, 2022) ##
89
+ * Parse JSON `response.parsed_body` with `ActiveSupport::HashWithIndifferentAccess`
119
90
 
120
- * No changes.
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
- ## Rails 6.1.4.5 (February 11, 2022) ##
97
+ * Add support for Playwright as a driver for system tests.
124
98
 
125
- * Under certain circumstances, the middleware isn't informed that the
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
- [CVE-2022-23633]
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
- ## Rails 6.1.4.4 (December 15, 2021) ##
106
+ * Rename `fixture_file_upload` method to `file_fixture_upload`
133
107
 
134
- * Fix issue with host protection not allowing host with port in development.
108
+ Declare an alias to preserve the backwards compatibility of `fixture_file_upload`
135
109
 
110
+ *Sean Doyle*
136
111
 
137
- ## Rails 6.1.4.3 (December 14, 2021) ##
112
+ * `ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper` saves the screenshot path in test metadata on failure.
138
113
 
139
- * Fix issue with host protection not allowing localhost in development.
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
- ## Rails 6.1.4.2 (December 14, 2021) ##
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
- * Fix X_FORWARDED_HOST protection. [CVE-2021-44528]
123
+ *Mike Dalessio*
145
124
 
146
- ## Rails 6.1.4.1 (August 19, 2021) ##
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
- * [CVE-2021-22942] Fix possible open redirect in Host Authorization middleware.
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
- Specially crafted "X-Forwarded-Host" headers in combination with certain
151
- "allowed host" formats can cause the Host Authorization middleware in Action
152
- Pack to redirect users to a malicious website.
137
+ def test_articles_route
138
+ assert_routing("/articles", controller: "articles", action: "index")
139
+ end
153
140
 
154
- ## Rails 6.1.4 (June 24, 2021) ##
141
+ def test_authors_route
142
+ assert_routing("/authors", controller: "authors", action: "index")
143
+ end
144
+ end
145
+ ```
155
146
 
156
- * Ignore file fixtures on `db:fixtures:load`
147
+ *Andrew Novoselac*
157
148
 
158
- *Kevin Sjöberg*
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
- * Fix ActionController::Live controller test deadlocks by removing the body buffer size limit for tests.
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
- *Dylan Thacker-Smith*
155
+ *Nicolas Erni*
163
156
 
164
- * Correctly place optional path parameter booleans.
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
- Previously, if you specify a url parameter that is part of the path as false it would include that part
167
- of the path as parameter for example:
160
+ Given the following router...
168
161
 
169
- ```
170
- get "(/optional/:optional_id)/things" => "foo#foo", as: :things
171
- things_path(optional_id: false) # => /things?optional_id=false
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
- After this change, true and false will be treated the same when used as optional path parameters. Meaning now:
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
- [CVE-2021-22881]
182
+ The standard url_for helper and friends will now behave as follows:
230
183
 
231
- Thanks to @tktech (https://hackerone.com/tktech) for reporting this
232
- issue and the patch!
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
- * Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
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
- *Janko Marohnić*
194
+ *Jason Meller, Jeremy Beker*
242
195
 
243
- * Fix `fixture_file_upload` deprecation when `file_fixture_path` is a relative path.
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
- *Eugene Kenny*
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
- ## Rails 6.1.1 (January 07, 2021) ##
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
- * Fix nil translation key lookup in controllers/
212
+ ```ruby
213
+ cookies.encrypted[:foo] = [{ a: 1 }, { b: 2 }.with_indifferent_access, 1.to_d, Time.at(0, 123)]
251
214
 
252
- *Jan Klimo*
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
- * Quietly handle unknown HTTP methods in Action Dispatch SSL middleware.
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
- *Alex Robbin*
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
- * Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
236
+ *Jonathan Hefner*
259
237
 
260
- *Alex Robbin*
238
+ * Remove leading dot from domains on cookies set with `domain: :all`, to meet RFC6265 requirements
261
239
 
240
+ *Gareth Adams*
262
241
 
263
- ## Rails 6.1.0 (December 09, 2020) ##
242
+ * Include source location in routes extended view.
264
243
 
265
- * Support for the HTTP header `Feature-Policy` has been revised to reflect
266
- 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).
244
+ ```bash
245
+ $ bin/rails routes --expanded
267
246
 
268
- ```ruby
269
- Rails.application.config.permissions_policy do |p|
270
- p.camera :none
271
- p.gyroscope :none
272
- p.microphone :none
273
- p.usb :none
274
- p.fullscreen :self
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
- *Julien Grillot*
280
-
281
- * Allow `ActionDispatch::HostAuthorization` to exclude specific requests.
256
+ *Luan Vieira, John Hawthorn and Daniel Colson*
282
257
 
283
- 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.
258
+ * Add `without` as an alias of `except` on `ActiveController::Parameters`.
284
259
 
285
- *Chris Bisnett*
260
+ *Hidde-Jan Jongsma*
286
261
 
287
- * Add `config.action_dispatch.request_id_header` to allow changing the name of
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
- *Arlston Fernandes*
264
+ *Jason Kotchoff*
291
265
 
292
- * Deprecate `config.action_dispatch.return_only_media_type_on_content_type`.
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
- * Change `ActionDispatch::Response#content_type` to return the full Content-Type header.
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
- * Remove deprecated `ActionDispatch::Http::ParameterFilter`.
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
- * Added support for exclusive no-store Cache-Control header.
278
+ * Remove deprecated behavior on `Request#content_type`.
305
279
 
306
- If `no-store` is set on Cache-Control header it is exclusive (all other cache directives are dropped).
280
+ *Rafael Mendonça França*
307
281
 
308
- *Chris Kruger*
282
+ * Change `ActionController::Instrumentation` to pass `filtered_path` instead of `fullpath` in the event payload to filter sensitive query params
309
283
 
310
- * Catch invalid UTF-8 parameters for POST requests and respond with BadRequest.
284
+ ```ruby
285
+ get "/posts?password=test"
286
+ request.fullpath # => "/posts?password=test"
287
+ request.filtered_path # => "/posts?password=[FILTERED]"
288
+ ```
311
289
 
312
- Additionally, perform `#set_binary_encoding` in `ActionDispatch::Http::Request#GET` and
313
- `ActionDispatch::Http::Request#POST` prior to validating encoding.
290
+ *Ritikesh G*
314
291
 
315
- *Adrianna Chang*
292
+ * Deprecate `AbstractController::Helpers::MissingHelperError`
316
293
 
317
- * Allow `assert_recognizes` routing assertions to work on mounted root routes.
294
+ *Hartley McGuire*
318
295
 
319
- *Gannon McGibbon*
296
+ * Change `ActionDispatch::Testing::TestResponse#parsed_body` to parse HTML as
297
+ a Nokogiri document
320
298
 
321
- * Change default redirection status code for non-GET/HEAD requests to 308 Permanent Redirect for `ActionDispatch::SSL`.
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
- *Alan Tan*, *Oz Ben-David*
306
+ *Sean Doyle*
324
307
 
325
- * Fix `follow_redirect!` to follow redirection with same HTTP verb when following
326
- a 308 redirection.
308
+ * Deprecate `ActionDispatch::IllegalStateError`.
327
309
 
328
- *Alan Tan*
310
+ *Samuel Williams*
329
311
 
330
- * When multiple domains are specified for a cookie, a domain will now be
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
- *Jonathan Hefner*
314
+ *Joel Hawksley*, *Kate Higa*
334
315
 
335
- * `ActionDispatch::Static` handles precompiled Brotli (.br) files.
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
- Adds to existing support for precompiled gzip (.gz) files.
338
- Brotli files are preferred due to much better compression.
323
+ *DHH*
339
324
 
340
- When the browser requests /some.js with `Accept-Encoding: br`,
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
- *Ryan Edward Hall*, *Jeremy Daer*
327
+ *Hartley McGuire*
345
328
 
346
- * Add raise_on_missing_translations support for controllers.
329
+ * Allow raising an error when a callback's only/unless symbols aren't existing methods.
347
330
 
348
- This configuration determines whether an error should be raised for missing translations.
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
- *fatkodima*
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
- * Added `compact` and `compact!` to `ActionController::Parameters`.
335
+ *Jess Bees*
355
336
 
356
- *Eugene Kenny*
337
+ * Allow cookie options[:domain] to accept a proc to set the cookie domain on a more flexible per-request basis
357
338
 
358
- * Calling `each_pair` or `each_value` on an `ActionController::Parameters`
359
- without passing a block now returns an enumerator.
339
+ *RobL*
360
340
 
361
- *Eugene Kenny*
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
- * `fixture_file_upload` now uses path relative to `file_fixture_path`
345
+ This means that for an application with a configuration like:
364
346
 
365
- Previously the path had to be relative to `fixture_path`.
366
- You can change your existing code as follow:
347
+ ```ruby
348
+ Rails.application.default_url_options = { host: "rubyonrails.org" }
349
+ Rails.application.config.force_ssl = true
350
+ ```
367
351
 
368
- ```ruby
369
- # Before
370
- fixture_file_upload('files/dog.png')
352
+ rendering a URL like:
371
353
 
372
- # After
373
- fixture_file_upload('dog.png')
374
- ```
354
+ ```ruby
355
+ ApplicationController.renderer.render inline: "<%= blog_url %>"
356
+ ```
375
357
 
376
- *Edouard Chin*
358
+ will now return `"https://rubyonrails.org/blog"` instead of
359
+ `"http://example.org/blog"`.
377
360
 
378
- * Remove deprecated `force_ssl` at the controller level.
361
+ *Jonathan Hefner*
379
362
 
380
- *Rafael Mendonça França*
363
+ * Add details of cookie name and size to `CookieOverflow` exception.
381
364
 
382
- * The +helper+ class method for controllers loads helper modules specified as
383
- strings/symbols with `String#constantize` instead of `require_dependency`.
365
+ *Andy Waite*
384
366
 
385
- Remember that support for strings/symbols is only a convenient API. You can
386
- always pass a module object:
367
+ * Don't double log the `controller`, `action`, or `namespaced_controller` when using `ActiveRecord::QueryLog`
387
368
 
388
- ```ruby
389
- helper UtilsHelper
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
- which is recommended because it is simple and direct. When a string/symbol
393
- is received, `helper` just manipulates and inflects the argument to obtain
394
- that same module object.
373
+ *Alex Ghiculescu*
395
374
 
396
- *Xavier Noria*, *Jean Boussier*
375
+ * Add the following permissions policy directives: `hid`, `idle-detection`, `screen-wake-lock`,
376
+ `serial`, `sync-xhr`, `web-share`.
397
377
 
398
- * Correctly identify the entire localhost IPv4 range as trusted proxy.
378
+ *Guillaume Cabanel*
399
379
 
400
- *Nick Soracco*
380
+ * The `speaker`, `vibrate`, and `vr` permissions policy directives are now
381
+ deprecated.
401
382
 
402
- * `url_for` will now use "https://" as the default protocol when
403
- `Rails.application.config.force_ssl` is set to true.
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
- * Accept and default to base64_urlsafe CSRF tokens.
408
-
409
- Base64 strict-encoded CSRF tokens are not inherently websafe, which makes
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
- That means when the server changes `cookies_serializer` from `:marshal`
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
- We added fallbacks to downgrade the cookie format when necessary during
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
- *Masaki Hara*
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
- * `ActionDispatch::Request.remote_ip` has ip address even when all sites are trusted.
401
+ (See #45127 for original bug discussion)
437
402
 
438
- Before, if all `X-Forwarded-For` sites were trusted, the `remote_ip` would default to `127.0.0.1`.
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
- *Keenan Brock*
405
+ * Add `HTTP_REFERER` when following redirects on integration tests
442
406
 
443
- * Fix possible information leak / session hijacking vulnerability.
407
+ This makes `follow_redirect!` a closer simulation of what happens in a real browser
444
408
 
445
- The `ActionDispatch::Session::MemcacheStore` is still vulnerable given it requires the
446
- gem dalli to be updated as well.
409
+ *Felipe Sateler*
447
410
 
448
- CVE-2019-16782.
411
+ * Added `exclude?` method to `ActionController::Parameters`.
449
412
 
450
- * Include child session assertion count in ActionDispatch::IntegrationTest.
413
+ *Ian Neubert*
451
414
 
452
- `IntegrationTest#open_session` uses `dup` to create the new session, which
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
- Child sessions now have their `attr_accessor` overridden to delegate to the
457
- root session.
417
+ *Nikita Vasilevsky*
458
418
 
459
- Fixes #32142.
419
+ * Log redirects from routes the same way as redirects from controllers.
460
420
 
461
- *Sam Bostock*
462
-
463
- * Add SameSite protection to every written cookie.
421
+ *Dennis Paagman*
464
422
 
465
- Enabling `SameSite` cookie protection is an addition to CSRF protection,
466
- where cookies won't be sent by browsers in cross-site POST requests when set to `:lax`.
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
- `:strict` disables cookies being sent in cross-site GET or POST requests.
427
+ *Jakub Malinowski*
469
428
 
470
- Passing `:none` disables this protection and is the same as previous versions albeit a `; SameSite=None` is appended to the cookie.
429
+ * Allow opting out of the `SameSite` cookie attribute when setting a cookie.
471
430
 
472
- See upgrade instructions in config/initializers/new_framework_defaults_6_1.rb.
431
+ You can opt out of `SameSite` by passing `same_site: nil`.
473
432
 
474
- More info [here](https://tools.ietf.org/html/draft-west-first-party-cookies-07)
433
+ `cookies[:foo] = { value: "bar", same_site: nil }`
475
434
 
476
- _NB: Technically already possible as Rack supports SameSite protection, this is to ensure it's applied to all cookies_
435
+ Previously, this incorrectly set the `SameSite` attribute to the value of the `cookies_same_site_protection` setting.
477
436
 
478
- *Cédric Fabianski*
437
+ *Alex Ghiculescu*
479
438
 
480
- * Bring back the feature that allows loading external route files from the router.
439
+ * Allow using `helper_method`s in `content_security_policy` and `permissions_policy`
481
440
 
482
- This feature existed back in 2012 but got reverted with the incentive that
483
- https://github.com/rails/routing_concerns was a better approach. Turned out
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
- # config/routes.rb
491
-
492
- Rails.application.routes.draw do
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
- *Yehuda Katz*, *Edouard Chin*
451
+ *Alex Ghiculescu*
502
452
 
503
- * Fix system test driver option initialization for non-headless browsers.
453
+ * Reimplement `ActionController::Parameters#has_value?` and `#value?` to avoid parameters and hashes comparison.
504
454
 
505
- *glaszig*
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
- * `redirect_to.action_controller` notifications now include the `ActionDispatch::Request` in
508
- their payloads as `:request`.
458
+ *Seva Stefkin*
509
459
 
510
- *Austin Story*
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
- * `respond_to#any` no longer returns a response's Content-Type based on the
513
- request format but based on the block given.
464
+ *Seva Stefkin*
514
465
 
515
- Example:
466
+ * Add the ability to use custom logic for storing and retrieving CSRF tokens.
516
467
 
517
- ```ruby
518
- def my_action
519
- respond_to do |format|
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
- get('my_action.csv')
525
- ```
472
+ *Andrew Kowpak*
526
473
 
527
- The previous behaviour was to respond with a `text/csv` Content-Type which
528
- is inaccurate since a JSON response is being rendered.
474
+ * Make ActionController::Parameters#values cast nested hashes into parameters.
529
475
 
530
- Now it correctly returns a `application/json` Content-Type.
476
+ *Gannon McGibbon*
531
477
 
532
- *Edouard Chin*
478
+ * Introduce `html:` and `screenshot:` kwargs for system test screenshot helper
533
479
 
534
- * Replaces (back)slashes in failure screenshot image paths with dashes.
480
+ Use these as an alternative to the already-available environment variables.
535
481
 
536
- If a failed test case contained a slash or a backslash, a screenshot would be created in a
537
- nested directory, causing issues with `tmp:clear`.
482
+ For example, this will display a screenshot in iTerm, save the HTML, and output
483
+ its path.
538
484
 
539
- *Damir Zekic*
485
+ ```ruby
486
+ take_screenshot(html: true, screenshot: "inline")
487
+ ```
540
488
 
541
- * Add `params.member?` to mimic Hash behavior.
489
+ *Alex Ghiculescu*
542
490
 
543
- *Younes Serraj*
491
+ * Allow `ActionController::Parameters#to_h` to receive a block.
544
492
 
545
- * `process_action.action_controller` notifications now include the following in their payloads:
493
+ *Bob Farrell*
546
494
 
547
- * `:request` - the `ActionDispatch::Request`
548
- * `:response` - the `ActionDispatch::Response`
495
+ * Allow relative redirects when `raise_on_open_redirects` is enabled
549
496
 
550
- *George Claghorn*
497
+ *Tom Hughes*
551
498
 
552
- * Updated `ActionDispatch::Request.remote_ip` setter to clear set the instance
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
- Fixes #37383.
501
+ *Tim Wade*
557
502
 
558
- *Norm Provost*
503
+ * Fix `authenticate_with_http_basic` to allow for missing password.
559
504
 
560
- * `ActionController::Base.log_at` allows setting a different log level per request.
505
+ Before Rails 7.0 it was possible to handle basic authentication with only a username.
561
506
 
562
507
  ```ruby
563
- # Use the debug level if a particular cookie is set.
564
- class ApplicationController < ActionController::Base
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
- *George Claghorn*
513
+ This ability is restored.
570
514
 
571
- * Allow system test screen shots to be taken more than once in
572
- a test by prefixing the file name with an incrementing counter.
515
+ *Jean Boussier*
573
516
 
574
- Add an environment variable `RAILS_SYSTEM_TESTING_SCREENSHOT_HTML` to
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
- Fixes #25842.
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
- *Stan Lo*
523
+ ```ruby
524
+ content_security_policy do |policy|
525
+ policy.frame_ancestors lambda { [:self, "https://example.com"] }
526
+ end
527
+ ```
594
528
 
595
- * Fix IntegrationTest `follow_redirect!` to follow redirection using the same HTTP verb when following
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
- * System tests require Capybara 3.26 or newer.
601
-
602
- *George Claghorn*
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
- * Reduced log noise handling ActionController::RoutingErrors.
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
- *Alberto Fernández-Capel*
540
+ *Brad Trick*
607
541
 
608
- * Add DSL for configuring HTTP Feature Policy.
542
+ * Make `redirect_to` return an empty response body.
609
543
 
610
- This new DSL provides a way to configure an HTTP Feature Policy at a
611
- global or per-controller level. Full details of HTTP Feature Policy
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
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
547
+ *Jon Dufresne*
615
548
 
616
- Example global policy:
549
+ * Use non-capturing group for subdomain matching in `ActionDispatch::HostAuthorization`
617
550
 
618
- ```ruby
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
- Example controller level policy:
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
- *Jacob Bednarz*
555
+ * Fix `ActionController::Live` to copy the IsolatedExecutionState in the ephemeral thread.
640
556
 
641
- * Add the ability to set the CSP nonce only to the specified directives.
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
- Fixes #35137.
560
+ With the introduction of `IsolatedExecutionState` in 7.0, some of that global state was lost in
561
+ `ActionController::Live` controllers.
644
562
 
645
- *Yuji Yaginuma*
563
+ *Jean Boussier*
646
564
 
647
- * Keep part when scope option has value.
565
+ * Fix setting `trailing_slash: true` in route definition.
648
566
 
649
- When a route was defined within an optional scope, if that route didn't
650
- take parameters the scope was lost when using path helpers. This commit
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
- Fixes #33219.
570
+ test_path() # => "/test/"
571
+ ```
655
572
 
656
- *Alberto Almagro*
573
+ *Jean Boussier*
657
574
 
658
- * Added `deep_transform_keys` and `deep_transform_keys!` methods to ActionController::Parameters.
575
+ * Make `Session#merge!` stringify keys.
659
576
 
660
- *Gustavo Gutierrez*
577
+ Previously `Session#update` would, but `merge!` wouldn't.
661
578
 
662
- * Calling `ActionController::Parameters#transform_keys`/`!` without a block now returns
663
- an enumerator for the parameters instead of the underlying hash.
579
+ *Drew Bragg*
664
580
 
665
- *Eugene Kenny*
581
+ * Add `:unsafe_hashes` mapping for `content_security_policy`
666
582
 
667
- * Fix strong parameters blocks all attributes even when only some keys are invalid (non-numerical).
668
- It should only block invalid key's values instead.
583
+ ```ruby
584
+ # Before
585
+ policy.script_src :strict_dynamic, "'unsafe-hashes'", "'sha256-rRMdkshZyJlCmDX27XnL7g3zXaxv7ei6Sg+yt4R3svU='"
669
586
 
670
- *Stan Lo*
587
+ # After
588
+ policy.script_src :strict_dynamic, :unsafe_hashes, "'sha256-rRMdkshZyJlCmDX27XnL7g3zXaxv7ei6Sg+yt4R3svU='"
589
+ ```
671
590
 
591
+ *Igor Morozov*
672
592
 
673
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionpack/CHANGELOG.md) for previous changes.
593
+ Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionpack/CHANGELOG.md) for previous changes.