blinkist-airbrake-scrubber 4.0.0 → 4.4.0
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.
- checksums.yaml +4 -4
- data/Gemfile +5 -4
- data/README.md +6 -6
- data/Rakefile +3 -1
- data/blinkist-airbrake-scrubber.gemspec +8 -7
- data/lib/blinkist-airbrake-scrubber.rb +6 -4
- data/lib/blinkist-airbrake-scrubber/deep_traversal.rb +6 -6
- data/lib/blinkist-airbrake-scrubber/scrubbers/message_email.rb +5 -3
- data/lib/blinkist-airbrake-scrubber/scrubbers/params_email.rb +3 -1
- data/lib/blinkist-airbrake-scrubber/scrubbers/params_password.rb +3 -1
- data/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens.rb +19 -0
- data/lib/blinkist-airbrake-scrubber/version.rb +3 -1
- data/spec/spec_helper.rb +3 -1
- data/spec/specs/lib/blinkist-airbrake-scrubber/airbrake_spec.rb +3 -1
- data/spec/specs/lib/blinkist-airbrake-scrubber/deep_traversal_spec.rb +9 -7
- data/spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/message_email_spec.rb +11 -11
- data/spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_email_spec.rb +3 -2
- data/spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_password_spec.rb +3 -2
- data/spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens_spec.rb +57 -0
- data/spec/specs/lib/blinkist_airbrake_scrubber_spec.rb +3 -2
- data/spec/specs/version_spec.rb +3 -4
- metadata +16 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a0e42d72d8acd027fad8147d1bd697eef7d41829c36f38148fbed6686d3c8f3
|
4
|
+
data.tar.gz: 798889fa81a817f1aa4e680169e45de6932c6e02d116c3c512524e50dd20567b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a421af5938ae7e9ba863dbc65a7d3b76dcb5f6a6d70c697552c025bf52d14efe65fdacf0da65d1a015cc35885c57bf5470e8ef78151534a98e7dd3305f6d340c
|
7
|
+
data.tar.gz: df109fae2a3eca07725bf09888ae428be62196897490c70fa84b7126047930836604839ee0d509f8d8c5abc12759c0b4b2a54cb4109fdbc987420242720dbd1c
|
data/Gemfile
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
git_source(:github) { |repo| "https://github.com/blinkist/#{repo}.git" }
|
5
5
|
|
6
6
|
group :test do
|
7
|
-
gem "
|
7
|
+
gem "dotenv"
|
8
|
+
gem "forgery"
|
8
9
|
gem "rack"
|
10
|
+
gem "rake"
|
9
11
|
gem "rspec"
|
10
|
-
gem "
|
12
|
+
gem "rspec_junit_formatter"
|
11
13
|
gem "simplecov"
|
12
|
-
gem "dotenv"
|
13
14
|
end
|
14
15
|
|
15
16
|
group :development, :test do
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Blinkist::AirbrakeScrubber
|
2
2
|
|
3
|
-
Blinkist::AirbrakeScrubber provides an Airbrake scrubbing service to remove various sensitive informations from the notifications, e.g. emails. It does
|
3
|
+
Blinkist::AirbrakeScrubber provides an Airbrake scrubbing service to remove various sensitive informations from the notifications, e.g. emails. It does _not_ replace Airbrake configuration, but provides some seamless functionality.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -28,7 +28,7 @@ module Blinkist::AirbrakeScrubber
|
|
28
28
|
# Rainbows and unicorns come here:
|
29
29
|
notice[:errors].each { |error| error[:message].gsub!(REGEXP, FILTERED) }
|
30
30
|
end
|
31
|
-
end
|
31
|
+
end
|
32
32
|
|
33
33
|
end
|
34
34
|
end
|
@@ -38,16 +38,16 @@ Then, add the class to Blinkist::AirbrakeScrubber's SCRUBBERS list to have it ra
|
|
38
38
|
|
39
39
|
### Dependencies
|
40
40
|
|
41
|
-
This gem has dependency on airbrake (
|
41
|
+
This gem has dependency on airbrake (>= 9), it will automatically add it unless already bundled.
|
42
42
|
|
43
43
|
## Maintainers
|
44
44
|
|
45
|
-
|
45
|
+
- Blinkist (https://github.com/blinkist)
|
46
46
|
|
47
47
|
## Special thanks
|
48
48
|
|
49
|
-
|
49
|
+
- Tomek Przedmojski (https://github.com/tprzedmojski) for providing a brilliant way to use Module#prepend :-)
|
50
50
|
|
51
51
|
## License
|
52
52
|
|
53
|
-
Copyright
|
53
|
+
Copyright 2021 Blinks Labs GmbH. https://blinkist.com
|
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
3
4
|
|
4
5
|
require_relative "lib/blinkist-airbrake-scrubber/version"
|
@@ -6,17 +7,17 @@ require_relative "lib/blinkist-airbrake-scrubber/version"
|
|
6
7
|
Gem::Specification.new do |gem|
|
7
8
|
gem.name = "blinkist-airbrake-scrubber"
|
8
9
|
gem.version = Blinkist::AirbrakeScrubber::VERSION
|
9
|
-
gem.authors = ["
|
10
|
-
gem.email = ["
|
11
|
-
gem.description =
|
12
|
-
gem.summary =
|
10
|
+
gem.authors = ["Blinkist"]
|
11
|
+
gem.email = ["operations@blinkist.com"]
|
12
|
+
gem.description = 'Email scrubbing configuration for Airbrake at Blinkist'
|
13
|
+
gem.summary = 'With this, Airbrake will not leak emails via exception notifications'
|
13
14
|
gem.homepage = "https://github.com/blinkist/airbrake-scrubber"
|
14
15
|
gem.license = "MIT"
|
15
16
|
|
16
17
|
# Airbrake
|
17
|
-
gem.add_dependency "airbrake"
|
18
|
+
gem.add_dependency "airbrake", ">= 9", "< 12"
|
18
19
|
|
19
20
|
gem.files = Dir["{lib,spec}/**/*", "README.md", "Rakefile", "Gemfile", "*.gemspec"]
|
20
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
21
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
21
22
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
23
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'airbrake'
|
2
|
-
Dir[File.expand_path('
|
4
|
+
Dir[File.expand_path('../lib/**/*.rb', __dir__)].sort.each do |f|
|
3
5
|
require f
|
4
6
|
end
|
5
7
|
|
@@ -15,10 +17,10 @@ end
|
|
15
17
|
module Blinkist
|
16
18
|
module AirbrakeScrubber
|
17
19
|
FILTERED = '[Filtered]'
|
18
|
-
SCRUBBERS = [
|
20
|
+
SCRUBBERS = [MessageEmail, ParamsEmail, ParamsPassword, ParamsTokens].freeze
|
19
21
|
|
20
22
|
# Override original Airbrake.configure
|
21
|
-
def configure(*
|
23
|
+
def configure(*_args, &block)
|
22
24
|
super(&block)
|
23
25
|
ensure
|
24
26
|
Blinkist::AirbrakeScrubber.run!
|
@@ -26,7 +28,7 @@ module Blinkist
|
|
26
28
|
|
27
29
|
# Run scrubbers
|
28
30
|
def self.run!
|
29
|
-
SCRUBBERS.each
|
31
|
+
SCRUBBERS.each(&:scrub!)
|
30
32
|
end
|
31
33
|
|
32
34
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# DeepTraversal provides traverse possibility of Hashes
|
2
4
|
# Can handle Hash objects with deep nesting, or other nested objects that can be dug deeper (e.g. Array)
|
3
5
|
module Blinkist
|
@@ -20,17 +22,15 @@ module Blinkist
|
|
20
22
|
input.map { |i| recursive_traverse(i, &block) }
|
21
23
|
|
22
24
|
when Hash
|
23
|
-
Hash[input.map
|
24
|
-
|
25
|
+
Hash[input.map do |key, value|
|
25
26
|
# Go deeper for things that are not simple objects
|
26
27
|
case value
|
27
28
|
when Array, Hash
|
28
|
-
[
|
29
|
+
[key, recursive_traverse(value, &block)]
|
29
30
|
else
|
30
|
-
[
|
31
|
+
[key, block.call(key, value)]
|
31
32
|
end
|
32
|
-
|
33
|
-
}]
|
33
|
+
end]
|
34
34
|
else
|
35
35
|
input
|
36
36
|
end
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Blinkist
|
2
4
|
module AirbrakeScrubber
|
3
5
|
class MessageEmail
|
4
|
-
REGEXP = /[\S]+@[\S]+/i
|
6
|
+
REGEXP = /[\S]+@[\S]+/i.freeze
|
5
7
|
|
6
8
|
def self.scrub!
|
7
9
|
::Airbrake.add_filter do |notice|
|
8
10
|
# Cannot do gsub! coz of frozen literals
|
9
11
|
notice[:errors].each { |error| error[:message] = scrub(error[:message]) }
|
10
12
|
end
|
11
|
-
end
|
13
|
+
end
|
12
14
|
|
13
15
|
def self.scrub(message)
|
14
|
-
message
|
16
|
+
message&.gsub(REGEXP, FILTERED)
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blinkist
|
4
|
+
module AirbrakeScrubber
|
5
|
+
class ParamsTokens
|
6
|
+
|
7
|
+
def self.scrub!
|
8
|
+
::Airbrake.add_filter do |notice|
|
9
|
+
notice[:params] = DeepTraversal.new(notice[:params]).traverse do |key, value|
|
10
|
+
value = FILTERED if %w[facebook_access_token google_id_token].include?(key.to_s)
|
11
|
+
value
|
12
|
+
end
|
13
|
+
notice
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/setup'
|
2
4
|
|
3
5
|
require 'awesome_print'
|
@@ -14,7 +16,7 @@ require 'blinkist-airbrake-scrubber'
|
|
14
16
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
15
17
|
RSpec.configure do |config|
|
16
18
|
config.color = true
|
17
|
-
config.full_backtrace=true
|
19
|
+
config.full_backtrace = true
|
18
20
|
|
19
21
|
config.expect_with :rspec do |expectations|
|
20
22
|
expectations.syntax = :expect
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'blinkist-airbrake-scrubber'
|
3
5
|
|
4
6
|
describe Airbrake do
|
5
7
|
let(:instantiate_airbrake) {
|
6
|
-
Airbrake.configure :"notifier_#{
|
8
|
+
Airbrake.configure :"notifier_#{SecureRandom.uuid}" do |c|
|
7
9
|
c.project_id = 1
|
8
10
|
c.project_key = 'whatever'
|
9
11
|
end
|
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'blinkist-airbrake-scrubber'
|
3
5
|
|
4
6
|
describe Blinkist::AirbrakeScrubber::DeepTraversal do
|
5
7
|
subject { described_class.new(source) }
|
6
8
|
|
7
|
-
let(:source) {
|
9
|
+
let(:source) { {} }
|
8
10
|
|
9
11
|
describe ".traverse" do
|
10
12
|
it "calls .recursive_traverse" do
|
11
13
|
expect(subject).to receive(:recursive_traverse).with(source)
|
12
|
-
subject.traverse { |
|
14
|
+
subject.traverse { |_k, v| v }
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
@@ -22,7 +24,7 @@ describe Blinkist::AirbrakeScrubber::DeepTraversal do
|
|
22
24
|
end
|
23
25
|
|
24
26
|
it "filters out any keys" do
|
25
|
-
returned_object = subject.traverse { |k, v| %w
|
27
|
+
returned_object = subject.traverse { |k, v| %w[email password].include?(k.to_s) ? '[Filtered]' : v }
|
26
28
|
expect(returned_object).to eq({ email: '[Filtered]', password: '[Filtered]', param: true })
|
27
29
|
end
|
28
30
|
end
|
@@ -37,20 +39,20 @@ describe Blinkist::AirbrakeScrubber::DeepTraversal do
|
|
37
39
|
end
|
38
40
|
|
39
41
|
context "For hashes with arrays" do
|
40
|
-
let(:source) { { email: 'user@example.org', emails: [
|
42
|
+
let(:source) { { email: 'user@example.org', emails: [{ email: 'user@example.org' }, { email: 'user@example.org' }], whatever: [nil] } }
|
41
43
|
|
42
44
|
it "filters out all keys" do
|
43
45
|
returned_object = subject.traverse { |k, v| k.to_s == 'email' ? '[Filtered]' : v }
|
44
|
-
expect(returned_object).to eq({ email: '[Filtered]', emails: [
|
46
|
+
expect(returned_object).to eq({ email: '[Filtered]', emails: [{ email: '[Filtered]' }, { email: '[Filtered]' }], whatever: [nil] })
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
50
|
context "For arrays" do
|
49
|
-
let(:source) { [
|
51
|
+
let(:source) { [{ email: 'user@example.org' }, { email: 'user@example.org' }] }
|
50
52
|
|
51
53
|
it "filters out all keys" do
|
52
54
|
returned_object = subject.traverse { |k, v| k.to_s == 'email' ? '[Filtered]' : v }
|
53
|
-
expect(returned_object).to eq([
|
55
|
+
expect(returned_object).to eq([{ email: '[Filtered]' }, { email: '[Filtered]' }])
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Blinkist::AirbrakeScrubber::MessageEmail do
|
4
|
-
|
5
6
|
describe "Structure" do
|
6
7
|
it "has REGEXP constant" do
|
7
8
|
expect(described_class.constants).to include(:REGEXP)
|
@@ -13,7 +14,7 @@ describe Blinkist::AirbrakeScrubber::MessageEmail do
|
|
13
14
|
end
|
14
15
|
|
15
16
|
describe "self.scrub!" do
|
16
|
-
subject { described_class
|
17
|
+
subject { described_class.scrub! }
|
17
18
|
|
18
19
|
it "adds the filter" do
|
19
20
|
expect(Airbrake).to receive(:add_filter)
|
@@ -27,21 +28,21 @@ describe Blinkist::AirbrakeScrubber::MessageEmail do
|
|
27
28
|
let(:filtered) { Blinkist::AirbrakeScrubber::FILTERED }
|
28
29
|
let(:regexp) { described_class::REGEXP }
|
29
30
|
|
30
|
-
let(:valid_domains) { %w
|
31
|
-
let(:valid_usernames) { %w
|
31
|
+
let(:valid_domains) { %w[example.org exam-ple.org exam.ple.org e-xam.ple.org e-xam.p-le.org e.x.a.m.p.l.e.co.uk] }
|
32
|
+
let(:valid_usernames) { %w[username user.name user+name user-name user_name] }
|
32
33
|
let(:valid_emails) { valid_usernames.product(valid_domains).map { |row| row.join '@' } }
|
33
|
-
let(:invalid_emails) { %w
|
34
|
+
let(:invalid_emails) { %w[user@example user@example. user!@example.org us@r@example.org us&r@example.com] }
|
34
35
|
|
35
36
|
context "Pure email content" do
|
36
37
|
it "filters out valid emails" do
|
37
|
-
puts "Verifying: #{
|
38
|
+
puts "Verifying: #{valid_emails.join ', '}"
|
38
39
|
valid_emails.each do |email|
|
39
40
|
expect(described_class.scrub(email)).to eq(filtered)
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
44
|
it "filters out invalid emails" do
|
44
|
-
puts "Verifying: #{
|
45
|
+
puts "Verifying: #{invalid_emails.join ', '}"
|
45
46
|
invalid_emails.each do |email|
|
46
47
|
expect(described_class.scrub(email)).to eq(filtered)
|
47
48
|
end
|
@@ -52,7 +53,7 @@ describe Blinkist::AirbrakeScrubber::MessageEmail do
|
|
52
53
|
let(:text) { "Erorr bla bla EMAIL bla bla bla" }
|
53
54
|
|
54
55
|
it "filters out valid emails" do
|
55
|
-
puts "Verifying: #{
|
56
|
+
puts "Verifying: #{valid_emails.join ', '}"
|
56
57
|
valid_emails.each do |email|
|
57
58
|
content = text.gsub('EMAIL', email)
|
58
59
|
expect(described_class.scrub(content)).to eq(text.gsub('EMAIL', filtered))
|
@@ -60,7 +61,7 @@ describe Blinkist::AirbrakeScrubber::MessageEmail do
|
|
60
61
|
end
|
61
62
|
|
62
63
|
it "filters out invalid emails" do
|
63
|
-
puts "Verifying: #{
|
64
|
+
puts "Verifying: #{invalid_emails.join ', '}"
|
64
65
|
invalid_emails.each do |email|
|
65
66
|
content = text.gsub('EMAIL', email)
|
66
67
|
expect(described_class.scrub(content)).to eq(text.gsub('EMAIL', filtered))
|
@@ -70,12 +71,11 @@ describe Blinkist::AirbrakeScrubber::MessageEmail do
|
|
70
71
|
|
71
72
|
context "Anything that is a frozen string" do
|
72
73
|
subject { described_class.scrub text }
|
73
|
-
let(:text) { "Error bla bla bla test@example.org bla bla bla"
|
74
|
+
let(:text) { "Error bla bla bla test@example.org bla bla bla" }
|
74
75
|
|
75
76
|
it "filters out email" do
|
76
77
|
expect(subject).to eq(text.gsub('test@example.org', filtered))
|
77
78
|
end
|
78
79
|
end
|
79
80
|
end
|
80
|
-
|
81
81
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Blinkist::AirbrakeScrubber::ParamsEmail do
|
@@ -17,7 +19,7 @@ describe Blinkist::AirbrakeScrubber::ParamsEmail do
|
|
17
19
|
describe "self.scrub!" do
|
18
20
|
it "adds the filter" do
|
19
21
|
expect(Airbrake).to receive(:add_filter)
|
20
|
-
described_class
|
22
|
+
described_class.scrub!
|
21
23
|
end
|
22
24
|
|
23
25
|
it "scrubs the email from the params hash" do
|
@@ -36,5 +38,4 @@ describe Blinkist::AirbrakeScrubber::ParamsEmail do
|
|
36
38
|
expect(notice[:params][:deeply][:nested][:email]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
37
39
|
end
|
38
40
|
end
|
39
|
-
|
40
41
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Blinkist::AirbrakeScrubber::ParamsPassword do
|
@@ -17,7 +19,7 @@ describe Blinkist::AirbrakeScrubber::ParamsPassword do
|
|
17
19
|
describe "self.scrub!" do
|
18
20
|
it "adds the filter" do
|
19
21
|
expect(Airbrake).to receive(:add_filter)
|
20
|
-
described_class
|
22
|
+
described_class.scrub!
|
21
23
|
end
|
22
24
|
|
23
25
|
it "scrubs the password from the params hash" do
|
@@ -36,5 +38,4 @@ describe Blinkist::AirbrakeScrubber::ParamsPassword do
|
|
36
38
|
expect(notice[:params][:deeply][:nested][:password]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
37
39
|
end
|
38
40
|
end
|
39
|
-
|
40
41
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Blinkist::AirbrakeScrubber::ParamsTokens do
|
6
|
+
let(:notice) {
|
7
|
+
Airbrake.build_notice(
|
8
|
+
Exception.new('whatever'),
|
9
|
+
{ google_id_token: 'blahblah', facebook_access_token: 'whatever', param: 'whatever' }
|
10
|
+
)
|
11
|
+
}
|
12
|
+
|
13
|
+
describe "Structure" do
|
14
|
+
it "has scrub! method" do
|
15
|
+
expect(described_class).to respond_to(:scrub!)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "self.scrub!" do
|
20
|
+
it "adds the filter" do
|
21
|
+
expect(Airbrake).to receive(:add_filter)
|
22
|
+
described_class.scrub!
|
23
|
+
end
|
24
|
+
|
25
|
+
it "scrubs the google_id_token from the params hash" do
|
26
|
+
Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
|
27
|
+
expect(notice[:params][:google_id_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "scrubs the deep-nested google_id_token from the params hash" do
|
31
|
+
notice = Airbrake.build_notice(
|
32
|
+
Exception.new('whatever'),
|
33
|
+
{ google_id_token: 'bahblah', deeply: { nested: { google_id_token: 'blhablah' } } }
|
34
|
+
)
|
35
|
+
|
36
|
+
Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
|
37
|
+
expect(notice[:params][:google_id_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
38
|
+
expect(notice[:params][:deeply][:nested][:google_id_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "scrubs the facebook_access_token from the params hash" do
|
42
|
+
Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
|
43
|
+
expect(notice[:params][:facebook_access_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "scrubs the deep-nested facebook_access_token from the params hash" do
|
47
|
+
notice = Airbrake.build_notice(
|
48
|
+
Exception.new('whatever'),
|
49
|
+
{ facebook_access_token: 'bahblah', deeply: { nested: { facebook_access_token: 'blhablah' } } }
|
50
|
+
)
|
51
|
+
|
52
|
+
Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
|
53
|
+
expect(notice[:params][:facebook_access_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
54
|
+
expect(notice[:params][:deeply][:nested][:facebook_access_token]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'securerandom'
|
3
5
|
require 'blinkist-airbrake-scrubber'
|
4
6
|
|
5
7
|
describe Blinkist::AirbrakeScrubber do
|
6
8
|
let(:instantiate_airbrake) {
|
7
|
-
Airbrake.configure :"notifier_#{
|
9
|
+
Airbrake.configure :"notifier_#{SecureRandom.uuid}" do |c|
|
8
10
|
c.project_id = 1
|
9
11
|
c.project_key = 'whatever'
|
10
12
|
end
|
@@ -48,5 +50,4 @@ describe Blinkist::AirbrakeScrubber do
|
|
48
50
|
instantiate_airbrake
|
49
51
|
end
|
50
52
|
end
|
51
|
-
|
52
53
|
end
|
data/spec/specs/version_spec.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require 'spec_helper'
|
3
4
|
require 'blinkist-airbrake-scrubber/version'
|
4
5
|
|
5
6
|
describe Blinkist::AirbrakeScrubber::VERSION do
|
6
|
-
|
7
7
|
it 'provides the current version' do
|
8
8
|
version = Blinkist::AirbrakeScrubber::VERSION
|
9
9
|
expect(version).to_not be nil
|
10
10
|
expect(version.instance_of?(String)).to be true
|
11
11
|
end
|
12
12
|
|
13
|
-
it 'equals
|
13
|
+
it 'equals 4.4.0 for auto-check purposes' do
|
14
14
|
version = Blinkist::AirbrakeScrubber::VERSION
|
15
|
-
expect(version).to eq '4.
|
15
|
+
expect(version).to eq '4.4.0'
|
16
16
|
end
|
17
|
-
|
18
17
|
end
|
metadata
CHANGED
@@ -1,16 +1,14 @@
|
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Dinesh Vasudevan
|
9
|
-
- Tomek Przedmojski
|
7
|
+
- Blinkist
|
10
8
|
autorequire:
|
11
9
|
bindir: bin
|
12
10
|
cert_chain: []
|
13
|
-
date:
|
11
|
+
date: 2021-06-04 00:00:00.000000000 Z
|
14
12
|
dependencies:
|
15
13
|
- !ruby/object:Gem::Dependency
|
16
14
|
name: airbrake
|
@@ -18,19 +16,23 @@ dependencies:
|
|
18
16
|
requirements:
|
19
17
|
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '9'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '12'
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
29
|
+
version: '9'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '12'
|
29
33
|
description: Email scrubbing configuration for Airbrake at Blinkist
|
30
34
|
email:
|
31
|
-
-
|
32
|
-
- dinesh@blinkist.com
|
33
|
-
- tomek@blinkist.com
|
35
|
+
- operations@blinkist.com
|
34
36
|
executables: []
|
35
37
|
extensions: []
|
36
38
|
extra_rdoc_files: []
|
@@ -44,6 +46,7 @@ files:
|
|
44
46
|
- lib/blinkist-airbrake-scrubber/scrubbers/message_email.rb
|
45
47
|
- lib/blinkist-airbrake-scrubber/scrubbers/params_email.rb
|
46
48
|
- lib/blinkist-airbrake-scrubber/scrubbers/params_password.rb
|
49
|
+
- lib/blinkist-airbrake-scrubber/scrubbers/params_tokens.rb
|
47
50
|
- lib/blinkist-airbrake-scrubber/version.rb
|
48
51
|
- spec/spec_helper.rb
|
49
52
|
- spec/specs/lib/blinkist-airbrake-scrubber/airbrake_spec.rb
|
@@ -51,6 +54,7 @@ files:
|
|
51
54
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/message_email_spec.rb
|
52
55
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_email_spec.rb
|
53
56
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_password_spec.rb
|
57
|
+
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens_spec.rb
|
54
58
|
- spec/specs/lib/blinkist_airbrake_scrubber_spec.rb
|
55
59
|
- spec/specs/version_spec.rb
|
56
60
|
homepage: https://github.com/blinkist/airbrake-scrubber
|
@@ -72,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
76
|
- !ruby/object:Gem::Version
|
73
77
|
version: '0'
|
74
78
|
requirements: []
|
75
|
-
|
76
|
-
rubygems_version: 2.7.6
|
79
|
+
rubygems_version: 3.2.19
|
77
80
|
signing_key:
|
78
81
|
specification_version: 4
|
79
82
|
summary: With this, Airbrake will not leak emails via exception notifications
|
@@ -84,5 +87,6 @@ test_files:
|
|
84
87
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/message_email_spec.rb
|
85
88
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_email_spec.rb
|
86
89
|
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_password_spec.rb
|
90
|
+
- spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens_spec.rb
|
87
91
|
- spec/specs/lib/blinkist_airbrake_scrubber_spec.rb
|
88
92
|
- spec/specs/version_spec.rb
|