Skip to content

Commit 59e66f7

Browse files
Merge branch 'main' into browser-block-with-method-name
2 parents d21fb64 + ef679c4 commit 59e66f7

File tree

100 files changed

+562
-368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+562
-368
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ GEM
641641
websocket-extensions (0.1.5)
642642
xpath (3.2.0)
643643
nokogiri (~> 1.8)
644-
zeitwerk (2.6.12)
644+
zeitwerk (2.6.18)
645645

646646
PLATFORMS
647647
ruby

actioncable/test/channel/base_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def error_handler
109109
@connection.server.config.filter_parameters << :password
110110
data = { password: "password", foo: "foo" }
111111

112-
assert_logged(':password=>"[FILTERED]"') do
112+
assert_logged({ password: "[FILTERED]" }.inspect[1..-2]) do
113113
@channel.perform_action data
114114
end
115115
end

actionpack/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
*Sean Doyle*
1515

16-
* Raise an `ArgumentError` when invalid `:on` or `:except` options are passed into `#resource` and `#resources`.
16+
* Raise an `ArgumentError` when invalid `:only` or `:except` options are passed into `#resource` and `#resources`.
1717

1818
*Joshua Young*
1919

actionpack/lib/action_dispatch/http/content_security_policy.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
module ActionDispatch # :nodoc:
99
# # Action Dispatch Content Security Policy
1010
#
11-
# Configures the HTTP [Content-Security-Policy]
12-
# (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy)
11+
# Configures the HTTP [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy)
1312
# response header to help protect against XSS and
1413
# injection attacks.
1514
#
@@ -227,8 +226,7 @@ def plugin_types(*types)
227226
end
228227
end
229228

230-
# Enable the [report-uri]
231-
# (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri)
229+
# Enable the [report-uri](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri)
232230
# directive. Violation reports will be sent to the
233231
# specified URI:
234232
#
@@ -238,8 +236,7 @@ def report_uri(uri)
238236
@directives["report-uri"] = [uri]
239237
end
240238

241-
# Specify asset types for which [Subresource Integrity]
242-
# (https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) is required:
239+
# Specify asset types for which [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) is required:
243240
#
244241
# policy.require_sri_for :script, :style
245242
#
@@ -255,8 +252,7 @@ def require_sri_for(*types)
255252
end
256253
end
257254

258-
# Specify whether a [sandbox]
259-
# (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox)
255+
# Specify whether a [sandbox](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox)
260256
# should be enabled for the requested resource:
261257
#
262258
# policy.sandbox

actionpack/lib/action_dispatch/middleware/debug_view.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,12 @@ def initialize(assigns)
1515
paths = RESCUES_TEMPLATE_PATHS.dup
1616
lookup_context = ActionView::LookupContext.new(paths)
1717
super(lookup_context, assigns, nil)
18-
@exception_wrapper = assigns[:exception_wrapper]
1918
end
2019

2120
def compiled_method_container
2221
self.class
2322
end
2423

25-
def error_highlight_available?
26-
@exception_wrapper.error_highlight_available?
27-
end
28-
2924
def debug_params(params)
3025
clean_params = params.clone
3126
clean_params.delete("action")

actionpack/lib/action_dispatch/middleware/exception_wrapper.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,6 @@ def source_extracts
201201
end
202202
end
203203

204-
def error_highlight_available?
205-
# ErrorHighlight.spot with backtrace_location keyword is available since
206-
# error_highlight 0.4.0
207-
defined?(ErrorHighlight) && Gem::Version.new(ErrorHighlight::VERSION) >= Gem::Version.new("0.4.0")
208-
end
209-
210204
def trace_to_show
211205
if traces["Application Trace"].empty? && rescue_template != "routing_error"
212206
"Full Trace"

actionpack/lib/action_dispatch/middleware/templates/rescues/_source.html.erb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
</tr>
2929
</table>
3030
</div>
31-
<%- unless self.error_highlight_available? -%>
32-
<p class="error_highlight_tip">Tip: You may want to add <code>gem "error_highlight", "&gt;= 0.4.0"</code> into your Gemfile, which will display the fine-grained error location.</p>
33-
<%- end -%>
3431
</div>
3532
<% end %>
3633
<% end %>

actionpack/test/controller/log_subscriber_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def test_process_action_with_parameters
173173
wait
174174

175175
assert_equal 3, logs.size
176-
assert_equal 'Parameters: {"id"=>"10"}', logs[1]
176+
assert_equal "Parameters: #{{ "id" => "10" }}", logs[1]
177177
end
178178

179179
def test_multiple_process_with_parameters
@@ -183,8 +183,8 @@ def test_multiple_process_with_parameters
183183
wait
184184

185185
assert_equal 6, logs.size
186-
assert_equal 'Parameters: {"id"=>"10"}', logs[1]
187-
assert_equal 'Parameters: {"id"=>"20"}', logs[4]
186+
assert_equal "Parameters: #{{ "id" => "10" }}", logs[1]
187+
assert_equal "Parameters: #{{ "id" => "20" }}", logs[4]
188188
end
189189

190190
def test_process_action_with_wrapped_parameters
@@ -193,7 +193,7 @@ def test_process_action_with_wrapped_parameters
193193
wait
194194

195195
assert_equal 3, logs.size
196-
assert_match '"person"=>{"name"=>"jose"}', logs[1]
196+
assert_match({ "person" => { "name" => "jose" } }.inspect[1..-2], logs[1])
197197
end
198198

199199
def test_process_action_with_view_runtime
@@ -242,9 +242,9 @@ def test_process_action_with_filter_parameters
242242
wait
243243

244244
params = logs[1]
245-
assert_match(/"amount"=>"\[FILTERED\]"/, params)
246-
assert_match(/"lifo"=>"\[FILTERED\]"/, params)
247-
assert_match(/"step"=>"1"/, params)
245+
assert_match({ "amount" => "[FILTERED]" }.inspect[1..-2], params)
246+
assert_match({ "lifo" => "[FILTERED]" }.inspect[1..-2], params)
247+
assert_match({ "step" => "1" }.inspect[1..-2], params)
248248
end
249249

250250
def test_redirect_to

actionpack/test/controller/parameters/accessors_test.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
4949
end
5050

5151
test "to_s returns the string representation of the parameters hash" do
52-
assert_equal '{"person"=>{"age"=>"32", "name"=>{"first"=>"David", "last"=>"Heinemeier Hansson"}, ' \
53-
'"addresses"=>[{"city"=>"Chicago", "state"=>"Illinois"}]}}', @params.to_s
52+
assert_equal({ "person" => { "age" => "32", "name" => { "first" => "David", "last" => "Heinemeier Hansson" },
53+
"addresses" => [{ "city" => "Chicago", "state" => "Illinois" }] } }.inspect, @params.to_s)
5454
end
5555

5656
test "each carries permitted status" do
@@ -387,10 +387,19 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
387387
end
388388

389389
test "inspect shows both class name, parameters and permitted flag" do
390+
hash = {
391+
"person" => {
392+
"age" => "32",
393+
"name" => {
394+
"first" => "David",
395+
"last" => "Heinemeier Hansson"
396+
},
397+
"addresses" => [{ "city" => "Chicago", "state" => "Illinois" }]
398+
},
399+
}
400+
390401
assert_equal(
391-
'#<ActionController::Parameters {"person"=>{"age"=>"32", '\
392-
'"name"=>{"first"=>"David", "last"=>"Heinemeier Hansson"}, ' \
393-
'"addresses"=>[{"city"=>"Chicago", "state"=>"Illinois"}]}} permitted: false>',
402+
"#<ActionController::Parameters #{hash} permitted: false>",
394403
@params.inspect
395404
)
396405
end

actionpack/test/dispatch/debug_exceptions_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ def self.build_app(app, *args)
394394
get "/", params: { "foo" => "bar" }, headers: { "action_dispatch.show_exceptions" => :all,
395395
"action_dispatch.parameter_filter" => [:foo] }
396396
assert_response 500
397-
assert_match("&quot;foo&quot;=&gt;&quot;[FILTERED]&quot;", body)
397+
398+
assert_match(CGI.escape_html({ "foo" => "[FILTERED]" }.inspect[1..-2]), body)
398399
end
399400

400401
test "show registered original exception if the last exception is TemplateError" do

0 commit comments

Comments
 (0)