bugsnag 6.26.1 → 6.26.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/VERSION +1 -1
  4. data/lib/bugsnag/cleaner.rb +40 -10
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60383f9662a63f219295a1554c0643092d201039d57ec4b93f7542761662105f
4
- data.tar.gz: 04076a3736b8ff9ee5b575b083e328429f149cd4a531f5ac062581d9472feea9
3
+ metadata.gz: 51f147f279fd5a2a7bbe26663246348f4d4bbccf9d901febeda2620d533341d3
4
+ data.tar.gz: 3648e3a84b41ff738318c4ea8b0db7218a6c3dd149cd084604c9cbe102cfc593
5
5
  SHA512:
6
- metadata.gz: '0826f29f80c34ec5e785dff331b185498b2d2862455f5011dc6405eedfdbe23188a811ba93f8673bc79834e3a5e8c46d63d0cfa5ca541c4864ef5367ec83e034'
7
- data.tar.gz: 9a5bdf81e2ddd1b7ad7c0b2ec48463c288c9e8f55887454530c016a95a6f38f593e696af69adc558bd1a54df0f1fa104954c0d40612d70ac309c88765c6d6fb7
6
+ metadata.gz: d3942fed5bf6c50cdaa12d25e39c7e7218badf7ef1d9481baeacd220fe5a14271200e47d552eb2e35008fdb83c3a1eac11eaaaae72ea1228879ad5be2c191e57
7
+ data.tar.gz: 10a2182a9002b5d0f664ba8a442717c5dafbcb32cc96561c179189c5a3be0661dc824070eaa3c28d32f927a732549962e13d556ef8fc2b454a9f44a177b683af
data/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v6.26.3 (24 January 2024)
5
+
6
+ * Handle mailto links in `Cleaner#clean_url`
7
+ | [#813](https://github.com/bugsnag/bugsnag-ruby/pull/813)
8
+
9
+ ## v6.26.2 (17 January 2024)
10
+
11
+ ### Fixes
12
+
13
+ * Fix unhandled `URI::InvalidURIError` in `Cleaner#clean_url`
14
+ | [#811](https://github.com/bugsnag/bugsnag-ruby/pull/811)
15
+
4
16
  ## v6.26.1 (9 January 2024)
5
17
 
6
18
  ### Fixes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.26.1
1
+ 6.26.3
@@ -26,21 +26,23 @@ module Bugsnag
26
26
  # @return [String]
27
27
  def clean_url(url)
28
28
  return url if @configuration.meta_data_filters.empty? && @configuration.redacted_keys.empty?
29
+ return url unless url.include?('?')
29
30
 
30
- uri = URI(url)
31
- return url unless uri.query
31
+ begin
32
+ uri = URI(url)
32
33
 
33
- query_params = uri.query.split('&').map { |pair| pair.split('=') }
34
- query_params.map! do |key, val|
35
- if filters_match?(key)
36
- "#{key}=#{FILTERED}"
34
+ if uri.is_a?(URI::MailTo)
35
+ clean_mailto_url(url, uri)
37
36
  else
38
- "#{key}=#{val}"
37
+ clean_generic_url(url, uri)
39
38
  end
40
- end
39
+ rescue URI::InvalidURIError
40
+ pre_query_string, _query_string = url.split('?', 2)
41
41
 
42
- uri.query = query_params.join('&')
43
- uri.to_s
42
+ "#{pre_query_string}?#{FILTERED}"
43
+ rescue StandardError
44
+ FILTERED
45
+ end
44
46
  end
45
47
 
46
48
  ##
@@ -201,5 +203,33 @@ module Bugsnag
201
203
  scope.start_with?("#{scope_to_filter}.")
202
204
  end
203
205
  end
206
+
207
+ def clean_generic_url(original_url, uri)
208
+ return original_url unless uri.query
209
+
210
+ query_params = uri.query.split('&').map { |pair| pair.split('=') }
211
+
212
+ uri.query = filter_uri_parameter_array(query_params).join('&')
213
+ uri.to_s
214
+ end
215
+
216
+ def clean_mailto_url(original_url, uri)
217
+ return original_url unless uri.headers
218
+
219
+ # headers in mailto links can't contain square brackets so we replace
220
+ # filtered parameters with 'FILTERED' instead of '[FILTERED]'
221
+ uri.headers = filter_uri_parameter_array(uri.headers, 'FILTERED').join('&')
222
+ uri.to_s
223
+ end
224
+
225
+ def filter_uri_parameter_array(parameters, replacement = FILTERED)
226
+ parameters.map do |key, value|
227
+ if filters_match?(key)
228
+ "#{key}=#{replacement}"
229
+ else
230
+ "#{key}=#{value}"
231
+ end
232
+ end
233
+ end
204
234
  end
205
235
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.26.1
4
+ version: 6.26.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-09 00:00:00.000000000 Z
11
+ date: 2024-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -107,7 +107,7 @@ homepage: https://github.com/bugsnag/bugsnag-ruby
107
107
  licenses:
108
108
  - MIT
109
109
  metadata:
110
- changelog_uri: https://github.com/bugsnag/bugsnag-ruby/blob/v6.26.1/CHANGELOG.md
110
+ changelog_uri: https://github.com/bugsnag/bugsnag-ruby/blob/v6.26.3/CHANGELOG.md
111
111
  documentation_uri: https://docs.bugsnag.com/platforms/ruby/
112
112
  source_code_uri: https://github.com/bugsnag/bugsnag-ruby/
113
113
  rubygems_mfa_required: 'true'