blinkist-airbrake-scrubber 3.0.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6c7292d499d48e12d164b7099303bc900cb2386c
4
- data.tar.gz: e5c1c74178c864d515b79e91c3cf2815da08584e
2
+ SHA256:
3
+ metadata.gz: f625fa6d2a35ddf3266e154bdda5675519d7c6f2cf27fffb94ae41be574fd18e
4
+ data.tar.gz: dc707a1a8d56c3ceff4e5f788c9604a617d1637d6799edf5259c99cb1d996366
5
5
  SHA512:
6
- metadata.gz: 8a6c5b60ac452b1c6137dd00138db21b2bdfd403fb2ef62c5514b23dc6aefca20946ce0076581077fd6198b6e62f4626ce06385850f47cbce3bf62f69f83949c
7
- data.tar.gz: ce775a0990fe520c9d7396df3da85c48e92b279b7faae5963e6d8da16db69c3c0b87230247d2e49c530190d8cac06a0b02f6bff7a677b0999bb42dc8c0f117bd
6
+ metadata.gz: 837fb1c0ee1441f57aceb2a4c68948ff10f90fa0f14a8eff48c1f504e901698d2d2ef80b742389fec15b4122efc0c0a823d2ba3c0dd94a7e05f1693c20c70f18
7
+ data.tar.gz: 58935a13d16d7ba82ca40bbc40f3e187b5a226e0216b09d2ff970b5b447952f55f8c87ea1530a6c57197cfcc5644c8394f553eaca7b47f2f5ea8aedc445b7b77
data/Gemfile CHANGED
@@ -1,15 +1,16 @@
1
- ruby "2.3.6"
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 "rake"
7
+ gem "dotenv"
8
+ gem "forgery"
8
9
  gem "rack"
10
+ gem "rake"
9
11
  gem "rspec"
10
- gem "forgery"
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
@@ -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 # def self.scrub!
31
+ end
32
32
 
33
33
  end
34
34
  end
@@ -42,7 +42,7 @@ This gem has dependency on airbrake (~> 7), it will automatically add it unless
42
42
 
43
43
  ## Maintainers
44
44
 
45
- * Paweł Komarnicki (https://github.com/pawelkomarnicki)
45
+ * Blinkist (https://github.com/blinkist)
46
46
 
47
47
  ## Special thanks
48
48
 
data/Rakefile CHANGED
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
 
3
5
  require 'rspec/core/rake_task'
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
8
  task(:default).clear
7
- task default: [ :spec ]
9
+ task default: [:spec]
@@ -1,4 +1,5 @@
1
- # -*- encoding: utf-8 -*-
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 = ["Paweł Komarnicki", "Dinesh Vasudevan", 'Tomek Przedmojski']
10
- gem.email = ["pawel@blinkist.com", "dinesh@blinkist.com", "tomek@blinkist.com"]
11
- gem.description = %q{Email scrubbing configuration for Airbrake at Blinkist}
12
- gem.summary = %q{With this, Airbrake will not leak emails via exception notifications}
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", "~> 7"
18
+ gem.add_dependency "airbrake", "~> 9"
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('../../lib/**/*.rb', __FILE__)].each do |f|
4
+ Dir[File.expand_path('../lib/**/*.rb', __dir__)].sort.each do |f|
3
5
  require f
4
6
  end
5
7
 
@@ -15,18 +17,18 @@ end
15
17
  module Blinkist
16
18
  module AirbrakeScrubber
17
19
  FILTERED = '[Filtered]'
18
- SCRUBBERS = [ MessageEmail, ParamsEmail, ParamsPassword ]
20
+ SCRUBBERS = [MessageEmail, ParamsEmail, ParamsPassword, ParamsTokens].freeze
19
21
 
20
22
  # Override original Airbrake.configure
21
- def configure(*args, &block)
22
- super
23
+ def configure(*_args, &block)
24
+ super(&block)
23
25
  ensure
24
26
  Blinkist::AirbrakeScrubber.run!
25
27
  end
26
28
 
27
29
  # Run scrubbers
28
30
  def self.run!
29
- SCRUBBERS.each { |scrubber| scrubber::scrub! }
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 { |key, value|
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
- [ key, recursive_traverse(value, &block) ]
29
+ [key, recursive_traverse(value, &block)]
29
30
  else
30
- [ key, block.call(key, value) ]
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 # def self.scrub!
13
+ end
12
14
 
13
15
  def self.scrub(message)
14
- message.gsub(REGEXP, FILTERED)
16
+ message&.gsub(REGEXP, FILTERED)
15
17
  end
16
18
 
17
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Blinkist
2
4
  module AirbrakeScrubber
3
5
  class ParamsEmail
@@ -10,7 +12,7 @@ module Blinkist
10
12
  end
11
13
  notice
12
14
  end
13
- end # def self.scrub!
15
+ end
14
16
 
15
17
  end
16
18
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Blinkist
2
4
  module AirbrakeScrubber
3
5
  class ParamsPassword
@@ -10,7 +12,7 @@ module Blinkist
10
12
  end
11
13
  notice
12
14
  end
13
- end # def self.scrub!
15
+ end
14
16
 
15
17
  end
16
18
  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
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Blinkist
2
4
  module AirbrakeScrubber
3
5
 
4
- VERSION = "3.0.0"
6
+ VERSION = "4.2.0"
5
7
 
6
8
  end
7
9
  end
@@ -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_#{ SecureRandom.uuid }" do |c|
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) { Hash.new }
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 { |k, v| v }
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{ email password }.include?(k.to_s) ? '[Filtered]' : v }
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: [ { email: 'user@example.org' }, { email: 'user@example.org' } ], whatever: [ nil ] } }
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: [ { email: '[Filtered]' }, { email: '[Filtered]' } ], whatever: [ nil ] })
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) { [ { email: 'user@example.org' }, { email: 'user@example.org' } ] }
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([ { email: '[Filtered]' }, { email: '[Filtered]' } ])
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::scrub! }
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{ 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 } }
31
- let(:valid_usernames) { %w{ username user.name user+name user-name user_name } }
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{ user@example user@example. user!@example.org us@r@example.org us&r@example.com } }
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: #{ valid_emails.join ', ' }"
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: #{ invalid_emails.join ', ' }"
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: #{ valid_emails.join ', ' }"
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: #{ invalid_emails.join ', ' }"
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".freeze }
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,9 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Blinkist::AirbrakeScrubber::ParamsEmail do
4
- let(:notifier) { Airbrake[:default] }
5
6
  let(:notice) {
6
- Airbrake[:default].build_notice(
7
+ Airbrake.build_notice(
7
8
  Exception.new('whatever'),
8
9
  { email: 'user@example.org', password: 'whatever', param: 'whatever' }
9
10
  )
@@ -18,24 +19,23 @@ describe Blinkist::AirbrakeScrubber::ParamsEmail do
18
19
  describe "self.scrub!" do
19
20
  it "adds the filter" do
20
21
  expect(Airbrake).to receive(:add_filter)
21
- described_class::scrub!
22
+ described_class.scrub!
22
23
  end
23
24
 
24
25
  it "scrubs the email from the params hash" do
25
- notifier.instance_variable_get(:@filter_chain).refine(notice)
26
+ Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
26
27
  expect(notice[:params][:email]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
27
28
  end
28
29
 
29
30
  it "scrubs the deep-nested email from the params hash" do
30
- notice = Airbrake[:default].build_notice(
31
+ notice = Airbrake.build_notice(
31
32
  Exception.new('whatever'),
32
33
  { email: 'user@example.org', deeply: { nested: { email: 'user@example.org' } } }
33
34
  )
34
35
 
35
- notifier.instance_variable_get(:@filter_chain).refine(notice)
36
+ Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
36
37
  expect(notice[:params][:email]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
37
38
  expect(notice[:params][:deeply][:nested][:email]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
38
39
  end
39
40
  end
40
-
41
41
  end
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Blinkist::AirbrakeScrubber::ParamsPassword do
4
- let(:notifier) { Airbrake[:default] }
5
6
  let(:notice) {
6
- Airbrake[:default].build_notice(
7
+ Airbrake.build_notice(
7
8
  Exception.new('whatever'),
8
9
  { email: 'user@example.org', password: 'whatever', param: 'whatever' }
9
10
  )
@@ -18,24 +19,23 @@ describe Blinkist::AirbrakeScrubber::ParamsPassword do
18
19
  describe "self.scrub!" do
19
20
  it "adds the filter" do
20
21
  expect(Airbrake).to receive(:add_filter)
21
- described_class::scrub!
22
+ described_class.scrub!
22
23
  end
23
24
 
24
25
  it "scrubs the password from the params hash" do
25
- notifier.instance_variable_get(:@filter_chain).refine(notice)
26
+ Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
26
27
  expect(notice[:params][:password]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
27
28
  end
28
29
 
29
30
  it "scrubs the deep-nested password from the params hash" do
30
- notice = Airbrake[:default].build_notice(
31
+ notice = Airbrake.build_notice(
31
32
  Exception.new('whatever'),
32
33
  { password: 'whatever', deeply: { nested: { password: 'whatever' } } }
33
34
  )
34
35
 
35
- notifier.instance_variable_get(:@filter_chain).refine(notice)
36
+ Airbrake.notice_notifier.instance_variable_get(:@filter_chain).refine(notice)
36
37
  expect(notice[:params][:password]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
37
38
  expect(notice[:params][:deeply][:nested][:password]).to eq(Blinkist::AirbrakeScrubber::FILTERED)
38
39
  end
39
40
  end
40
-
41
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_#{ SecureRandom.uuid }" do |c|
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
@@ -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 3.0.0 for auto-check purposes' do
13
+ it 'equals 4.2.0 for auto-check purposes' do
14
14
  version = Blinkist::AirbrakeScrubber::VERSION
15
- expect(version).to eq '3.0.0'
15
+ expect(version).to eq '4.2.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: 3.0.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Paweł Komarnicki
8
- - Dinesh Vasudevan
9
- - Tomek Przedmojski
7
+ - Blinkist
10
8
  autorequire:
11
9
  bindir: bin
12
10
  cert_chain: []
13
- date: 2018-05-28 00:00:00.000000000 Z
11
+ date: 2020-05-25 00:00:00.000000000 Z
14
12
  dependencies:
15
13
  - !ruby/object:Gem::Dependency
16
14
  name: airbrake
@@ -18,19 +16,17 @@ dependencies:
18
16
  requirements:
19
17
  - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '7'
19
+ version: '9'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
23
  requirements:
26
24
  - - "~>"
27
25
  - !ruby/object:Gem::Version
28
- version: '7'
26
+ version: '9'
29
27
  description: Email scrubbing configuration for Airbrake at Blinkist
30
28
  email:
31
- - pawel@blinkist.com
32
- - dinesh@blinkist.com
33
- - tomek@blinkist.com
29
+ - operations@blinkist.com
34
30
  executables: []
35
31
  extensions: []
36
32
  extra_rdoc_files: []
@@ -44,6 +40,7 @@ files:
44
40
  - lib/blinkist-airbrake-scrubber/scrubbers/message_email.rb
45
41
  - lib/blinkist-airbrake-scrubber/scrubbers/params_email.rb
46
42
  - lib/blinkist-airbrake-scrubber/scrubbers/params_password.rb
43
+ - lib/blinkist-airbrake-scrubber/scrubbers/params_tokens.rb
47
44
  - lib/blinkist-airbrake-scrubber/version.rb
48
45
  - spec/spec_helper.rb
49
46
  - spec/specs/lib/blinkist-airbrake-scrubber/airbrake_spec.rb
@@ -51,6 +48,7 @@ files:
51
48
  - spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/message_email_spec.rb
52
49
  - spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_email_spec.rb
53
50
  - spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_password_spec.rb
51
+ - spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens_spec.rb
54
52
  - spec/specs/lib/blinkist_airbrake_scrubber_spec.rb
55
53
  - spec/specs/version_spec.rb
56
54
  homepage: https://github.com/blinkist/airbrake-scrubber
@@ -72,8 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
70
  - !ruby/object:Gem::Version
73
71
  version: '0'
74
72
  requirements: []
75
- rubyforge_project:
76
- rubygems_version: 2.5.2.2
73
+ rubygems_version: 3.0.3
77
74
  signing_key:
78
75
  specification_version: 4
79
76
  summary: With this, Airbrake will not leak emails via exception notifications
@@ -84,5 +81,6 @@ test_files:
84
81
  - spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/message_email_spec.rb
85
82
  - spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_email_spec.rb
86
83
  - spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_password_spec.rb
84
+ - spec/specs/lib/blinkist-airbrake-scrubber/scrubbers/params_tokens_spec.rb
87
85
  - spec/specs/lib/blinkist_airbrake_scrubber_spec.rb
88
86
  - spec/specs/version_spec.rb