honeybadger 1.13.1 → 1.13.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## Honeybadger 1.13.2 (unreleased) ##
2
+
3
+ * Fix 2 bugs where the Rails raises exceptions when accessing session
4
+ information. (ActionDispatch::Session::SessionRestoreError) and
5
+ ArgumentError when `config.secret_token` is missing.
6
+
7
+ *Joshua Wood*
8
+
9
+ * Disable notices via API when unauthorized.
10
+
11
+ *Joshua Wood*
12
+
13
+ ## Honeybadger 1.13.1 ##
14
+
15
+ * Be less verbose when logging that metrics are disabled. (primarily for
16
+ Unicorn users)
17
+
18
+ *Joshua Wood*
19
+
1
20
  ## Honeybadger 1.13.0 ##
2
21
 
3
22
  * Add native support for Sidekiq 3.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
data/Rakefile CHANGED
@@ -65,6 +65,10 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
65
65
  t.cucumber_opts << '--tags ~@rails_3'
66
66
  end
67
67
 
68
+ if ENV['BUNDLE_GEMFILE'] =~ /rails3/
69
+ t.cucumber_opts << 'features/rails3.x.feature'
70
+ end
71
+
68
72
  case ENV['BUNDLE_GEMFILE']
69
73
  when /rails/
70
74
  t.cucumber_opts << 'features/rails.feature features/metal.feature'
@@ -0,0 +1,26 @@
1
+ Feature: Install the Gem in a Rails 3.x application
2
+
3
+ Background:
4
+ Given I generate a new Rails application
5
+ And I configure the Honeybadger shim
6
+
7
+ Scenario: Rails is missing `config.secret_token`
8
+ When I configure my application to require Honeybadger
9
+ And I configure Honeybadger with:
10
+ """
11
+ config.api_key = "myapikey"
12
+ config.logger = Logger.new(STDOUT)
13
+ config.debug = true
14
+ """
15
+ And I define a response for "TestController#index":
16
+ """
17
+ session["secret"] = "blue42"
18
+ render :nothing => true
19
+ """
20
+ And I route "/test/index" to "test#index"
21
+ And I successfully run `rm config/initializers/secret_token.rb`
22
+ And I perform a request to "http://example.com:123/test/index"
23
+ Then I should receive a Honeybadger notification
24
+ And the request should not contain "blue42"
25
+ And the request session should contain "config.secret_token"
26
+
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.13.1)
4
+ honeybadger (1.13.2)
5
5
  json
6
6
 
7
7
  GEM
data/honeybadger.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'honeybadger'
7
- s.version = '1.13.1'
8
- s.date = '2014-05-14'
7
+ s.version = '1.13.2'
8
+ s.date = '2014-05-22'
9
9
 
10
10
  s.summary = 'Error reports you can be happy about.'
11
11
  s.description = 'Make managing application errors a more pleasant experience.'
@@ -51,6 +51,7 @@ Gem::Specification.new do |s|
51
51
  features/metal.feature
52
52
  features/rack.feature
53
53
  features/rails.feature
54
+ features/rails3.x.feature
54
55
  features/rake.feature
55
56
  features/sinatra.feature
56
57
  features/step_definitions/metal_steps.rb
data/lib/honeybadger.rb CHANGED
@@ -17,7 +17,7 @@ require 'honeybadger/railtie' if defined?(Rails::Railtie)
17
17
  require 'honeybadger/integrations/sidekiq'
18
18
 
19
19
  module Honeybadger
20
- VERSION = '1.13.1'
20
+ VERSION = '1.13.2'
21
21
  LOG_PREFIX = "** [Honeybadger] "
22
22
 
23
23
  HEADERS = {
@@ -124,12 +124,12 @@ module Honeybadger
124
124
  self.source_extract_radius = args[:source_extract_radius] || 2
125
125
  self.source_extract = extract_source_from_backtrace
126
126
 
127
- self.send_request_session = args[:send_request_session].nil? ? true : args[:send_request_session]
127
+ self.send_request_session = args[:send_request_session].nil? ? true : args[:send_request_session]
128
128
 
129
- also_use_rack_params_filters
130
129
  find_session_data
131
- clean_params
132
130
  clean_rack_request_data
131
+ also_use_rack_params_filters
132
+ clean_params
133
133
  set_context
134
134
  end
135
135
 
@@ -338,8 +338,10 @@ module Honeybadger
338
338
 
339
339
  def clean_rack_request_data
340
340
  if cgi_data
341
+ self.cgi_data = cgi_data.dup
341
342
  cgi_data.delete("rack.request.form_vars")
342
343
  cgi_data.delete("rack.request.query_string")
344
+ cgi_data.delete("rack.session")
343
345
  cgi_data.delete("action_dispatch.request.parameters")
344
346
  cgi_data.delete("action_dispatch.request.request_parameters")
345
347
  end
@@ -406,6 +408,11 @@ module Honeybadger
406
408
  self.session_data = args[:session_data] || args[:session] || rack_session || {}
407
409
  self.session_data = session_data[:data] if session_data[:data]
408
410
  end
411
+ rescue => e
412
+ # Rails raises ArgumentError when `config.secret_token` is missing, and
413
+ # ActionDispatch::Session::SessionRestoreError when the session can't be
414
+ # restored.
415
+ self.session_data = { :error => "Failed to access session data -- #{e.message}" }
409
416
  end
410
417
 
411
418
  def set_context
@@ -431,7 +438,7 @@ module Honeybadger
431
438
  end
432
439
 
433
440
  def rack_session
434
- args[:rack_env]['rack.session'] if args[:rack_env]
441
+ rack_env(:session).to_hash if args[:rack_env]
435
442
  end
436
443
 
437
444
  # Private: (Rails 3+) Adds params filters to filter list
@@ -35,7 +35,9 @@ module Honeybadger
35
35
  # Returns error id from successful response
36
36
  def send_to_honeybadger(notice)
37
37
  if !Honeybadger.configuration.features['notices']
38
- log(:error, "Can't send error report -- the gem has been deactivated by the remote service. Try restarting your app or contacting support@honeybadger.io.")
38
+ log(:error, "Can't send error report -- the gem has been deactivated by the remote service.\n\t" \
39
+ "This is usually a result of an expired plan. Please check your payment info and restart your app.\n\t" \
40
+ "If you continue to receive this message, contact support@honeybadger.io.")
39
41
  return nil
40
42
  end
41
43
 
@@ -51,6 +53,7 @@ module Honeybadger
51
53
  log(Honeybadger.configuration.debug ? :info : :debug, "Success: #{response.class}", response, data)
52
54
  JSON.parse(response.body).fetch('id')
53
55
  else
56
+ Honeybadger.configuration.features['notices'] = false if Net::HTTPForbidden === response
54
57
  log(:error, "Failure: #{response.class}", response, data)
55
58
  log_original_exception(notice)
56
59
  nil
@@ -63,11 +63,27 @@ describe Honeybadger::Sender do
63
63
  end
64
64
  end
65
65
 
66
- it "logs success" do
67
- stub_http
68
- sender = build_sender
69
- sender.should_receive(:log).with(:debug, /Success/, kind_of(Net::HTTPSuccess), kind_of(String))
70
- send_exception(:sender => sender, :secure => false)
66
+ context "success response from server" do
67
+ let(:sender) { build_sender }
68
+
69
+ before { stub_http }
70
+
71
+ it "logs success" do
72
+ sender.should_receive(:log).with(:debug, /Success/, kind_of(Net::HTTPSuccess), kind_of(String))
73
+ send_exception(:sender => sender, :secure => false)
74
+ end
75
+
76
+ it "doesn't change features" do
77
+ expect { send_exception(:sender => sender, :secure => false) }.not_to change { Honeybadger.configuration.features }
78
+ end
79
+ end
80
+
81
+ context "403 response from server" do
82
+ it "deactivates notices on 403" do
83
+ stub_http(:response => Net::HTTPForbidden.new('1.2', '403', 'Forbidden'))
84
+ sender = build_sender
85
+ expect { send_exception(:sender => sender, :secure => false) }.to change { Honeybadger.configuration.features['notices'] }.to false
86
+ end
71
87
  end
72
88
 
73
89
  it "logs failure" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 1.13.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-14 00:00:00.000000000 Z
12
+ date: 2014-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -254,6 +254,7 @@ files:
254
254
  - features/metal.feature
255
255
  - features/rack.feature
256
256
  - features/rails.feature
257
+ - features/rails3.x.feature
257
258
  - features/rake.feature
258
259
  - features/sinatra.feature
259
260
  - features/step_definitions/metal_steps.rb
@@ -361,7 +362,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
361
362
  version: '0'
362
363
  segments:
363
364
  - 0
364
- hash: -2870056027279170581
365
+ hash: 2811727937091942835
365
366
  required_rubygems_version: !ruby/object:Gem::Requirement
366
367
  none: false
367
368
  requirements: