bugsnag 2.8.6 → 2.8.7

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: 9ebe125f07a4a2afd8e873ce95df608085afa4a2
4
- data.tar.gz: 34b35b4affa3ec05ba974bd379e917043d16be9f
3
+ metadata.gz: 067814066dcb230ce23d76c6a2c6aaac1f558d6a
4
+ data.tar.gz: ca9cdab9e2a56282adae7ad665448cb7a56fbe3c
5
5
  SHA512:
6
- metadata.gz: ff650953a205f95032b1cf7f4d06be225d0e1f0bcc24ce3d84f6c5ffbf0d2f1a82699bbcf44b9a5a29e5e478733ff18adcd418a8197b8fc95bb016693923e123
7
- data.tar.gz: f5b7ea42d4cfb05b663fab08f5b09f3844480ba80ee06c550f2773e08f21effb51257170bcb3f7884825e3fb6e2e5afefde9c6bb97bae8c134b72732fef2189d
6
+ metadata.gz: 359bf4b141709e8eaa9c69a703c5572970349a536f4b91ca0a62e14ad7e250f9979a99f9f8904ab6f1c144909df40d741886f421b9a77bb1a7053a65d4c389a7
7
+ data.tar.gz: 1b4490466b23031df3577d009c4a0482d10d702d85394d501f90577378f99316e89d3ca9304336df411a680cb245d37b0157f3f3014c89aa6324366c70bdfccc
@@ -1,6 +1,16 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 2.8.7
5
+ -----
6
+
7
+ - Fix for old rails 3.2 not having runner defined in the railtie
8
+ - Support for rails API
9
+ - Added support for ca_file for dealing with SSL issues
10
+ - Threadsafe ignore_classes
11
+ - Add app type
12
+ - Dont send cookies in their own tab
13
+
4
14
  2.8.6
5
15
  -----
6
16
 
data/README.md CHANGED
@@ -115,6 +115,22 @@ class MyController < ApplicationController
115
115
  end
116
116
  ```
117
117
 
118
+ ### Rails API Apps
119
+
120
+ If you are building an API using the [rails-api](https://github.com/rails-api/rails-api) gem, your controllers will inherit from `ActionController::API` instead of `ActionController::Base`.
121
+
122
+ In this case, the `before_bugsnag_notify` filter will not be automatically available in your controllers. In order to use it, you will need to include the module `Bugsnag::Rails::ControllerMethods`.
123
+
124
+ ```ruby
125
+ class ApplicationController < ActionController::API
126
+
127
+ # Include module which defines the before_bugsnag_notify filter
128
+ include Bugsnag::Rails::ControllerMethods
129
+
130
+ # Other code here
131
+ end
132
+ ```
133
+
118
134
  ### Other Ruby Apps
119
135
 
120
136
  In other ruby apps, you can provide lambda functions to execute before any `Bugsnag.notify` calls as follows. Don't forget to clear the callbacks at the end of each request or session. In Rack applications like Sinatra, this is automatically done for you.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.8.6
1
+ 2.8.7
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "http://github.com/bugsnag/bugsnag-ruby"
11
11
  s.licenses = ["MIT"]
12
12
 
13
- s.files = `git ls-files`.split("\n")
13
+ s.files = `git ls-files`.split("\n").reject {|file| file.start_with? "example/"}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
16
16
  "README.md"
@@ -10,6 +10,7 @@ module Bugsnag
10
10
  attr_accessor :notify_release_stages
11
11
  attr_accessor :auto_notify
12
12
  attr_accessor :use_ssl
13
+ attr_accessor :ca_file
13
14
  attr_accessor :send_environment
14
15
  attr_accessor :send_code
15
16
  attr_accessor :project_root
@@ -30,7 +31,6 @@ module Bugsnag
30
31
  attr_accessor :timeout
31
32
  attr_accessor :hostname
32
33
  attr_accessor :delivery_method
33
-
34
34
  attr_writer :ignore_classes
35
35
 
36
36
  THREAD_LOCAL_NAME = "bugsnag_req_data"
@@ -62,6 +62,8 @@ module Bugsnag
62
62
  DEFAULT_DELIVERY_METHOD = :thread_queue
63
63
 
64
64
  def initialize
65
+ @mutex = Mutex.new
66
+
65
67
  # Set up the defaults
66
68
  self.auto_notify = true
67
69
  self.use_ssl = true
@@ -90,7 +92,7 @@ module Bugsnag
90
92
 
91
93
  # Accept both String and Class instances as an ignored class
92
94
  def ignore_classes
93
- @ignore_classes.map! { |klass| klass.is_a?(Class) ? klass.name : klass }
95
+ @mutex.synchronize { @ignore_classes.map! { |klass| klass.is_a?(Class) ? klass.name : klass } }
94
96
  end
95
97
 
96
98
  def should_notify?
@@ -32,6 +32,7 @@ module Bugsnag
32
32
  http.use_ssl = true
33
33
  # the default in 1.9+, but required for 1.8
34
34
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
35
+ http.ca_file = configuration.ca_file if configuration.ca_file
35
36
  end
36
37
 
37
38
  request = Net::HTTP::Post.new(path(uri), HEADERS)
@@ -47,4 +48,4 @@ module Bugsnag
47
48
  end
48
49
  end
49
50
 
50
- Bugsnag::Delivery.register(:synchronous, Bugsnag::Delivery::Synchronous)
51
+ Bugsnag::Delivery.register(:synchronous, Bugsnag::Delivery::Synchronous)
@@ -25,3 +25,4 @@ if Mailman.config.respond_to?(:middleware)
25
25
  end
26
26
 
27
27
  Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Mailman)
28
+ Bugsnag.configuration.app_type = "mailman"
@@ -64,10 +64,6 @@ module Bugsnag::Middleware
64
64
  notification.add_tab(:session, session.to_hash)
65
65
  end
66
66
  end
67
-
68
- # Add a cookies tab
69
- cookies = request.cookies
70
- notification.add_tab(:cookies, cookies) if cookies
71
67
  end
72
68
 
73
69
  @bugsnag.call(notification)
@@ -213,7 +213,7 @@ module Bugsnag
213
213
  end
214
214
 
215
215
  # make meta_data available to public middleware
216
- @meta_data = Bugsnag::Helpers.cleanup_obj(generate_meta_data(@exceptions, @overrides), @configuration.params_filters)
216
+ @meta_data = generate_meta_data(@exceptions, @overrides)
217
217
 
218
218
  # Run the middleware here (including Bugsnag::Middleware::Callbacks)
219
219
  # at the end of the middleware stack, execute the actual notification delivery
@@ -20,6 +20,8 @@ module Bugsnag
20
20
  # Hook up rack-based notification middlewares
21
21
  config.middleware.insert_before([Bugsnag::Middleware::Rails3Request,Bugsnag::Middleware::Callbacks], Bugsnag::Middleware::RackRequest) if defined?(::Rack)
22
22
  config.middleware.insert_before(Bugsnag::Middleware::Callbacks, Bugsnag::Middleware::WardenUser) if defined?(Warden)
23
+
24
+ Bugsnag.configuration.app_type ||= "rack"
23
25
  end
24
26
  end
25
27
 
@@ -31,6 +31,8 @@ module Bugsnag
31
31
  config_file = File.join(rails_root, "config", "bugsnag.yml")
32
32
  config = YAML.load_file(config_file) if File.exists?(config_file)
33
33
  Bugsnag.configure(config[rails_env] ? config[rails_env] : config) if config
34
+
35
+ Bugsnag.configuration.app_type = "rails"
34
36
  end
35
37
 
36
38
  def self.rails_logger
@@ -13,10 +13,12 @@ module Bugsnag
13
13
  end
14
14
 
15
15
  # send notifications if a command fails in a 'rails runner' call
16
- runner do
17
- at_exit do
18
- if $!
19
- Bugsnag.auto_notify($!)
16
+ if self.respond_to? :runner
17
+ runner do
18
+ at_exit do
19
+ if $!
20
+ Bugsnag.auto_notify($!)
21
+ end
20
22
  end
21
23
  end
22
24
  end
@@ -39,10 +41,15 @@ module Bugsnag
39
41
  require "bugsnag/rails/controller_methods"
40
42
  ::ActionController::Base.send(:include, Bugsnag::Rails::ControllerMethods)
41
43
  end
44
+ if defined?(ActionController::API)
45
+ ActionController::API.send(:include, Bugsnag::Rails::ControllerMethods)
46
+ end
42
47
  if defined?(ActiveRecord::Base)
43
48
  require "bugsnag/rails/active_record_rescue"
44
49
  ActiveRecord::Base.send(:include, Bugsnag::Rails::ActiveRecordRescue)
45
50
  end
51
+
52
+ Bugsnag.configuration.app_type = "rails"
46
53
  end
47
54
 
48
55
  # Configure params_filters after initialization, so that rails initializers
@@ -5,6 +5,7 @@ Rake::TaskManager.record_task_metadata = true
5
5
  class Rake::Task
6
6
 
7
7
  def execute_with_bugsnag(args=nil)
8
+ Bugsnag.configuration.app_type = "rake"
8
9
  old_task = Bugsnag.configuration.request_data[:bugsnag_running_task]
9
10
  Bugsnag.set_request_data :bugsnag_running_task, self
10
11
 
@@ -36,3 +36,5 @@ Resque::Failure::Bugsnag = Bugsnag::Resque
36
36
 
37
37
  # Auto-load the failure backend
38
38
  Bugsnag::Resque.add_failure_backend
39
+
40
+ Bugsnag.configuration.app_type = "resque"
@@ -35,3 +35,4 @@ else
35
35
  end
36
36
 
37
37
  Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Sidekiq)
38
+ Bugsnag.configuration.app_type = "sidekiq"
@@ -469,6 +469,38 @@ describe Bugsnag::Notification do
469
469
  }
470
470
  end
471
471
 
472
+ it "filters params from all payload hashes if they are added to params_filters as regex" do
473
+
474
+ Bugsnag.configuration.params_filters << /other_data/
475
+ Bugsnag.notify(BugsnagTestException.new("It crashed"), {:request => {:params => {:password => "1234", :other_password => "123456", :other_data => "123456"}}})
476
+
477
+ expect(Bugsnag).to have_sent_notification{ |payload|
478
+ event = get_event_from_payload(payload)
479
+ expect(event["metaData"]).not_to be_nil
480
+ expect(event["metaData"]["request"]).not_to be_nil
481
+ expect(event["metaData"]["request"]["params"]).not_to be_nil
482
+ expect(event["metaData"]["request"]["params"]["password"]).to eq("[FILTERED]")
483
+ expect(event["metaData"]["request"]["params"]["other_password"]).to eq("[FILTERED]")
484
+ expect(event["metaData"]["request"]["params"]["other_data"]).to eq("[FILTERED]")
485
+ }
486
+ end
487
+
488
+ it "filters params from all payload hashes if they are added to params_filters as partial regex" do
489
+
490
+ Bugsnag.configuration.params_filters << /r_data/
491
+ Bugsnag.notify(BugsnagTestException.new("It crashed"), {:request => {:params => {:password => "1234", :other_password => "123456", :other_data => "123456"}}})
492
+
493
+ expect(Bugsnag).to have_sent_notification{ |payload|
494
+ event = get_event_from_payload(payload)
495
+ expect(event["metaData"]).not_to be_nil
496
+ expect(event["metaData"]["request"]).not_to be_nil
497
+ expect(event["metaData"]["request"]["params"]).not_to be_nil
498
+ expect(event["metaData"]["request"]["params"]["password"]).to eq("[FILTERED]")
499
+ expect(event["metaData"]["request"]["params"]["other_password"]).to eq("[FILTERED]")
500
+ expect(event["metaData"]["request"]["params"]["other_data"]).to eq("[FILTERED]")
501
+ }
502
+ end
503
+
472
504
  it "does not filter params from payload hashes if their values are nil" do
473
505
  Bugsnag.notify(BugsnagTestException.new("It crashed"), {:request => {:params => {:nil_param => nil}}})
474
506
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.6
4
+ version: 2.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2015-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -190,4 +190,3 @@ signing_key:
190
190
  specification_version: 4
191
191
  summary: Ruby notifier for bugsnag.com
192
192
  test_files: []
193
- has_rdoc: