airbrake-ruby 6.1.0-java → 6.1.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +1 -1
  3. data/lib/airbrake-ruby/nested_exception.rb +10 -1
  4. data/lib/airbrake-ruby/notice.rb +5 -3
  5. data/lib/airbrake-ruby/version.rb +1 -1
  6. metadata +4 -122
  7. data/spec/airbrake_spec.rb +0 -522
  8. data/spec/async_sender_spec.rb +0 -65
  9. data/spec/backtrace_spec.rb +0 -430
  10. data/spec/benchmark_spec.rb +0 -35
  11. data/spec/code_hunk_spec.rb +0 -124
  12. data/spec/config/processor_spec.rb +0 -167
  13. data/spec/config/validator_spec.rb +0 -204
  14. data/spec/config_spec.rb +0 -188
  15. data/spec/context_spec.rb +0 -54
  16. data/spec/deploy_notifier_spec.rb +0 -50
  17. data/spec/file_cache_spec.rb +0 -35
  18. data/spec/filter_chain_spec.rb +0 -124
  19. data/spec/filters/context_filter_spec.rb +0 -32
  20. data/spec/filters/dependency_filter_spec.rb +0 -14
  21. data/spec/filters/exception_attributes_filter_spec.rb +0 -52
  22. data/spec/filters/gem_root_filter_spec.rb +0 -44
  23. data/spec/filters/git_last_checkout_filter_spec.rb +0 -61
  24. data/spec/filters/git_repository_filter_spec.rb +0 -72
  25. data/spec/filters/git_revision_filter_spec.rb +0 -126
  26. data/spec/filters/keys_allowlist_spec.rb +0 -204
  27. data/spec/filters/keys_blocklist_spec.rb +0 -242
  28. data/spec/filters/root_directory_filter_spec.rb +0 -39
  29. data/spec/filters/sql_filter_spec.rb +0 -274
  30. data/spec/filters/system_exit_filter_spec.rb +0 -16
  31. data/spec/filters/thread_filter_spec.rb +0 -281
  32. data/spec/fixtures/notroot.txt +0 -7
  33. data/spec/fixtures/project_root/code.rb +0 -221
  34. data/spec/fixtures/project_root/empty_file.rb +0 -0
  35. data/spec/fixtures/project_root/long_line.txt +0 -1
  36. data/spec/fixtures/project_root/short_file.rb +0 -3
  37. data/spec/fixtures/project_root/vendor/bundle/ignored_file.rb +0 -5
  38. data/spec/helpers.rb +0 -9
  39. data/spec/ignorable_spec.rb +0 -14
  40. data/spec/inspectable_spec.rb +0 -45
  41. data/spec/loggable_spec.rb +0 -17
  42. data/spec/monotonic_time_spec.rb +0 -25
  43. data/spec/nested_exception_spec.rb +0 -73
  44. data/spec/notice_notifier/options_spec.rb +0 -269
  45. data/spec/notice_notifier_spec.rb +0 -361
  46. data/spec/notice_spec.rb +0 -300
  47. data/spec/performance_breakdown_spec.rb +0 -11
  48. data/spec/performance_notifier_spec.rb +0 -645
  49. data/spec/promise_spec.rb +0 -203
  50. data/spec/query_spec.rb +0 -11
  51. data/spec/queue_spec.rb +0 -18
  52. data/spec/remote_settings/callback_spec.rb +0 -162
  53. data/spec/remote_settings/settings_data_spec.rb +0 -348
  54. data/spec/remote_settings_spec.rb +0 -201
  55. data/spec/request_spec.rb +0 -9
  56. data/spec/response_spec.rb +0 -110
  57. data/spec/spec_helper.rb +0 -100
  58. data/spec/stashable_spec.rb +0 -23
  59. data/spec/stat_spec.rb +0 -39
  60. data/spec/sync_sender_spec.rb +0 -168
  61. data/spec/tdigest_spec.rb +0 -235
  62. data/spec/thread_pool_spec.rb +0 -196
  63. data/spec/time_truncate_spec.rb +0 -30
  64. data/spec/timed_trace_spec.rb +0 -127
  65. data/spec/truncator_spec.rb +0 -267
@@ -1,204 +0,0 @@
1
- RSpec.describe Airbrake::Filters::KeysAllowlist do
2
- subject(:keys_allowlist_filter) { described_class.new(patterns) }
3
-
4
- let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
5
-
6
- shared_examples 'pattern matching' do |patts, params|
7
- let(:patterns) { patts }
8
-
9
- it "filters out the matching values" do
10
- notice[:params] = params.first
11
- keys_allowlist_filter.call(notice)
12
- expect(notice[:params]).to eq(params.last)
13
- end
14
- end
15
-
16
- before do
17
- allow(Airbrake::Loggable.instance).to receive(:error)
18
- end
19
-
20
- context "when a pattern is a Regexp" do
21
- include_examples(
22
- 'pattern matching',
23
- [/\Abin/],
24
- [
25
- { bingo: 'bango', bongo: 'bish', bash: 'bosh' },
26
- { bingo: 'bango', bongo: '[Filtered]', bash: '[Filtered]' },
27
- ],
28
- )
29
- end
30
-
31
- context "when a pattern is a Symbol" do
32
- include_examples(
33
- 'pattern matching',
34
- [:bongo],
35
- [
36
- { bongo: 'bish', bash: 'bosh', bbashh: 'bboshh' },
37
- { bongo: 'bish', bash: '[Filtered]', bbashh: '[Filtered]' },
38
- ],
39
- )
40
- end
41
-
42
- context "when a pattern is a String" do
43
- include_examples(
44
- 'pattern matching',
45
- ['bash'],
46
- [
47
- { bingo: 'bango', bongo: 'bish', bash: 'bosh' },
48
- { bingo: '[Filtered]', bongo: '[Filtered]', bash: 'bosh' },
49
- ],
50
- )
51
- end
52
-
53
- context "when a Proc pattern was provided" do
54
- context "along with normal keys" do
55
- include_examples(
56
- 'pattern matching',
57
- [proc { 'bongo' }, :bash],
58
- [
59
- { bingo: 'bango', bongo: 'bish', bash: 'bosh' },
60
- { bingo: '[Filtered]', bongo: 'bish', bash: 'bosh' },
61
- ],
62
- )
63
- end
64
-
65
- context "which doesn't return an array of keys" do
66
- include_examples(
67
- 'pattern matching',
68
- [proc { Object.new }],
69
- [
70
- { bingo: 'bango', bongo: 'bish', bash: 'bosh' },
71
- { bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
72
- ],
73
- )
74
-
75
- it "logs an error" do
76
- keys_allowlist = described_class.new(patterns)
77
- keys_allowlist.call(notice)
78
-
79
- expect(Airbrake::Loggable.instance).to have_received(:error).with(
80
- /KeysAllowlist is invalid.+patterns: \[#<Object:.+>\]/,
81
- )
82
- end
83
- end
84
-
85
- context "which returns another Proc" do
86
- let(:patterns) { [proc { proc { ['bingo'] } }] }
87
-
88
- context "and when the filter is called once" do
89
- it "logs an error" do
90
- keys_allowlist = described_class.new(patterns)
91
- keys_allowlist.call(notice)
92
-
93
- expect(Airbrake::Loggable.instance).to have_received(:error).with(
94
- /KeysAllowlist is invalid.+patterns: \[#<Proc:.+>\]/,
95
- )
96
- end
97
-
98
- include_examples(
99
- 'pattern matching',
100
- [proc { proc { ['bingo'] } }],
101
- [
102
- { bingo: 'bango', bongo: 'bish', bash: 'bosh' },
103
- { bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
104
- ],
105
- )
106
- end
107
- end
108
- end
109
-
110
- context "when a pattern is invalid" do
111
- include_examples(
112
- 'pattern matching',
113
- [Object.new],
114
- [
115
- { bingo: 'bango', bongo: 'bish', bash: 'bosh' },
116
- { bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
117
- ],
118
- )
119
-
120
- it "logs an error" do
121
- keys_allowlist = described_class.new(patterns)
122
- keys_allowlist.call(notice)
123
-
124
- expect(Airbrake::Loggable.instance).to have_received(:error).with(
125
- /KeysAllowlist is invalid.+patterns: \[#<Object:.+>\]/,
126
- )
127
- end
128
- end
129
-
130
- context "when a value contains a nested hash" do
131
- context "and it is non-recursive" do
132
- include_examples(
133
- 'pattern matching',
134
- %w[bongo bish],
135
- [
136
- { bingo: 'bango', bongo: { bish: 'bash' } },
137
- { bingo: '[Filtered]', bongo: { bish: 'bash' } },
138
- ],
139
- )
140
- end
141
-
142
- context "and it is recursive" do
143
- let(:patterns) { ['bingo'] }
144
-
145
- it "raises error (MRI)", skip: (
146
- # MRI 2.3 & 2.4 may segfault on Circle CI. Example build:
147
- # https://circleci.com/workflow-run/c112358c-e7bf-4789-9eb2-4891ea84da68
148
- RUBY_ENGINE == 'ruby' && RUBY_VERSION =~ /\A2\.[34]\.\d+\z/
149
- ) do
150
- bongo = {}
151
- bongo[:bingo] = bongo
152
- notice[:params] = bongo
153
-
154
- begin
155
- expect { keys_allowlist_filter.call(notice) }.to raise_error(SystemStackError)
156
- rescue RSpec::Expectations::ExpectationNotMetError => ex
157
- # JRuby might raise two different exceptions, which represent the same
158
- # thing. One is a Java exception, the other is a Ruby exception.
159
- # Likely a bug: https://github.com/jruby/jruby/issues/1903
160
- raise ex unless RUBY_ENGINE == 'jruby'
161
-
162
- expect do
163
- keys_allowlist_filter.call(notice)
164
- end.to raise_error(java.lang.StackOverflowError)
165
- end
166
- end
167
- end
168
- end
169
-
170
- describe "context payload" do
171
- describe "URL" do
172
- let(:patterns) { ['bish'] }
173
-
174
- context "when it contains query params" do
175
- it "filters the params" do
176
- notice[:context][:url] = 'http://localhost:3000/crash?foo=bar&baz=bongo&bish=bash'
177
- keys_allowlist_filter.call(notice)
178
- expect(notice[:context][:url]).to(
179
- eq('http://localhost:3000/crash?foo=[Filtered]&baz=[Filtered]&bish=bash'),
180
- )
181
- end
182
- end
183
-
184
- context "when it is invalid" do
185
- it "leaves the URL unfiltered" do
186
- notice[:context][:url] =
187
- 'http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'
188
- keys_allowlist_filter.call(notice)
189
- expect(notice[:context][:url]).to(
190
- eq('http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'),
191
- )
192
- end
193
- end
194
-
195
- context "when it is without a query" do
196
- it "leaves the URL untouched" do
197
- notice[:context][:url] = 'http://localhost:3000/crash'
198
- keys_allowlist_filter.call(notice)
199
- expect(notice[:context][:url]).to(eq('http://localhost:3000/crash'))
200
- end
201
- end
202
- end
203
- end
204
- end
@@ -1,242 +0,0 @@
1
- RSpec.describe Airbrake::Filters::KeysBlocklist do
2
- subject(:keys_blocklist_filter) { described_class.new(patterns) }
3
-
4
- let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
5
-
6
- shared_examples 'pattern matching' do |patts, params|
7
- let(:patterns) { patts }
8
-
9
- it "filters out the matching values" do
10
- notice[:params] = params.first
11
- keys_blocklist_filter.call(notice)
12
- expect(notice[:params]).to eq(params.last)
13
- end
14
- end
15
-
16
- before do
17
- allow(Airbrake::Loggable.instance).to receive(:error)
18
- end
19
-
20
- context "when a pattern is a Regexp" do
21
- include_examples(
22
- 'pattern matching',
23
- [/\Abon/],
24
- [
25
- { bongo: 'bango' },
26
- { bongo: '[Filtered]' },
27
- ],
28
- )
29
-
30
- context "and when a key is a hash" do
31
- let(:patterns) { [/bango/] }
32
-
33
- # https://github.com/airbrake/airbrake/issues/739
34
- it "doesn't fail" do
35
- notice[:params] = { bingo: { {} => 'unfiltered' } }
36
- expect { keys_blocklist_filter.call(notice) }.not_to raise_error
37
- end
38
- end
39
- end
40
-
41
- context "when a pattern is a Symbol" do
42
- include_examples(
43
- 'pattern matching',
44
- [:bingo],
45
- [
46
- { bingo: 'bango' },
47
- { bingo: '[Filtered]' },
48
- ],
49
- )
50
- end
51
-
52
- context "when a pattern is a String" do
53
- include_examples(
54
- 'pattern matching',
55
- ['bingo'],
56
- [
57
- { bingo: 'bango' },
58
- { bingo: '[Filtered]' },
59
- ],
60
- )
61
- end
62
-
63
- context "when a pattern is a Array of Hash" do
64
- include_examples(
65
- 'pattern matching',
66
- ['bingo'],
67
- [
68
- { array: [{ bingo: 'bango' }, []] },
69
- { array: [{ bingo: '[Filtered]' }, []] },
70
- ],
71
- )
72
- end
73
-
74
- context "when a Proc pattern was provided" do
75
- context "along with normal keys" do
76
- include_examples(
77
- 'pattern matching',
78
- [proc { 'bongo' }, :bash],
79
- [
80
- { bingo: 'bango', bongo: 'bish', bash: 'bosh' },
81
- { bingo: 'bango', bongo: '[Filtered]', bash: '[Filtered]' },
82
- ],
83
- )
84
- end
85
-
86
- context "which doesn't return an array of keys" do
87
- include_examples(
88
- 'pattern matching',
89
- [proc { Object.new }],
90
- [
91
- { bingo: 'bango', bongo: 'bish' },
92
- { bingo: 'bango', bongo: 'bish' },
93
- ],
94
- )
95
-
96
- it "logs an error" do
97
- keys_blocklist = described_class.new(patterns)
98
- keys_blocklist.call(notice)
99
-
100
- expect(Airbrake::Loggable.instance).to have_received(:error).with(
101
- /KeysBlocklist is invalid.+patterns: \[#<Object:.+>\]/,
102
- )
103
- end
104
- end
105
-
106
- context "which returns another Proc" do
107
- let(:patterns) { [proc { proc { ['bingo'] } }] }
108
-
109
- context "and when the filter is called once" do
110
- it "logs an error" do
111
- keys_blocklist = described_class.new(patterns)
112
- keys_blocklist.call(notice)
113
-
114
- expect(Airbrake::Loggable.instance).to have_received(:error).with(
115
- /KeysBlocklist is invalid.+patterns: \[#<Proc:.+>\]/,
116
- )
117
- end
118
- end
119
-
120
- context "and when the filter is called twice" do
121
- it "unwinds procs and filters keys" do
122
- notice[:params] = { bingo: 'bango', bongo: 'bish' }
123
- 2.times { keys_blocklist_filter.call(notice) }
124
- expect(notice[:params]).to eq(bingo: '[Filtered]', bongo: 'bish')
125
- end
126
- end
127
- end
128
- end
129
-
130
- context "when a pattern is invalid" do
131
- include_examples(
132
- 'pattern matching',
133
- [Object.new],
134
- [
135
- { bingo: 'bango', bongo: 'bish' },
136
- { bingo: 'bango', bongo: 'bish' },
137
- ],
138
- )
139
-
140
- it "logs an error" do
141
- keys_blocklist = described_class.new(patterns)
142
- keys_blocklist.call(notice)
143
-
144
- expect(Airbrake::Loggable.instance).to have_received(:error).with(
145
- /KeysBlocklist is invalid.+patterns: \[#<Object:.+>\]/,
146
- )
147
- end
148
- end
149
-
150
- context "when a value contains a nested hash" do
151
- context "and it is non-recursive" do
152
- include_examples(
153
- 'pattern matching',
154
- ['bish'],
155
- [
156
- { bongo: { bish: 'bash' } },
157
- { bongo: { bish: '[Filtered]' } },
158
- ],
159
- )
160
-
161
- it "doesn't mutate the original hash" do
162
- params = { bongo: { bish: 'bash' } }
163
- notice[:params] = params
164
-
165
- blocklist = described_class.new([:bish])
166
- blocklist.call(notice)
167
-
168
- expect(params[:bongo][:bish]).to eq('bash')
169
- end
170
- end
171
-
172
- context "and it is recursive" do
173
- bongo = { bingo: {} }
174
- bongo[:bingo][:bango] = bongo
175
-
176
- include_examples(
177
- 'pattern matching',
178
- ['bango'],
179
- [
180
- bongo,
181
- { bingo: { bango: '[Filtered]' } },
182
- ],
183
- )
184
- end
185
- end
186
-
187
- describe "context payload" do
188
- context "when a URL with query params is present" do
189
- let(:patterns) { ['bish'] }
190
-
191
- it "filters the params" do
192
- notice[:context][:url] =
193
- 'http://localhost:3000/crash?foo=bar&baz=bongo&bish=bash&color=%23FFAAFF'
194
-
195
- keys_blocklist_filter.call(notice)
196
- expect(notice[:context][:url]).to(
197
- eq('http://localhost:3000/crash?foo=bar&baz=bongo&bish=[Filtered]&color=%23FFAAFF'),
198
- )
199
- end
200
- end
201
-
202
- context "when the user key is present" do
203
- let(:patterns) { ['user'] }
204
-
205
- it "filters out the user" do
206
- notice[:context][:user] = { id: 1337, name: 'Bingo Bango' }
207
- keys_blocklist_filter.call(notice)
208
- expect(notice[:context][:user]).to eq('[Filtered]')
209
- end
210
- end
211
-
212
- context "and when it is a hash" do
213
- let(:patterns) { ['name'] }
214
-
215
- it "filters out individual user fields" do
216
- notice[:context][:user] = { id: 1337, name: 'Bingo Bango' }
217
- keys_blocklist_filter.call(notice)
218
- expect(notice[:context][:user][:name]).to eq('[Filtered]')
219
- end
220
- end
221
- end
222
-
223
- context "when the headers key is present" do
224
- let(:patterns) { ['headers'] }
225
-
226
- it "filters out the headers" do
227
- notice[:context][:headers] = { 'HTTP_COOKIE' => 'banana' }
228
- keys_blocklist_filter.call(notice)
229
- expect(notice[:context][:headers]).to eq('[Filtered]')
230
- end
231
-
232
- context "and when it is a hash" do
233
- let(:patterns) { ['HTTP_COOKIE'] }
234
-
235
- it "filters out individual header fields" do
236
- notice[:context][:headers] = { 'HTTP_COOKIE' => 'banana' }
237
- keys_blocklist_filter.call(notice)
238
- expect(notice[:context][:headers]['HTTP_COOKIE']).to eq('[Filtered]')
239
- end
240
- end
241
- end
242
- end
@@ -1,39 +0,0 @@
1
- RSpec.describe Airbrake::Filters::RootDirectoryFilter do
2
- subject(:root_directory_filter) { described_class.new(root_directory) }
3
-
4
- let(:root_directory) { '/var/www/project' }
5
- let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
6
-
7
- it "replaces root directory in the backtrace with a label" do
8
- # rubocop:disable Layout/LineLength
9
- notice[:errors].first[:backtrace] = [
10
- { file: "/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb" },
11
- { file: "#{root_directory}/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb " },
12
- { file: "/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb" },
13
- { file: "#{root_directory}/gems/rspec-core-3.3.2/exe/rspec" },
14
- ]
15
- # rubocop:enable Layout/LineLength
16
-
17
- root_directory_filter.call(notice)
18
-
19
- # rubocop:disable Layout/LineLength
20
- expect(notice[:errors].first[:backtrace]).to(
21
- eq(
22
- [
23
- { file: "/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb" },
24
- { file: "/PROJECT_ROOT/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb " },
25
- { file: "/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb" },
26
- { file: "/PROJECT_ROOT/gems/rspec-core-3.3.2/exe/rspec" },
27
- ],
28
- ),
29
- )
30
- # rubocop:enable Layout/LineLength
31
- end
32
-
33
- it "does not filter file when it is nil" do
34
- expect(notice[:errors].first[:file]).to be_nil
35
- expect { root_directory_filter.call(notice) }.not_to(
36
- change { notice[:errors].first[:file] },
37
- )
38
- end
39
- end