File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Changelog
22=========
33
4+ ## v6.26.2 (17 January 2024)
5+
6+ ### Fixes
7+
8+ * Fix unhandled ` URI::InvalidURIError ` in ` Cleaner#clean_url `
9+ | [ #811 ] ( https://github.com/bugsnag/bugsnag-ruby/pull/811 )
10+
411## v6.26.1 (9 January 2024)
512
613### Fixes
Original file line number Diff line number Diff line change 1- 6.26.1
1+ 6.26.2
Original file line number Diff line number Diff line change @@ -26,8 +26,16 @@ def clean_object(object)
2626 # @return [String]
2727 def clean_url ( url )
2828 return url if @configuration . meta_data_filters . empty? && @configuration . redacted_keys . empty?
29+ return url unless url . include? ( '?' )
30+
31+ begin
32+ uri = URI ( url )
33+ rescue URI ::InvalidURIError
34+ pre_query_string , _query_string = url . split ( '?' , 2 )
35+
36+ return "#{ pre_query_string } ?#{ FILTERED } "
37+ end
2938
30- uri = URI ( url )
3139 return url unless uri . query
3240
3341 query_params = uri . query . split ( '&' ) . map { |pair | pair . split ( '=' ) }
Original file line number Diff line number Diff line change @@ -540,5 +540,17 @@ def to_s
540540 let ( :url ) { "https://host.example/sessions?access_token=abc123" }
541541 it { should eq "https://host.example/sessions?access_token=[FILTERED]" }
542542 end
543+
544+ context "with an invalid URL" do
545+ let ( :filters ) { [ /token/ ] }
546+ let ( :url ) { "https://host.example/a b c d e f g?access_token=abc123&password=secret&token2=xyz987" }
547+ it { should eq "https://host.example/a b c d e f g?[FILTERED]" }
548+ end
549+
550+ context "with an invalid URL and no query string" do
551+ let ( :filters ) { [ /token/ ] }
552+ let ( :url ) { "https://host.example/a b c d e f g" }
553+ it { should eq "https://host.example/a b c d e f g" }
554+ end
543555 end
544556end
You can’t perform that action at this time.
0 commit comments