Skip to content

Commit dd4a422

Browse files
authored
Merge branch 'rails:main' into main
2 parents 472a3de + 6025230 commit dd4a422

File tree

85 files changed

+802
-193
lines changed

Some content is hidden

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

85 files changed

+802
-193
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby/.devcontainer/base.Dockerfile
22

33
# [Choice] Ruby version: 3.4, 3.3, 3.2
4-
ARG VARIANT="3.4.4"
4+
ARG VARIANT="3.4.5"
55
FROM ghcr.io/rails/devcontainer/images/ruby:${VARIANT}
66

77
RUN sudo apt-get update && export DEBIAN_FRONTEND=noninteractive \

Gemfile.lock

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ PATH
104104
rackup (>= 1.0.0)
105105
rake (>= 12.2)
106106
thor (~> 1.0, >= 1.2.2)
107+
tsort (>= 0.2)
107108
zeitwerk (~> 2.6)
108109

109110
PATH
@@ -153,12 +154,12 @@ GEM
153154
beaneater (~> 1.0)
154155
concurrent-ruby (~> 1.0, >= 1.0.1)
155156
dante (> 0.1.5)
156-
base64 (0.2.0)
157+
base64 (0.3.0)
157158
bcrypt (3.1.20)
158159
bcrypt_pbkdf (1.1.1)
159160
beaneater (1.1.3)
160-
benchmark (0.4.0)
161-
bigdecimal (3.1.9)
161+
benchmark (0.4.1)
162+
bigdecimal (3.2.2)
162163
bindex (0.8.1)
163164
bootsnap (1.18.4)
164165
msgpack (~> 1.2)
@@ -184,8 +185,8 @@ GEM
184185
concurrent-ruby
185186
childprocess (5.1.0)
186187
logger (~> 1.5)
187-
concurrent-ruby (1.3.4)
188-
connection_pool (2.5.0)
188+
concurrent-ruby (1.3.5)
189+
connection_pool (2.5.3)
189190
crack (1.0.0)
190191
bigdecimal
191192
rexml
@@ -205,7 +206,7 @@ GEM
205206
digest-crc (0.6.5)
206207
rake (>= 12.0.0, < 14.0.0)
207208
dotenv (3.1.7)
208-
drb (2.2.1)
209+
drb (2.2.3)
209210
ed25519 (1.3.0)
210211
erubi (1.13.1)
211212
et-orbi (1.2.11)
@@ -305,7 +306,7 @@ GEM
305306
hashdiff (1.1.2)
306307
httpclient (2.9.0)
307308
mutex_m
308-
i18n (1.14.6)
309+
i18n (1.14.7)
309310
concurrent-ruby (~> 1.0)
310311
image_processing (1.13.0)
311312
mini_magick (>= 4.9.5, < 5)
@@ -314,8 +315,9 @@ GEM
314315
actionpack (>= 6.0.0)
315316
activesupport (>= 6.0.0)
316317
railties (>= 6.0.0)
317-
io-console (0.8.0)
318-
irb (1.14.3)
318+
io-console (0.8.1)
319+
irb (1.15.2)
320+
pp (>= 0.6.0)
319321
rdoc (>= 4.0.0)
320322
reline (>= 0.4.2)
321323
jbuilder (2.13.0)
@@ -351,8 +353,8 @@ GEM
351353
listen (3.9.0)
352354
rb-fsevent (~> 0.10, >= 0.10.3)
353355
rb-inotify (~> 0.9, >= 0.9.10)
354-
logger (1.6.5)
355-
loofah (2.24.0)
356+
logger (1.7.0)
357+
loofah (2.24.1)
356358
crass (~> 1.0.2)
357359
nokogiri (>= 1.12.0)
358360
mail (2.8.1)
@@ -370,8 +372,8 @@ GEM
370372
mixlib-shellout
371373
mini_magick (4.13.2)
372374
mini_mime (1.1.5)
373-
mini_portile2 (2.8.8)
374-
minitest (5.25.4)
375+
mini_portile2 (2.8.9)
376+
minitest (5.25.5)
375377
minitest-bisect (1.7.0)
376378
minitest-server (~> 1.0)
377379
path_expander (~> 1.1)
@@ -412,25 +414,9 @@ GEM
412414
net-protocol
413415
net-ssh (7.3.0)
414416
nio4r (2.7.4)
415-
nokogiri (1.18.1)
417+
nokogiri (1.18.8)
416418
mini_portile2 (~> 2.8.2)
417419
racc (~> 1.4)
418-
nokogiri (1.18.1-aarch64-linux-gnu)
419-
racc (~> 1.4)
420-
nokogiri (1.18.1-aarch64-linux-musl)
421-
racc (~> 1.4)
422-
nokogiri (1.18.1-arm-linux-gnu)
423-
racc (~> 1.4)
424-
nokogiri (1.18.1-arm-linux-musl)
425-
racc (~> 1.4)
426-
nokogiri (1.18.1-arm64-darwin)
427-
racc (~> 1.4)
428-
nokogiri (1.18.1-x86_64-darwin)
429-
racc (~> 1.4)
430-
nokogiri (1.18.1-x86_64-linux-gnu)
431-
racc (~> 1.4)
432-
nokogiri (1.18.1-x86_64-linux-musl)
433-
racc (~> 1.4)
434420
os (1.1.4)
435421
ostruct (0.6.1)
436422
parallel (1.26.3)
@@ -439,13 +425,15 @@ GEM
439425
racc
440426
path_expander (1.1.3)
441427
pg (1.5.9)
428+
pp (0.6.2)
429+
prettyprint
430+
prettyprint (0.2.0)
442431
prism (1.3.0)
443-
propshaft (1.1.0)
432+
propshaft (1.2.0)
444433
actionpack (>= 7.0.0)
445434
activesupport (>= 7.0.0)
446435
rack
447-
railties (>= 7.0.0)
448-
psych (5.2.5)
436+
psych (5.2.6)
449437
date
450438
stringio
451439
public_suffix (6.0.1)
@@ -455,14 +443,14 @@ GEM
455443
pg (>= 1.1, < 2.0)
456444
raabro (1.4.0)
457445
racc (1.8.1)
458-
rack (3.1.8)
446+
rack (3.1.16)
459447
rack-cache (1.17.0)
460448
rack (>= 0.4)
461449
rack-protection (4.1.1)
462450
base64 (>= 0.1.0)
463451
logger (>= 1.6.0)
464452
rack (>= 3.0.0, < 4)
465-
rack-session (2.1.0)
453+
rack-session (2.1.1)
466454
base64 (>= 0.1.0)
467455
rack (>= 3.0.0)
468456
rack-test (2.2.0)
@@ -477,7 +465,7 @@ GEM
477465
loofah (~> 2.21)
478466
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
479467
rainbow (3.1.1)
480-
rake (13.2.1)
468+
rake (13.3.0)
481469
rb-fsevent (0.11.2)
482470
rb-inotify (0.11.1)
483471
ffi (~> 1.0)
@@ -492,7 +480,7 @@ GEM
492480
redis-namespace (1.11.0)
493481
redis (>= 4)
494482
regexp_parser (2.10.0)
495-
reline (0.6.0)
483+
reline (0.6.1)
496484
io-console (~> 0.5)
497485
representable (3.2.0)
498486
declarative (< 0.1.0)
@@ -681,6 +669,7 @@ GEM
681669
tomlrb (2.0.3)
682670
trailblazer-option (0.1.2)
683671
trilogy (2.9.0)
672+
tsort (0.2.0)
684673
turbo-rails (2.0.11)
685674
actionpack (>= 6.0.0)
686675
railties (>= 6.0.0)
@@ -690,7 +679,7 @@ GEM
690679
unicode-display_width (3.1.4)
691680
unicode-emoji (~> 4.0, >= 4.0.4)
692681
unicode-emoji (4.0.4)
693-
uri (1.0.2)
682+
uri (1.0.3)
694683
useragent (0.16.11)
695684
w3c_validators (1.3.7)
696685
json (>= 1.8)
@@ -718,7 +707,7 @@ GEM
718707
websocket-extensions (0.1.5)
719708
xpath (3.2.0)
720709
nokogiri (~> 1.8)
721-
zeitwerk (2.7.1)
710+
zeitwerk (2.7.3)
722711

723712
PLATFORMS
724713
aarch64-linux

actionpack/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
* Allow to open source file with a crash from the browser.
2+
3+
*Igor Kasyanchuk*
4+
5+
* Always check query string keys for valid encoding just like values are checked.
6+
7+
*Casper Smits*
8+
19
* Always return empty body for HEAD requests in `PublicExceptions` and
210
`DebugExceptions`.
311

actionpack/lib/action_controller/metal/allow_browser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module ClassMethods
1414
# aren't reporting a user-agent header, will be allowed access.
1515
#
1616
# A browser that's blocked will by default be served the file in
17-
# public/406-unsupported-browser.html with a HTTP status code of "406 Not
17+
# public/406-unsupported-browser.html with an HTTP status code of "406 Not
1818
# Acceptable".
1919
#
2020
# In addition to specifically named browser versions, you can also pass

actionpack/lib/action_controller/metal/request_forgery_protection.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ def valid_request_origin? # :doc:
642642
end
643643
end
644644

645-
def normalize_action_path(action_path) # :doc:
645+
def normalize_action_path(action_path)
646646
uri = URI.parse(action_path)
647647

648648
if uri.relative? && (action_path.blank? || !action_path.start_with?("/"))
@@ -652,7 +652,7 @@ def normalize_action_path(action_path) # :doc:
652652
end
653653
end
654654

655-
def normalize_relative_action_path(rel_action_path) # :doc:
655+
def normalize_relative_action_path(rel_action_path)
656656
uri = URI.parse(request.path)
657657
# add the action path to the request.path
658658
uri.path += "/#{rel_action_path}"

actionpack/lib/action_dispatch/http/param_builder.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ def store_nested_param(params, name, v, depth, encoding_template = nil)
111111

112112
return if k.empty?
113113

114+
unless k.valid_encoding?
115+
raise InvalidParameterError, "Invalid encoding for parameter: #{k}"
116+
end
117+
114118
if depth == 0 && String === v
115119
# We have to wait until we've found the top part of the name,
116120
# because that's what the encoding template is configured with

actionpack/lib/action_dispatch/middleware/debug_view.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ def render(*)
5555
end
5656
end
5757

58+
def editor_url(location, line: nil)
59+
if editor = ActiveSupport::Editor.current
60+
line ||= location&.lineno
61+
absolute_path = location&.absolute_path
62+
63+
if absolute_path && line && File.exist?(absolute_path)
64+
editor.url_for(absolute_path, line)
65+
end
66+
end
67+
end
68+
5869
def protect_against_forgery?
5970
false
6071
end

actionpack/lib/action_dispatch/middleware/exception_wrapper.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,20 @@ def traces
148148
application_trace_with_ids = []
149149
framework_trace_with_ids = []
150150
full_trace_with_ids = []
151+
application_traces = application_trace.map(&:to_s)
151152

153+
full_trace = backtrace_cleaner&.clean_locations(backtrace, :all).presence || backtrace
152154
full_trace.each_with_index do |trace, idx|
155+
filtered_trace = backtrace_cleaner&.clean_frame(trace, :all) || trace
156+
153157
trace_with_id = {
154158
exception_object_id: @exception.object_id,
155159
id: idx,
156-
trace: trace
160+
trace: trace,
161+
filtered_trace: filtered_trace,
157162
}
158163

159-
if application_trace.include?(trace)
164+
if application_traces.include?(filtered_trace.to_s)
160165
application_trace_with_ids << trace_with_id
161166
else
162167
framework_trace_with_ids << trace_with_id
@@ -197,7 +202,7 @@ def rescue_response?
197202

198203
def source_extracts
199204
backtrace.map do |trace|
200-
extract_source(trace)
205+
extract_source(trace).merge(trace: trace)
201206
end
202207
end
203208

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
<tr>
1212
<td>
1313
<pre class="line_numbers">
14-
<% source_extract[:code].each_key do |line_number| %>
15-
<span><%= line_number -%></span>
14+
<% source_extract[:code].each_key do |line| %>
15+
<% file_url = editor_url(source_extract[:trace], line: line) %>
16+
<span><%= link_to_if file_url, line, file_url -%></span>
1617
<% end %>
1718
</pre>
1819
</td>

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@
1313
<% end %>
1414

1515
<% traces.each do |name, trace| %>
16-
<div id="<%= "#{name.gsub(/\s/, '-')}-#{error_index}" %>" style="display: <%= (name == trace_to_show) ? 'block' : 'none' %>;">
16+
<div id="<%= "#{name.gsub(/\s/, '-')}-#{error_index}" %>" class="trace-container" style="display: <%= (name == trace_to_show) ? 'block' : 'none' %>;">
1717
<code class="traces">
1818
<% trace.each do |frame| %>
19-
<a class="trace-frames trace-frames-<%= error_index %>" data-exception-object-id="<%= frame[:exception_object_id] %>" data-frame-id="<%= frame[:id] %>" href="#">
20-
<%= frame[:trace] %>
21-
</a>
22-
<br>
19+
<div class="trace">
20+
<% file_url = editor_url(frame[:trace]) %>
21+
<%= file_url && link_to("✏️", file_url, class: "edit-icon") %>
22+
<a class="trace-frames trace-frames-<%= error_index %>" data-exception-object-id="<%= frame[:exception_object_id] %>" data-frame-id="<%= frame[:id] %>" href="#">
23+
<%= frame[:trace] %>
24+
</a>
25+
<br>
26+
</div>
2327
<% end %>
2428
</code>
2529
</div>

0 commit comments

Comments
 (0)