blinkist-airbrake-scrubber 4.0.1 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/lib/blinkist-airbrake-scrubber.rb +1 -1
- data/lib/blinkist-airbrake-scrubber/scrubbers/message_email.rb +1 -1
- data/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens.rb +17 -0
- data/lib/blinkist-airbrake-scrubber/version.rb +1 -1
- data/spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens_spec.rb +56 -0
- data/spec/specs/version_spec.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 481351d1dcfaacbac3c90de8d56a3ec874ffa06ad7a594d28e8c2d836ad9017d
|
4
|
+
data.tar.gz: ef6af4052741c1608fa7ebefaacaca7590d33b1a5eaf97dc82c6698d080145b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e94893b4853f603fe92f21bbcadeaf281585cfd153b6fc458a6178e5331bd9da24b1842b6de2e4a3fefc8ea066b1519ff253c3351dd820fda2eb4768a4e236f
|
7
|
+
data.tar.gz: 71cdc6db850e77c69cff4010507a7c2977664bd46c70d62a9fef6b800a25ac8f48966791528755d2656c97566c71b51e7ebf52bf7442ffd760fd3325290a39ff
|
data/Gemfile
CHANGED
@@ -15,7 +15,7 @@ end
|
|
15
15
|
module Blinkist
|
16
16
|
module AirbrakeScrubber
|
17
17
|
FILTERED = '[Filtered]'
|
18
|
-
SCRUBBERS = [ MessageEmail, ParamsEmail, ParamsPassword ]
|
18
|
+
SCRUBBERS = [ MessageEmail, ParamsEmail, ParamsPassword, ParamsTokens ]
|
19
19
|
|
20
20
|
# Override original Airbrake.configure
|
21
21
|
def configure(*args, &block)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Blinkist
|
2
|
+
module AirbrakeScrubber
|
3
|
+
class ParamsTokens
|
4
|
+
|
5
|
+
def self.scrub!
|
6
|
+
::Airbrake.add_filter do |notice|
|
7
|
+
notice[:params] = DeepTraversal.new(notice[:params]).traverse do |key, value|
|
8
|
+
value = FILTERED if %w( facebook_access_token google_id_token ).include?(key.to_s)
|
9
|
+
value
|
10
|
+
end
|
11
|
+
notice
|
12
|
+
end
|
13
|
+
end # def self.scrub!
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Blinkist::AirbrakeScrubber::ParamsTokens do
|
4
|
+
let(:notice) {
|
5
|
+
Airbrake.build_notice(
|
6
|
+
Exception.new('whatever'),
|
7
|
+
{ google_id_token: 'blahblah', facebook_access_token: 'whatever', param: 'whatever' }
|
8
|
+
)
|
9
|
+
}
|
10
|
+
|
11
|
+
describe "Structure" do
|
12
|
+
it "has scrub! method" do
|
13
|
+
expect(described_class).to respond_to(:scrub!)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "self.scrub!" do
|
18
|
+
it "adds the filter" do
|
19
|
+
expect(Airbrake).to receive(:add_filter)
|
20
|
+
described_class::scrub!
|
21
|
+
end
|
22
|
+
|
23
|
+
it "scrubs the google_id_token from the params hash" do
|
24
|
+
Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
|
25
|
+
expect(notice[:params][:google_id_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "scrubs the deep-nested google_id_token from the params hash" do
|
29
|
+
notice = Airbrake.build_notice(
|
30
|
+
Exception.new('whatever'),
|
31
|
+
{ google_id_token: 'bahblah', deeply: { nested: { google_id_token: 'blhablah' } } }
|
32
|
+
)
|
33
|
+
|
34
|
+
Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
|
35
|
+
expect(notice[:params][:google_id_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
36
|
+
expect(notice[:params][:deeply][:nested][:google_id_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "scrubs the facebook_access_token from the params hash" do
|
40
|
+
Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
|
41
|
+
expect(notice[:params][:facebook_access_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "scrubs the deep-nested facebook_access_token from the params hash" do
|
45
|
+
notice = Airbrake.build_notice(
|
46
|
+
Exception.new('whatever'),
|
47
|
+
{ facebook_access_token: 'bahblah', deeply: { nested: { facebook_access_token: 'blhablah' } } }
|
48
|
+
)
|
49
|
+
|
50
|
+
Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
|
51
|
+
expect(notice[:params][:facebook_access_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
52
|
+
expect(notice[:params][:deeply][:nested][:facebook_access_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
data/spec/specs/version_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blinkist-airbrake-scrubber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paweł Komarnicki
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-08-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: airbrake
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/blinkist-airbrake-scrubber/scrubbers/message_email.rb
|
45
45
|
- lib/blinkist-airbrake-scrubber/scrubbers/params_email.rb
|
46
46
|
- lib/blinkist-airbrake-scrubber/scrubbers/params_password.rb
|
47
|
+
- lib/blinkist-airbrake-scrubber/scrubbers/params_tokens.rb
|
47
48
|
- lib/blinkist-airbrake-scrubber/version.rb
|
48
49
|
- spec/spec_helper.rb
|
49
50
|
- spec/specs/lib/blinkist-airbrake-scrubber/airbrake_spec.rb
|
@@ -51,6 +52,7 @@ files:
|
|
51
52
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/message_email_spec.rb
|
52
53
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_email_spec.rb
|
53
54
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_password_spec.rb
|
55
|
+
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens_spec.rb
|
54
56
|
- spec/specs/lib/blinkist_airbrake_scrubber_spec.rb
|
55
57
|
- spec/specs/version_spec.rb
|
56
58
|
homepage: https://github.com/blinkist/airbrake-scrubber
|
@@ -84,5 +86,6 @@ test_files:
|
|
84
86
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/message_email_spec.rb
|
85
87
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_email_spec.rb
|
86
88
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_password_spec.rb
|
89
|
+
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens_spec.rb
|
87
90
|
- spec/specs/lib/blinkist_airbrake_scrubber_spec.rb
|
88
91
|
- spec/specs/version_spec.rb
|