airbrake-ruby 4.8.0 → 4.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/airbrake-ruby.rb +84 -5
- data/lib/airbrake-ruby/async_sender.rb +3 -3
- data/lib/airbrake-ruby/backtrace.rb +2 -2
- data/lib/airbrake-ruby/code_hunk.rb +1 -1
- data/lib/airbrake-ruby/config.rb +1 -1
- data/lib/airbrake-ruby/config/validator.rb +3 -3
- data/lib/airbrake-ruby/deploy_notifier.rb +1 -1
- data/lib/airbrake-ruby/filters/exception_attributes_filter.rb +2 -2
- data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +2 -2
- data/lib/airbrake-ruby/filters/keys_filter.rb +1 -1
- data/lib/airbrake-ruby/filters/sql_filter.rb +3 -3
- data/lib/airbrake-ruby/filters/thread_filter.rb +1 -1
- data/lib/airbrake-ruby/grouppable.rb +12 -0
- data/lib/airbrake-ruby/inspectable.rb +2 -2
- data/lib/airbrake-ruby/mergeable.rb +12 -0
- data/lib/airbrake-ruby/notice.rb +7 -7
- data/lib/airbrake-ruby/notice_notifier.rb +1 -1
- data/lib/airbrake-ruby/performance_breakdown.rb +3 -2
- data/lib/airbrake-ruby/performance_notifier.rb +42 -21
- data/lib/airbrake-ruby/query.rb +4 -6
- data/lib/airbrake-ruby/queue.rb +52 -0
- data/lib/airbrake-ruby/request.rb +4 -6
- data/lib/airbrake-ruby/stat.rb +1 -1
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/airbrake_spec.rb +135 -45
- data/spec/async_sender_spec.rb +4 -4
- data/spec/backtrace_spec.rb +18 -18
- data/spec/code_hunk_spec.rb +9 -9
- data/spec/config/validator_spec.rb +5 -5
- data/spec/config_spec.rb +5 -5
- data/spec/deploy_notifier_spec.rb +2 -2
- data/spec/filter_chain_spec.rb +1 -1
- data/spec/filters/dependency_filter_spec.rb +1 -1
- data/spec/filters/gem_root_filter_spec.rb +5 -5
- data/spec/filters/git_last_checkout_filter_spec.rb +1 -1
- data/spec/filters/git_repository_filter.rb +1 -1
- data/spec/filters/git_revision_filter_spec.rb +10 -10
- data/spec/filters/keys_blacklist_spec.rb +22 -22
- data/spec/filters/keys_whitelist_spec.rb +21 -21
- data/spec/filters/root_directory_filter_spec.rb +5 -5
- data/spec/filters/sql_filter_spec.rb +53 -53
- data/spec/filters/system_exit_filter_spec.rb +1 -1
- data/spec/filters/thread_filter_spec.rb +28 -28
- data/spec/fixtures/project_root/code.rb +9 -9
- data/spec/notice_notifier/options_spec.rb +12 -12
- data/spec/notice_notifier_spec.rb +17 -17
- data/spec/notice_spec.rb +5 -5
- data/spec/performance_breakdown_spec.rb +11 -0
- data/spec/performance_notifier_spec.rb +171 -60
- data/spec/query_spec.rb +11 -1
- data/spec/queue_spec.rb +21 -0
- data/spec/request_spec.rb +11 -1
- data/spec/response_spec.rb +8 -8
- data/spec/spec_helper.rb +2 -2
- data/spec/stat_spec.rb +2 -2
- data/spec/sync_sender_spec.rb +12 -12
- data/spec/tdigest_spec.rb +6 -6
- data/spec/thread_pool_spec.rb +5 -5
- data/spec/timed_trace_spec.rb +1 -1
- data/spec/truncator_spec.rb +12 -12
- metadata +7 -2
@@ -19,8 +19,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
19
19
|
[/\Abin/],
|
20
20
|
[
|
21
21
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
22
|
-
{ bingo: 'bango', bongo: '[Filtered]', bash: '[Filtered]' }
|
23
|
-
]
|
22
|
+
{ bingo: 'bango', bongo: '[Filtered]', bash: '[Filtered]' },
|
23
|
+
],
|
24
24
|
)
|
25
25
|
end
|
26
26
|
|
@@ -30,8 +30,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
30
30
|
[:bongo],
|
31
31
|
[
|
32
32
|
{ bongo: 'bish', bash: 'bosh', bbashh: 'bboshh' },
|
33
|
-
{ bongo: 'bish', bash: '[Filtered]', bbashh: '[Filtered]' }
|
34
|
-
]
|
33
|
+
{ bongo: 'bish', bash: '[Filtered]', bbashh: '[Filtered]' },
|
34
|
+
],
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
@@ -41,8 +41,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
41
41
|
['bash'],
|
42
42
|
[
|
43
43
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
44
|
-
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: 'bosh' }
|
45
|
-
]
|
44
|
+
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: 'bosh' },
|
45
|
+
],
|
46
46
|
)
|
47
47
|
end
|
48
48
|
|
@@ -53,8 +53,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
53
53
|
[proc { 'bongo' }, :bash],
|
54
54
|
[
|
55
55
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
56
|
-
{ bingo: '[Filtered]', bongo: 'bish', bash: 'bosh' }
|
57
|
-
]
|
56
|
+
{ bingo: '[Filtered]', bongo: 'bish', bash: 'bosh' },
|
57
|
+
],
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
@@ -64,13 +64,13 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
64
64
|
[proc { Object.new }],
|
65
65
|
[
|
66
66
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
67
|
-
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' }
|
68
|
-
]
|
67
|
+
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
|
68
|
+
],
|
69
69
|
)
|
70
70
|
|
71
71
|
it "logs an error" do
|
72
72
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
73
|
-
/KeysWhitelist is invalid.+patterns: \[#<Object:.+>\]
|
73
|
+
/KeysWhitelist is invalid.+patterns: \[#<Object:.+>\]/,
|
74
74
|
)
|
75
75
|
keys_whitelist = described_class.new(patterns)
|
76
76
|
keys_whitelist.call(notice)
|
@@ -83,7 +83,7 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
83
83
|
context "and when the filter is called once" do
|
84
84
|
it "logs an error" do
|
85
85
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
86
|
-
/KeysWhitelist is invalid.+patterns: \[#<Proc:.+>\]
|
86
|
+
/KeysWhitelist is invalid.+patterns: \[#<Proc:.+>\]/,
|
87
87
|
)
|
88
88
|
keys_whitelist = described_class.new(patterns)
|
89
89
|
keys_whitelist.call(notice)
|
@@ -94,8 +94,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
94
94
|
[proc { proc { ['bingo'] } }],
|
95
95
|
[
|
96
96
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
97
|
-
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' }
|
98
|
-
]
|
97
|
+
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
|
98
|
+
],
|
99
99
|
)
|
100
100
|
end
|
101
101
|
end
|
@@ -107,13 +107,13 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
107
107
|
[Object.new],
|
108
108
|
[
|
109
109
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
110
|
-
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' }
|
111
|
-
]
|
110
|
+
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
|
111
|
+
],
|
112
112
|
)
|
113
113
|
|
114
114
|
it "logs an error" do
|
115
115
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
116
|
-
/KeysWhitelist is invalid.+patterns: \[#<Object:.+>\]
|
116
|
+
/KeysWhitelist is invalid.+patterns: \[#<Object:.+>\]/,
|
117
117
|
)
|
118
118
|
keys_whitelist = described_class.new(patterns)
|
119
119
|
keys_whitelist.call(notice)
|
@@ -127,8 +127,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
127
127
|
%w[bongo bish],
|
128
128
|
[
|
129
129
|
{ bingo: 'bango', bongo: { bish: 'bash' } },
|
130
|
-
{ bingo: '[Filtered]', bongo: { bish: 'bash' } }
|
131
|
-
]
|
130
|
+
{ bingo: '[Filtered]', bongo: { bish: 'bash' } },
|
131
|
+
],
|
132
132
|
)
|
133
133
|
end
|
134
134
|
|
@@ -166,7 +166,7 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
166
166
|
notice[:context][:url] = 'http://localhost:3000/crash?foo=bar&baz=bongo&bish=bash'
|
167
167
|
subject.call(notice)
|
168
168
|
expect(notice[:context][:url]).to(
|
169
|
-
eq('http://localhost:3000/crash?foo=[Filtered]&baz=[Filtered]&bish=bash')
|
169
|
+
eq('http://localhost:3000/crash?foo=[Filtered]&baz=[Filtered]&bish=bash'),
|
170
170
|
)
|
171
171
|
end
|
172
172
|
end
|
@@ -177,7 +177,7 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
177
177
|
'http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'
|
178
178
|
subject.call(notice)
|
179
179
|
expect(notice[:context][:url]).to(
|
180
|
-
eq('http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash')
|
180
|
+
eq('http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'),
|
181
181
|
)
|
182
182
|
end
|
183
183
|
end
|
@@ -10,7 +10,7 @@ RSpec.describe Airbrake::Filters::RootDirectoryFilter do
|
|
10
10
|
{ file: "/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb" },
|
11
11
|
{ file: "#{root_directory}/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb " },
|
12
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" }
|
13
|
+
{ file: "#{root_directory}/gems/rspec-core-3.3.2/exe/rspec" },
|
14
14
|
]
|
15
15
|
# rubocop:enable Metrics/LineLength
|
16
16
|
|
@@ -23,9 +23,9 @@ RSpec.describe Airbrake::Filters::RootDirectoryFilter do
|
|
23
23
|
{ file: "/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb" },
|
24
24
|
{ file: "/PROJECT_ROOT/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb " },
|
25
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
|
-
)
|
26
|
+
{ file: "/PROJECT_ROOT/gems/rspec-core-3.3.2/exe/rspec" },
|
27
|
+
],
|
28
|
+
),
|
29
29
|
)
|
30
30
|
# rubocop:enable Metrics/LineLength
|
31
31
|
end
|
@@ -33,7 +33,7 @@ RSpec.describe Airbrake::Filters::RootDirectoryFilter do
|
|
33
33
|
it "does not filter file when it is nil" do
|
34
34
|
expect(notice[:errors].first[:file]).to be_nil
|
35
35
|
expect { subject.call(notice) }.not_to(
|
36
|
-
change { notice[:errors].first[:file] }
|
36
|
+
change { notice[:errors].first[:file] },
|
37
37
|
)
|
38
38
|
end
|
39
39
|
end
|
@@ -14,7 +14,7 @@ RSpec.describe Airbrake::Filters::SqlFilter do
|
|
14
14
|
it "ignores '#{query}'" do
|
15
15
|
filter = described_class.new('postgres')
|
16
16
|
q = Airbrake::Query.new(
|
17
|
-
query: query, method: 'GET', route: '/', start_time: Time.now
|
17
|
+
query: query, method: 'GET', route: '/', start_time: Time.now,
|
18
18
|
)
|
19
19
|
filter.call(q)
|
20
20
|
|
@@ -29,204 +29,204 @@ RSpec.describe Airbrake::Filters::SqlFilter do
|
|
29
29
|
{
|
30
30
|
input: 'SELECT * FROM things;',
|
31
31
|
output: 'SELECT * FROM things;',
|
32
|
-
dialects: ALL_DIALECTS
|
32
|
+
dialects: ALL_DIALECTS,
|
33
33
|
}, {
|
34
34
|
input: "SELECT `t001`.`c2` FROM `t001` WHERE `t001`.`c2` = 'value' AND c3=\"othervalue\" LIMIT ?",
|
35
35
|
output: "SELECT `t001`.`c2` FROM `t001` WHERE `t001`.`c2` = ? AND c3=? LIMIT ?",
|
36
|
-
dialects: %i[mysql]
|
36
|
+
dialects: %i[mysql],
|
37
37
|
}, {
|
38
38
|
input: "SELECT * FROM t WHERE foo=\"bar/*\" AND baz=\"whatever */qux\"",
|
39
39
|
output: "SELECT * FROM t WHERE foo=? AND baz=?",
|
40
|
-
dialects: %i[mysql]
|
40
|
+
dialects: %i[mysql],
|
41
41
|
}, {
|
42
42
|
input: "SELECT * FROM t WHERE foo='bar/*' AND baz='whatever */qux'",
|
43
43
|
output: "SELECT * FROM t WHERE foo=? AND baz=?",
|
44
|
-
dialects: ALL_DIALECTS
|
44
|
+
dialects: ALL_DIALECTS,
|
45
45
|
}, {
|
46
46
|
input: "SELECT \"t001\".\"c2\" FROM \"t001\" WHERE \"t001\".\"c2\" = 'value' AND c3=1234 LIMIT 1",
|
47
47
|
output: "SELECT \"t001\".\"c2\" FROM \"t001\" WHERE \"t001\".\"c2\" = ? AND c3=? LIMIT ?",
|
48
|
-
dialects: %i[postgres oracle]
|
48
|
+
dialects: %i[postgres oracle],
|
49
49
|
}, {
|
50
50
|
input: "SELECT * FROM t WHERE foo=\"bar--\" AND\n baz=\"qux--\"",
|
51
51
|
output: "SELECT * FROM t WHERE foo=? AND\n baz=?",
|
52
|
-
dialects: %i[mysql]
|
52
|
+
dialects: %i[mysql],
|
53
53
|
}, {
|
54
54
|
input: "SELECT * FROM t WHERE foo='bar--' AND\n baz='qux--'",
|
55
55
|
output: "SELECT * FROM t WHERE foo=? AND\n baz=?",
|
56
|
-
dialects: ALL_DIALECTS
|
56
|
+
dialects: ALL_DIALECTS,
|
57
57
|
}, {
|
58
58
|
input: "SELECT * FROM foo WHERE bar='baz' /* Hide Me */",
|
59
59
|
output: "SELECT * FROM foo WHERE bar=? ?",
|
60
|
-
dialects: ALL_DIALECTS
|
60
|
+
dialects: ALL_DIALECTS,
|
61
61
|
}, {
|
62
62
|
input: "SELECT * FROM foobar WHERE password='hunter2'\n-- No peeking!",
|
63
63
|
output: "SELECT * FROM foobar WHERE password=?\n?",
|
64
|
-
dialects: ALL_DIALECTS
|
64
|
+
dialects: ALL_DIALECTS,
|
65
65
|
}, {
|
66
66
|
input: "SELECT foo, bar FROM baz WHERE password='hunter2' # Secret",
|
67
67
|
output: "SELECT foo, bar FROM baz WHERE password=? ?",
|
68
|
-
dialects: ALL_DIALECTS
|
68
|
+
dialects: ALL_DIALECTS,
|
69
69
|
}, {
|
70
70
|
input: "SELECT \"col1\", \"col2\" from \"table\" WHERE \"col3\"=E'foo\\'bar\\\\baz' AND country=e'foo\\'bar\\\\baz'",
|
71
71
|
output: "SELECT \"col1\", \"col2\" from \"table\" WHERE \"col3\"=E?",
|
72
|
-
dialects: %i[postgres]
|
72
|
+
dialects: %i[postgres],
|
73
73
|
}, {
|
74
74
|
input: "INSERT INTO `X` values(\"test\",0, 1 , 2, 'test')",
|
75
75
|
output: "INSERT INTO `X` values(?)",
|
76
|
-
dialects: %i[mysql]
|
76
|
+
dialects: %i[mysql],
|
77
77
|
}, {
|
78
78
|
input: "INSERT INTO `X` values(\"test\",0, 1 , 2, 'test')",
|
79
79
|
output: "INSERT INTO `X` values(?)",
|
80
|
-
dialects: %i[mysql]
|
80
|
+
dialects: %i[mysql],
|
81
81
|
}, {
|
82
82
|
input: "SELECT c11.col1, c22.col2 FROM table c11, table c22 WHERE value='nothing'",
|
83
83
|
output: "SELECT c11.col1, c22.col2 FROM table c11, table c22 WHERE value=?",
|
84
|
-
dialects: ALL_DIALECTS
|
84
|
+
dialects: ALL_DIALECTS,
|
85
85
|
}, {
|
86
86
|
input: "INSERT INTO X VALUES(1, 23456, 123.456, 99+100)",
|
87
87
|
output: "INSERT INTO X VALUES(?)",
|
88
|
-
dialects: ALL_DIALECTS
|
88
|
+
dialects: ALL_DIALECTS,
|
89
89
|
}, {
|
90
90
|
input: "SELECT * FROM table WHERE name=\"foo\" AND value=\"don't\"",
|
91
91
|
output: "SELECT * FROM table WHERE name=? AND value=?",
|
92
|
-
dialects: %i[mysql]
|
92
|
+
dialects: %i[mysql],
|
93
93
|
}, {
|
94
94
|
input: "SELECT * FROM table WHERE name='foo' AND value = 'bar'",
|
95
95
|
output: "SELECT * FROM table WHERE name=? AND value = ?",
|
96
|
-
dialects: ALL_DIALECTS
|
96
|
+
dialects: ALL_DIALECTS,
|
97
97
|
}, {
|
98
98
|
input: "SELECT * FROM table WHERE col='foo\\''bar'",
|
99
99
|
output: "SELECT * FROM table WHERE col=?",
|
100
|
-
dialects: ALL_DIALECTS
|
100
|
+
dialects: ALL_DIALECTS,
|
101
101
|
}, {
|
102
102
|
input: "SELECT * FROM table WHERE col1='foo\"bar' AND col2='what\"ever'",
|
103
103
|
output: "SELECT * FROM table WHERE col1=? AND col2=?",
|
104
|
-
dialects: ALL_DIALECTS
|
104
|
+
dialects: ALL_DIALECTS,
|
105
105
|
}, {
|
106
106
|
input: "select * from accounts where accounts.name != 'dude\n newline' order by accounts.name",
|
107
107
|
output: "select * from accounts where accounts.name != ? order by accounts.name",
|
108
|
-
dialects: ALL_DIALECTS
|
108
|
+
dialects: ALL_DIALECTS,
|
109
109
|
}, {
|
110
110
|
input: "SELECT * FROM table WHERE col1=\"don't\" AND col2=\"won't\"",
|
111
111
|
output: "SELECT * FROM table WHERE col1=? AND col2=?",
|
112
|
-
dialects: %i[mysql]
|
112
|
+
dialects: %i[mysql],
|
113
113
|
}, {
|
114
114
|
input: "INSERT INTO X values('', 'jim''s ssn',0, 1 , 'jim''s son''s son', \"\"\"jim''s\"\" hat\", \"\\\"jim''s secret\\\"\")",
|
115
115
|
output: "INSERT INTO X values(?, ?,?, ? , ?, ?, ?",
|
116
|
-
dialects: %i[mysql]
|
116
|
+
dialects: %i[mysql],
|
117
117
|
}, {
|
118
118
|
input: "SELECT * FROM table WHERE name='foo\\' AND color='blue'",
|
119
119
|
output: "SELECT * FROM table WHERE name=?",
|
120
|
-
dialects: ALL_DIALECTS
|
120
|
+
dialects: ALL_DIALECTS,
|
121
121
|
}, {
|
122
122
|
input: "SELECT * FROM table WHERE foo=\"this string ends with a backslash\\\\\"",
|
123
123
|
output: "SELECT * FROM table WHERE foo=?",
|
124
|
-
dialects: %i[mysql]
|
124
|
+
dialects: %i[mysql],
|
125
125
|
}, {
|
126
126
|
input: "SELECT * FROM table WHERE foo='this string ends with a backslash\\\\'",
|
127
127
|
output: "SELECT * FROM table WHERE foo=?",
|
128
|
-
dialects: ALL_DIALECTS
|
128
|
+
dialects: ALL_DIALECTS,
|
129
129
|
}, {
|
130
130
|
# TODO: fix this example.
|
131
131
|
input: "SELECT * FROM table WHERE name='foo\'' AND color='blue'",
|
132
132
|
output: "Error: Airbrake::Query was not filtered",
|
133
|
-
dialects: ALL_DIALECTS
|
133
|
+
dialects: ALL_DIALECTS,
|
134
134
|
}, {
|
135
135
|
input: "INSERT INTO X values('', 'a''b c',0, 1 , 'd''e f''s h')",
|
136
136
|
output: "INSERT INTO X values(?)",
|
137
|
-
dialects: ALL_DIALECTS
|
137
|
+
dialects: ALL_DIALECTS,
|
138
138
|
}, {
|
139
139
|
input: "SELECT * FROM t WHERE -- '\n bar='baz' -- '",
|
140
140
|
output: "SELECT * FROM t WHERE ?\n bar=? ?",
|
141
|
-
dialects: ALL_DIALECTS
|
141
|
+
dialects: ALL_DIALECTS,
|
142
142
|
}, {
|
143
143
|
input: "SELECT * FROM t WHERE /* ' */\n bar='baz' -- '",
|
144
144
|
output: "SELECT * FROM t WHERE ?\n bar=? ?",
|
145
|
-
dialects: ALL_DIALECTS
|
145
|
+
dialects: ALL_DIALECTS,
|
146
146
|
}, {
|
147
147
|
input: "SELECT * FROM t WHERE -- '\n /* ' */ c2='xxx' /* ' */\n c='x\n xx' -- '",
|
148
148
|
output: "SELECT * FROM t WHERE ?\n ? c2=? ?\n c=? ?",
|
149
|
-
dialects: ALL_DIALECTS
|
149
|
+
dialects: ALL_DIALECTS,
|
150
150
|
}, {
|
151
151
|
input: "SELECT * FROM t WHERE -- '\n c='x\n xx' -- '",
|
152
152
|
output: "SELECT * FROM t WHERE ?\n c=? ?",
|
153
|
-
dialects: ALL_DIALECTS
|
153
|
+
dialects: ALL_DIALECTS,
|
154
154
|
}, {
|
155
155
|
input: "SELECT * FROM foo WHERE col='value1' AND /* don't */ col2='value1' /* won't */",
|
156
156
|
output: "SELECT * FROM foo WHERE col=? AND ? col2=? ?",
|
157
|
-
dialects: ALL_DIALECTS
|
157
|
+
dialects: ALL_DIALECTS,
|
158
158
|
}, {
|
159
159
|
input: "SELECT * FROM table WHERE foo='bar' AND baz=\"nothing to see here'",
|
160
160
|
output: "Error: Airbrake::Query was not filtered",
|
161
|
-
dialects: %i[mysql]
|
161
|
+
dialects: %i[mysql],
|
162
162
|
}, {
|
163
163
|
input: "SELECT * FROM table WHERE foo='bar' AND baz='nothing to see here",
|
164
164
|
output: "Error: Airbrake::Query was not filtered",
|
165
|
-
dialects: ALL_DIALECTS
|
165
|
+
dialects: ALL_DIALECTS,
|
166
166
|
}, {
|
167
167
|
input: "SELECT * FROM \"foo\" WHERE \"foo\" = $a$dollar quotes can be $b$nested$b$$a$ and bar = 'baz'",
|
168
168
|
output: "SELECT * FROM \"foo\" WHERE \"foo\" = ? and bar = ?",
|
169
|
-
dialects: %i[postgres]
|
169
|
+
dialects: %i[postgres],
|
170
170
|
}, {
|
171
171
|
input: "INSERT INTO \"foo\" (\"bar\", \"baz\", \"qux\") VALUES ($1, $2, $3) RETURNING \"id\"",
|
172
172
|
output: "INSERT INTO \"foo\" (?) RETURNING \"id\"",
|
173
|
-
dialects: %i[postgres]
|
173
|
+
dialects: %i[postgres],
|
174
174
|
}, {
|
175
175
|
input: "select * from foo where bar = 'some\\tthing' and baz = 10",
|
176
176
|
output: "select * from foo where bar = ? and baz = ?",
|
177
|
-
dialects: ALL_DIALECTS
|
177
|
+
dialects: ALL_DIALECTS,
|
178
178
|
}, {
|
179
179
|
input: "select * from users where user = 'user1\\' password = 'hunter 2' -- ->don't count this quote",
|
180
180
|
output: "select * from users where user = ?",
|
181
|
-
dialects: ALL_DIALECTS
|
181
|
+
dialects: ALL_DIALECTS,
|
182
182
|
}, {
|
183
183
|
input: "select * from foo where bar=q'[baz's]' and x=5",
|
184
184
|
output: "select * from foo where bar=? and x=?",
|
185
|
-
dialects: %i[oracle]
|
185
|
+
dialects: %i[oracle],
|
186
186
|
}, {
|
187
187
|
input: "select * from foo where bar=q'{baz's}' and x=5",
|
188
188
|
output: "select * from foo where bar=? and x=?",
|
189
|
-
dialects: %i[oracle]
|
189
|
+
dialects: %i[oracle],
|
190
190
|
}, {
|
191
191
|
input: "select * from foo where bar=q'<baz's>' and x=5",
|
192
192
|
output: "select * from foo where bar=? and x=?",
|
193
|
-
dialects: %i[oracle]
|
193
|
+
dialects: %i[oracle],
|
194
194
|
}, {
|
195
195
|
input: "select * from foo where bar=q'(baz's)' and x=5",
|
196
196
|
output: "select * from foo where bar=? and x=?",
|
197
|
-
dialects: %i[oracle]
|
197
|
+
dialects: %i[oracle],
|
198
198
|
}, {
|
199
199
|
input: "select * from foo where bar=0xabcdef123 and x=5",
|
200
200
|
output: "select * from foo where bar=? and x=?",
|
201
|
-
dialects: %i[cassandra sqlite]
|
201
|
+
dialects: %i[cassandra sqlite],
|
202
202
|
}, {
|
203
203
|
input: "select * from foo where bar=0x2F and x=5",
|
204
204
|
output: "select * from foo where bar=? and x=?",
|
205
|
-
dialects: %i[mysql cassandra sqlite]
|
205
|
+
dialects: %i[mysql cassandra sqlite],
|
206
206
|
}, {
|
207
207
|
input: "select * from foo where bar=1.234e-5 and x=5",
|
208
208
|
output: "select * from foo where bar=? and x=?",
|
209
|
-
dialects: ALL_DIALECTS
|
209
|
+
dialects: ALL_DIALECTS,
|
210
210
|
}, {
|
211
211
|
input: "select * from foo where bar=01234567-89ab-cdef-0123-456789abcdef and x=5",
|
212
212
|
output: "select * from foo where bar=? and x=?",
|
213
|
-
dialects: %i[postgres cassandra]
|
213
|
+
dialects: %i[postgres cassandra],
|
214
214
|
}, {
|
215
215
|
input: "select * from foo where bar={01234567-89ab-cdef-0123-456789abcdef} and x=5",
|
216
216
|
output: "select * from foo where bar=? and x=?",
|
217
|
-
dialects: %i[postgres]
|
217
|
+
dialects: %i[postgres],
|
218
218
|
}, {
|
219
219
|
input: "select * from foo where bar=0123456789abcdef0123456789abcdef and x=5",
|
220
220
|
output: "select * from foo where bar=? and x=?",
|
221
|
-
dialects: %i[postgtes]
|
221
|
+
dialects: %i[postgtes],
|
222
222
|
}, {
|
223
223
|
input: "select * from foo where bar={012-345678-9abc-def012345678-9abcdef} and x=5",
|
224
224
|
output: "select * from foo where bar=? and x=?",
|
225
|
-
dialects: %i[postgres]
|
225
|
+
dialects: %i[postgres],
|
226
226
|
}, {
|
227
227
|
input: "select * from foo where bar=true and x=FALSE",
|
228
228
|
output: "select * from foo where bar=? and x=?",
|
229
|
-
dialects: %i[mysql postgres cassandra sqlite]
|
229
|
+
dialects: %i[mysql postgres cassandra sqlite],
|
230
230
|
}
|
231
231
|
].each do |test|
|
232
232
|
include_examples 'query filtering', test
|
@@ -263,13 +263,13 @@ RSpec.describe Airbrake::Filters::SqlFilter do
|
|
263
263
|
'oid = rngtypid WHERE t.typname IN (?) OR t.typtype IN (?) OR t.typinput ' \
|
264
264
|
'= ?::regprocedure OR t.typelem != ?',
|
265
265
|
|
266
|
-
'SELECT t.oid, t.typname FROM pg_type as t WHERE t.typname IN (?)'
|
266
|
+
'SELECT t.oid, t.typname FROM pg_type as t WHERE t.typname IN (?)',
|
267
267
|
].each do |query|
|
268
268
|
include_examples 'query blacklisting', query, should_ignore: true
|
269
269
|
end
|
270
270
|
|
271
271
|
[
|
272
|
-
'UPDATE "users" SET "last_sign_in_at" = ? WHERE "users"."id" = ?'
|
272
|
+
'UPDATE "users" SET "last_sign_in_at" = ? WHERE "users"."id" = ?',
|
273
273
|
].each do |query|
|
274
274
|
include_examples 'query blacklisting', query, should_ignore: false
|
275
275
|
end
|
@@ -2,7 +2,7 @@ RSpec.describe Airbrake::Filters::SystemExitFilter do
|
|
2
2
|
it "marks SystemExit exceptions as ignored" do
|
3
3
|
notice = Airbrake::Notice.new(SystemExit.new)
|
4
4
|
expect { subject.call(notice) }.to(
|
5
|
-
change { notice.ignored? }.from(false).to(true)
|
5
|
+
change { notice.ignored? }.from(false).to(true),
|
6
6
|
)
|
7
7
|
end
|
8
8
|
|
@@ -77,13 +77,13 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
77
77
|
{
|
78
78
|
bish: {
|
79
79
|
bash: 'foo',
|
80
|
-
bosh: Object.new
|
81
|
-
}
|
82
|
-
}
|
83
|
-
]
|
84
|
-
}
|
80
|
+
bosh: Object.new,
|
81
|
+
},
|
82
|
+
},
|
83
|
+
],
|
84
|
+
},
|
85
85
|
},
|
86
|
-
123
|
86
|
+
123,
|
87
87
|
]
|
88
88
|
end
|
89
89
|
|
@@ -103,15 +103,15 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
103
103
|
{
|
104
104
|
bish: {
|
105
105
|
bash: 'foo',
|
106
|
-
bosh: /\A#<Object:.+>\z
|
107
|
-
}
|
108
|
-
}
|
109
|
-
]
|
110
|
-
}
|
106
|
+
bosh: /\A#<Object:.+>\z/,
|
107
|
+
},
|
108
|
+
},
|
109
|
+
],
|
110
|
+
},
|
111
111
|
},
|
112
|
-
123
|
113
|
-
]
|
114
|
-
)
|
112
|
+
123,
|
113
|
+
],
|
114
|
+
),
|
115
115
|
)
|
116
116
|
end
|
117
117
|
end
|
@@ -194,13 +194,13 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
194
194
|
{
|
195
195
|
bish: {
|
196
196
|
bash: 'foo',
|
197
|
-
bosh: Object.new
|
198
|
-
}
|
199
|
-
}
|
200
|
-
]
|
201
|
-
}
|
197
|
+
bosh: Object.new,
|
198
|
+
},
|
199
|
+
},
|
200
|
+
],
|
201
|
+
},
|
202
202
|
},
|
203
|
-
123
|
203
|
+
123,
|
204
204
|
]
|
205
205
|
end
|
206
206
|
|
@@ -220,15 +220,15 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
220
220
|
{
|
221
221
|
bish: {
|
222
222
|
bash: 'foo',
|
223
|
-
bosh: /\A#<Object:.+>\z
|
224
|
-
}
|
225
|
-
}
|
226
|
-
]
|
227
|
-
}
|
223
|
+
bosh: /\A#<Object:.+>\z/,
|
224
|
+
},
|
225
|
+
},
|
226
|
+
],
|
227
|
+
},
|
228
228
|
},
|
229
|
-
123
|
230
|
-
]
|
231
|
-
)
|
229
|
+
123,
|
230
|
+
],
|
231
|
+
),
|
232
232
|
)
|
233
233
|
end
|
234
234
|
end
|