airbrake-ruby 1.7.0 → 1.7.1

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
2
  SHA1:
3
- metadata.gz: 4447483250d34ac608ceac9356647902e55a8c58
4
- data.tar.gz: 550d498d5f8f36b5cff9a4f02a45e813646c2833
3
+ metadata.gz: bbc56120094dd5ebca9b489ba613aca53d696da3
4
+ data.tar.gz: d0f207390f282a459a2a80f13223b7c61de5be09
5
5
  SHA512:
6
- metadata.gz: 4913a170dcebd29645730f83bba8135a251b07f77f57933eefcaa596b22ad44db84599dbe444ea8bd6fcee57407351f4e1caab8c9d71b292506aa8a89242894e
7
- data.tar.gz: d471bba8e00eb16117d6eb8a8842becff961f69d7e3fedfe878fa94939c2aad5919bf9ed5393c91e875995b07de2c4c3c4ae72839b1c600ac4a97f021d651176
6
+ metadata.gz: a42ae86774fa693ac7678e6e4a9bc0e6014992f4d1c8ba91b08f615b40fbd36cdbaf8bae42163d7bbb574c3f25292c92fc10e3707c13b42a35706a01ca2de682
7
+ data.tar.gz: 4eb63a597c488410fe44972ab6077b11e7d296788e431fda2e956b5fee9f2f58133d0e172f32667d5d1a56aac7b1478d288d5315541c0f0be37e0c87720f9a23
data/lib/airbrake-ruby.rb CHANGED
@@ -15,12 +15,12 @@ require 'airbrake-ruby/response'
15
15
  require 'airbrake-ruby/nested_exception'
16
16
  require 'airbrake-ruby/notice'
17
17
  require 'airbrake-ruby/backtrace'
18
- require 'airbrake-ruby/filter_chain'
19
18
  require 'airbrake-ruby/payload_truncator'
20
19
  require 'airbrake-ruby/filters'
21
20
  require 'airbrake-ruby/filters/keys_filter'
22
21
  require 'airbrake-ruby/filters/keys_whitelist'
23
22
  require 'airbrake-ruby/filters/keys_blacklist'
23
+ require 'airbrake-ruby/filter_chain'
24
24
  require 'airbrake-ruby/notifier'
25
25
 
26
26
  ##
@@ -25,6 +25,15 @@ module Airbrake
25
25
  end
26
26
  end
27
27
 
28
+ ##
29
+ # Filters to be executed last. By this time all permutations on a notice
30
+ # should be done, so the final step is to blacklist/whitelist keys.
31
+ # @return [Array<Class>]
32
+ KEYS_FILTERS = [
33
+ Airbrake::Filters::KeysBlacklist,
34
+ Airbrake::Filters::KeysWhitelist
35
+ ].freeze
36
+
28
37
  ##
29
38
  # Skip over SystemExit exceptions, because they're just noise.
30
39
  # @return [Proc]
@@ -38,6 +47,7 @@ module Airbrake
38
47
  # @param [Airbrake::Config] config
39
48
  def initialize(config)
40
49
  @filters = []
50
+ @keys_filters = []
41
51
 
42
52
  [SYSTEM_EXIT_FILTER, GEM_ROOT_FILTER].each do |filter|
43
53
  add_filter(filter)
@@ -51,6 +61,7 @@ module Airbrake
51
61
  # Adds a filter to the filter chain.
52
62
  # @param [#call] filter The filter object (proc, class, module, etc)
53
63
  def add_filter(filter)
64
+ return @keys_filters << filter if KEYS_FILTERS.include?(filter.class)
54
65
  @filters << filter
55
66
  end
56
67
 
@@ -61,7 +72,7 @@ module Airbrake
61
72
  # @param [Airbrake::Notice] notice The notice to be filtered
62
73
  # @return [void]
63
74
  def refine(notice)
64
- @filters.each do |filter|
75
+ (@filters + @keys_filters).each do |filter|
65
76
  break if notice.ignored?
66
77
  filter.call(notice)
67
78
  end
@@ -4,5 +4,5 @@
4
4
  module Airbrake
5
5
  ##
6
6
  # @return [String] the library version
7
- AIRBRAKE_RUBY_VERSION = '1.7.0'.freeze
7
+ AIRBRAKE_RUBY_VERSION = '1.7.1'.freeze
8
8
  end
@@ -39,6 +39,21 @@ RSpec.describe Airbrake::FilterChain do
39
39
 
40
40
  expect(nums).to eq([0, 1, 2])
41
41
  end
42
+
43
+ it "executes keys filters last" do
44
+ notice[:params] = { bingo: 'bango' }
45
+ blacklist = Airbrake::Filters::KeysBlacklist.new(config.logger, :bingo)
46
+ @chain.add_filter(blacklist)
47
+
48
+ @chain.add_filter(
49
+ proc do |notice|
50
+ expect(notice[:params][:bingo]).to eq('bango')
51
+ end
52
+ )
53
+
54
+ @chain.refine(notice)
55
+ expect(notice[:params][:bingo]).to eq('[Filtered]')
56
+ end
42
57
  end
43
58
 
44
59
  describe "default backtrace filters" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-20 00:00:00.000000000 Z
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec