honeybadger 2.0.8 → 2.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f7f7f0ed185071b638c1397c651de08defdd67f
4
- data.tar.gz: dc426f168bc4fc433638826c744df12f2f11e137
3
+ metadata.gz: 0b9267b35e8dd5e293fb8047d86757f4d1301bcd
4
+ data.tar.gz: 01b79957eb4d49740231a9c631189756bdcab2f2
5
5
  SHA512:
6
- metadata.gz: 19f26d5077e250b8faee7309504bc93ae568d87f8fb5eed8274a4810181dcb865e6688190bfba68c43cc3ac5dbd405f6ddd9ebc98aacf4e736605386c2a6b943
7
- data.tar.gz: 1227af632c510f6255b24766622a921a5f2487d71450453a700db852da47cf4b0991b27b11714b0c71227ce224bd9d55a7701c90596704fdbd81fe405b278c35
6
+ metadata.gz: 58b52ed3d6b25f1ae0c9ae6cd9200c8c216ffcc1dd9b667eb8c1e56d7eb0cab1e11ac2f7ae6a526ca5308a408f08503a4df54ef277090aa31097f690391334b1
7
+ data.tar.gz: 8d7715734fbf44ee8ae83699782385d837699014d8f02a56bd98cb44ad4512cd63dd4c87ee36048b2f7e57c73b0a8a0d73f9cbf50b8d231f152db43552a11f26
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ * Fixed a bug introduced in v2.0.8 which applied params filters to backtrace.
2
+
3
+ *Joshua Wood*
4
+
5
+ * Fail gracefully when honeybadger.yml is empty or invalid.
6
+
7
+ *Joshua Wood*
8
+
1
9
  * Handle bad encodings in exception payloads.
2
10
 
3
11
  *Joshua Wood*
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Honeybadger for Ruby
2
2
 
3
3
  [![Code Climate](https://codeclimate.com/github/honeybadger-io/honeybadger-ruby/badges/gpa.svg)](https://codeclimate.com/github/honeybadger-io/honeybadger-ruby)
4
+ [![Test Coverage](https://codeclimate.com/github/honeybadger-io/honeybadger-ruby/badges/coverage.svg)](https://codeclimate.com/github/honeybadger-io/honeybadger-ruby)
4
5
  [![Build Status](https://secure.travis-ci.org/honeybadger-io/honeybadger-ruby.png?branch=master)](http://travis-ci.org/honeybadger-io/honeybadger-ruby)
5
6
  [![Gem Version](https://badge.fury.io/rb/honeybadger.png)](http://badge.fury.io/rb/honeybadger)
6
7
 
@@ -15,7 +15,7 @@ module Honeybadger
15
15
  elsif !@path.readable?
16
16
  raise ConfigError, "The configuration file #{@path} is not readable."
17
17
  else
18
- yaml = YAML.load(ERB.new(@path.read).result)
18
+ yaml = load_yaml
19
19
  yaml.merge!(yaml[env]) if yaml[env].kind_of?(Hash)
20
20
  update(dotify_keys(yaml))
21
21
  end
@@ -23,6 +23,18 @@ module Honeybadger
23
23
 
24
24
  private
25
25
 
26
+ def load_yaml
27
+ yaml = YAML.load(ERB.new(@path.read).result)
28
+ case yaml
29
+ when Hash
30
+ yaml
31
+ when NilClass, FalseClass
32
+ {}
33
+ else
34
+ raise ConfigError, "The configuration file #{@path} is invalid."
35
+ end
36
+ end
37
+
26
38
  def dotify_keys(hash, key_prefix = nil)
27
39
  {}.tap do |new_hash|
28
40
  hash.each_pair do |k,v|
@@ -136,7 +136,9 @@ module Honeybadger
136
136
 
137
137
  @opts = opts
138
138
  @config = config
139
- @sanitizer = Util::Sanitizer.new(filters: config.params_filters)
139
+
140
+ @sanitizer = Util::Sanitizer.new
141
+ @filtered_sanitizer = Util::Sanitizer.new(filters: config.params_filters)
140
142
 
141
143
  @exception = opts[:exception]
142
144
  @error_class = exception_attribute(:error_class) {|exception| exception.class.name }
@@ -188,9 +190,9 @@ module Honeybadger
188
190
  url: sanitized_url,
189
191
  component: s(component),
190
192
  action: s(action),
191
- params: s(params),
192
- session: s(session),
193
- cgi_data: s(cgi_data),
193
+ params: f(params),
194
+ session: f(session),
195
+ cgi_data: f(cgi_data),
194
196
  context: s(context),
195
197
  local_variables: s(local_variables)
196
198
  },
@@ -237,7 +239,7 @@ module Honeybadger
237
239
 
238
240
  private
239
241
 
240
- attr_reader :config, :opts, :context, :stats, :api_key, :now, :pid, :causes, :sanitizer
242
+ attr_reader :config, :opts, :context, :stats, :api_key, :now, :pid, :causes, :sanitizer, :filtered_sanitizer
241
243
 
242
244
  def ignore_by_origin?
243
245
  opts[:origin] == :rake && !config[:'exceptions.rescue_rake']
@@ -406,9 +408,13 @@ module Honeybadger
406
408
  sanitizer.sanitize(data)
407
409
  end
408
410
 
411
+ def f(data)
412
+ filtered_sanitizer.sanitize(data)
413
+ end
414
+
409
415
  def sanitized_url
410
416
  return nil unless url
411
- sanitizer.filter_url(s(url))
417
+ filtered_sanitizer.filter_url(s(url))
412
418
  end
413
419
 
414
420
  # Internal: Fetch local variables from first frame of backtrace.
@@ -7,8 +7,11 @@ module Honeybadger
7
7
 
8
8
  def initialize(opts = {})
9
9
  @max_depth = opts.fetch(:max_depth, 20)
10
- @filters = Array(opts.fetch(:filters, nil)).collect do |f|
11
- f.kind_of?(Regexp) ? f : f.to_s
10
+
11
+ if filters = opts.fetch(:filters, nil)
12
+ @filters = Array(filters).collect do |f|
13
+ f.kind_of?(Regexp) ? f : f.to_s
14
+ end
12
15
  end
13
16
  end
14
17
 
@@ -47,6 +50,8 @@ module Honeybadger
47
50
  end
48
51
 
49
52
  def filter_url(url)
53
+ return url unless filters
54
+
50
55
  filtered_url = url.to_s.dup
51
56
  filtered_url.scan(/(?:^|&|\?)([^=?&]+)=([^&]+)/).each do |m|
52
57
  next unless filter_key?(m[0])
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # Public: The current String Honeybadger version.
3
- VERSION = '2.0.8'.freeze
3
+ VERSION = '2.0.9'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-11 00:00:00.000000000 Z
11
+ date: 2015-03-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email: