bugsnag 2.3.0 → 2.4.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
2
  SHA1:
3
- metadata.gz: b35ad98c2895eeed859811b80eca504689062318
4
- data.tar.gz: 7101aa6328e378bbd6adca3287e2a0a804861990
3
+ metadata.gz: 0521fc3cace95079dc4d038dc75c02481ba7847b
4
+ data.tar.gz: 1d34bcc368eb9e4fc6b04a15ccd31e6ec3db2380
5
5
  SHA512:
6
- metadata.gz: e950f27e53ee24ebbf7e08c5983a957fc1cb3b84f510b9031dcd2aac1ca403c0d8c20a330620096cef5df7c93e89da17e34810fe3c6aee846fc67fe2203c250e
7
- data.tar.gz: a79292d91d5f4743c7a1d1cea919b9500d8ad83575be19a8e706c6c16b59db7e44140508530d00ce1876552544f8e1577294bc4848b4fb6980f77e45dd957934
6
+ metadata.gz: 5a2fbdbd810edc36b0ca20ac6e44dbd61c59cccd3ad96cb53e8b8da49ea38e6010e9969e4d34096f58e53892faf061a1b81af677fe937fa7fa3609af566c06f1
7
+ data.tar.gz: e48a77338ef9d1ec47e277aa40e8ac84dadbecdb688938531b9f508dba39b242ebce72a0999a387bd08e0a82201acc08148a99b63db1fdf83ce5a37ec7ef5f81
@@ -1,6 +1,12 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 2.4.0
5
+ -----
6
+ - Allow filters to be regular expressions (thanks @tamird)
7
+ - Ensure filtering behavior matches rails' when importing filters from
8
+ `Rails.configuration.filter_parameters`
9
+
4
10
  2.3.0
5
11
  -----
6
12
  - Use ssl by default (Thanks @dkubb)
data/README.md CHANGED
@@ -347,16 +347,19 @@ config.app_version = "2.5.1"
347
347
 
348
348
  ###params_filters
349
349
 
350
- Sets the strings to filter out from the `params` hashes before sending
351
- them to Bugsnag. Use this if you want to ensure you don't send
352
- sensitive data such as passwords, and credit card numbers to our
353
- servers. Any keys which *contain* these strings will be filtered.
350
+ Sets which keys should be filtered out from `params` hashes before sending
351
+ them to Bugsnag. Use this if you want to ensure you don't send sensitive data
352
+ such as passwords, and credit card numbers to our servers. You can add both
353
+ strings and regular expressions to this array. When adding strings, keys which
354
+ *contain* the string will be filtered. When adding regular expressions, any
355
+ keys which *match* the regular expression will be filtered.
354
356
 
355
357
  ```ruby
356
- config.params_filters << "credit_card_number"
358
+ config.params_filters += ["credit_card_number", /^password$/]
357
359
  ```
358
360
 
359
- By default, `params_filters` is set to `["password", "secret"]`
361
+ By default, `params_filters` is set to `["password", "secret"]`, and for rails
362
+ apps, imports all values from `Rails.configuration.filter_parameters`.
360
363
 
361
364
  ###ignore_classes
362
365
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.4.0
@@ -27,7 +27,7 @@ module Bugsnag
27
27
  when Hash
28
28
  clean_hash = {}
29
29
  obj.each do |k,v|
30
- if filters && filters.any? {|f| k.to_s.include?(f.to_s)}
30
+ if filters_match?(k, filters)
31
31
  clean_hash[k] = "[FILTERED]"
32
32
  else
33
33
  clean_obj = cleanup_obj(v, filters, seen)
@@ -62,6 +62,19 @@ module Bugsnag
62
62
  end
63
63
  end
64
64
 
65
+ def self.filters_match?(object, filters)
66
+ str = object.to_s
67
+
68
+ Array(filters).any? do |f|
69
+ case f
70
+ when Regexp
71
+ str.match(f)
72
+ else
73
+ str.include?(f.to_s)
74
+ end
75
+ end
76
+ end
77
+
65
78
  def self.cleanup_url(url, filters = nil)
66
79
  return url unless filters
67
80
 
@@ -18,7 +18,14 @@ module Bugsnag
18
18
  config.logger = Rails.logger
19
19
  config.release_stage = Rails.env.to_s
20
20
  config.project_root = Rails.root.to_s
21
- config.params_filters += Rails.configuration.filter_parameters
21
+ config.params_filters += Rails.configuration.filter_parameters.map do |filter|
22
+ case filter
23
+ when String
24
+ /\A#{filter}\z/
25
+ else
26
+ filter
27
+ end
28
+ end
22
29
  config.middleware.insert_before Bugsnag::Middleware::Callbacks, Bugsnag::Middleware::Rails3Request
23
30
  end
24
31
 
@@ -44,6 +44,16 @@ describe Bugsnag::Helpers do
44
44
  end
45
45
  end
46
46
 
47
+ it "filters by string inclusion" do
48
+ expect(Bugsnag::Helpers.cleanup_obj({ :foo => 'bar' }, ['f'])).to eq({ :foo => '[FILTERED]' })
49
+ expect(Bugsnag::Helpers.cleanup_obj({ :foo => 'bar' }, ['b'])).to eq({ :foo => 'bar' })
50
+ end
51
+
52
+ it "filters by regular expression" do
53
+ expect(Bugsnag::Helpers.cleanup_obj({ :foo => 'bar' }, [/fb?/])).to eq({ :foo => '[FILTERED]' })
54
+ expect(Bugsnag::Helpers.cleanup_obj({ :foo => 'bar' }, [/fb+/])).to eq({ :foo => 'bar' })
55
+ end
56
+
47
57
  it "reduces hash size correctly" do
48
58
  meta_data = {
49
59
  :key_one => "this should not be truncated",
metadata CHANGED
@@ -1,103 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-22 00:00:00.000000000 Z
11
+ date: 2014-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "<"
31
+ - - <
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
- - - ">="
34
+ - - '>='
35
35
  - !ruby/object:Gem::Version
36
36
  version: '0.6'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - "<"
41
+ - - <
42
42
  - !ruby/object:Gem::Version
43
43
  version: '1.0'
44
- - - ">="
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0.6'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - '>='
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rspec
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - '>='
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rdoc
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - '>='
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - '>='
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: pry
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - '>='
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  description: Ruby notifier for bugsnag.com
@@ -108,10 +108,10 @@ extra_rdoc_files:
108
108
  - LICENSE.txt
109
109
  - README.md
110
110
  files:
111
- - ".document"
112
- - ".gitignore"
113
- - ".rspec"
114
- - ".travis.yml"
111
+ - .document
112
+ - .gitignore
113
+ - .rspec
114
+ - .travis.yml
115
115
  - CHANGELOG.md
116
116
  - Gemfile
117
117
  - LICENSE.txt
@@ -168,17 +168,17 @@ require_paths:
168
168
  - lib
169
169
  required_ruby_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
- - - ">="
176
+ - - '>='
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
180
  rubyforge_project:
181
- rubygems_version: 2.2.2
181
+ rubygems_version: 2.0.14
182
182
  signing_key:
183
183
  specification_version: 4
184
184
  summary: Ruby notifier for bugsnag.com