sentry-raven 2.3.0 → 2.3.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: 1d47eee39c7781d07673b21c829027ae9ff2a4e3
4
- data.tar.gz: 14406d91d68320529521e749b2392ead1e59a95c
3
+ metadata.gz: fe631150dba3e7d468ec1b82dce90c833efe4e09
4
+ data.tar.gz: 6b362a1faf2b2b17bb4635cbeca461402459428b
5
5
  SHA512:
6
- metadata.gz: aeb178b4827443e9dcfe3bd2299e772d9b0f69c42a8e6a281574dec4152d6f976ebd12b8d2aed490073111ad21624e6443f8bf6829d74dc6e2701eaed6b245f2
7
- data.tar.gz: 4cd7b703b9cc39c8e838429daef8a24bb70de46d4397bcb9a93c9c1731b51acd600096e1f9db5a83de4e3a7fe498fa69e48fdb92c75f39b14f1ec01f465a5f07
6
+ metadata.gz: 82ca336c688dd243a368bb59cca6afb73e5de96828f2dfca286efded734946997cea6f6dcd862d41184d5cfe251f5927d4b7a25fd7fc705841b40662dd131680
7
+ data.tar.gz: 1e49e8fc891a662fc6043690d5711419f5703a44f2a40c8a5acff9f1696368d52160345f9e575f8e7b965b8d803abd3b5896266702e57256305279dbd2a2bb28
@@ -5,8 +5,12 @@ module Raven
5
5
  class Backtrace
6
6
  # Handles backtrace parsing line by line
7
7
  class Line
8
- # regexp (optionnally allowing leading X: for windows support)
9
- RUBY_INPUT_FORMAT = /^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$/
8
+ # regexp (optional leading X: on windows, or JRuby9000 class-prefix)
9
+ RUBY_INPUT_FORMAT = /
10
+ ^ \s* (?: [a-zA-Z]: | uri:classloader: )? ([^:]+ | <.*>):
11
+ (\d+)
12
+ (?: :in \s `([^']+)')?$
13
+ /x
10
14
 
11
15
  # org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
12
16
  JAVA_INPUT_FORMAT = /^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$/
@@ -30,6 +34,7 @@ module Raven
30
34
  ruby_match = unparsed_line.match(RUBY_INPUT_FORMAT)
31
35
  if ruby_match
32
36
  _, file, number, method = ruby_match.to_a
37
+ file.sub!(/\.class$/, ".rb")
33
38
  module_name = nil
34
39
  else
35
40
  java_match = unparsed_line.match(JAVA_INPUT_FORMAT)
@@ -97,8 +97,7 @@ module Raven
97
97
  def failed_send(e, event)
98
98
  @state.failure
99
99
  if e # exception was raised
100
- configuration.logger.error "Unable to record event with remote Sentry server (#{e.class} - #{e.message})"
101
- e.backtrace[0..10].each { |line| configuration.logger.error(line) }
100
+ configuration.logger.error "Unable to record event with remote Sentry server (#{e.class} - #{e.message}):\n#{e.backtrace[0..10].join("\n")}"
102
101
  else
103
102
  configuration.logger.error "Not sending event due to previous failure(s)."
104
103
  end
@@ -24,10 +24,10 @@ module Delayed
24
24
  }
25
25
  }
26
26
  # last_error can be nil
27
- extra[:last_error] = job.last_error[0...100] if job.last_error
27
+ extra[:last_error] = job.last_error[0...1000] if job.last_error
28
28
  # handlers are YAML objects in strings, we definitely can't
29
29
  # report all of that or the event will get truncated randomly
30
- extra[:handler] = job.handler[0...100] if job.handler
30
+ extra[:handler] = job.handler[0...1000] if job.handler
31
31
 
32
32
  if job.respond_to?('payload_object') && job.payload_object.respond_to?('job_data')
33
33
  extra[:active_job] = job.payload_object.job_data
@@ -101,7 +101,7 @@ module Raven
101
101
  # env['SERVER_PROTOCOL']. But we don't want to ignore a valid header
102
102
  # if the request has legitimately sent a Version header themselves.
103
103
  # See: https://github.com/rack/rack/blob/028438f/lib/rack/handler/cgi.rb#L29
104
- next if key == 'HTTP_VERSION' && value == ENV['SERVER_PROTOCOL']
104
+ next if key == 'HTTP_VERSION' && value == env_hash['SERVER_PROTOCOL']
105
105
 
106
106
  next unless key.start_with?('HTTP_') || %w(CONTENT_TYPE CONTENT_LENGTH).include?(key)
107
107
  # Rack stores headers as HTTP_WHAT_EVER, we need What-Ever
@@ -6,7 +6,7 @@ module Rake
6
6
  class Application
7
7
  alias orig_display_error_messsage display_error_message
8
8
  def display_error_message(ex)
9
- Raven.capture_exception ex, :logger => 'rake', :tags => { 'rake_task' => @name }
9
+ Raven.capture_exception ex, :logger => 'rake', :tags => { 'rake_task' => top_level_tasks.join(' ') }
10
10
  orig_display_error_messsage(ex)
11
11
  end
12
12
  end
@@ -10,7 +10,7 @@ module Raven
10
10
  end
11
11
 
12
12
  def unformatted_message
13
- params.nil? ? message : message % params
13
+ Array(params).empty? ? message : message % params
14
14
  end
15
15
 
16
16
  def self.sentry_alias
@@ -1,16 +1,26 @@
1
1
  module Raven
2
2
  class Processor::Cookies < Processor
3
3
  def process(data)
4
- if data[:request]
5
- # Remove possibly sensitive cookies
6
- data[:request][:cookies] = STRING_MASK if data[:request][:cookies]
7
-
8
- if data[:request][:headers] && data[:request][:headers]["Cookie"]
9
- data[:request][:headers]["Cookie"] = STRING_MASK
10
- end
11
- end
4
+ process_if_symbol_keys(data) if data[:request]
5
+ process_if_string_keys(data) if data["request"]
12
6
 
13
7
  data
14
8
  end
9
+
10
+ private
11
+
12
+ def process_if_symbol_keys(data)
13
+ data[:request][:cookies] = STRING_MASK if data[:request][:cookies]
14
+
15
+ return unless data[:request][:headers] && data[:request][:headers]["Cookie"]
16
+ data[:request][:headers]["Cookie"] = STRING_MASK
17
+ end
18
+
19
+ def process_if_string_keys(data)
20
+ data["request"]["cookies"] = STRING_MASK if data["request"]["cookies"]
21
+
22
+ return unless data["request"]["headers"] && data["request"]["headers"]["Cookie"]
23
+ data["request"]["headers"]["Cookie"] = STRING_MASK
24
+ end
15
25
  end
16
26
  end
@@ -10,17 +10,30 @@ module Raven
10
10
  end
11
11
 
12
12
  def process(data)
13
- if data[:request] && data[:request][:headers]
14
- data[:request][:headers].keys.select { |k| fields_re.match(k.to_s) }.each do |k|
15
- data[:request][:headers][k] = STRING_MASK
16
- end
17
- end
13
+ process_if_symbol_keys(data) if data[:request]
14
+ process_if_string_keys(data) if data["request"]
18
15
 
19
16
  data
20
17
  end
21
18
 
22
19
  private
23
20
 
21
+ def process_if_symbol_keys(data)
22
+ return unless data[:request][:headers]
23
+
24
+ data[:request][:headers].keys.select { |k| fields_re.match(k.to_s) }.each do |k|
25
+ data[:request][:headers][k] = STRING_MASK
26
+ end
27
+ end
28
+
29
+ def process_if_string_keys(data)
30
+ return unless data["request"]["headers"]
31
+
32
+ data["request"]["headers"].keys.select { |k| fields_re.match(k) }.each do |k|
33
+ data["request"]["headers"][k] = STRING_MASK
34
+ end
35
+ end
36
+
24
37
  def matches_regexes?(k)
25
38
  fields_re.match(k.to_s)
26
39
  end
@@ -1,11 +1,22 @@
1
1
  module Raven
2
2
  class Processor::PostData < Processor
3
3
  def process(data)
4
- if data[:request] && data[:request][:method] == "POST"
5
- data[:request][:data] = STRING_MASK # Remove possibly sensitive POST data
6
- end
4
+ process_if_symbol_keys(data) if data[:request]
5
+ process_if_string_keys(data) if data["request"]
7
6
 
8
7
  data
9
8
  end
9
+
10
+ private
11
+
12
+ def process_if_symbol_keys(data)
13
+ return unless data[:request][:method] == "POST"
14
+ data[:request][:data] = STRING_MASK
15
+ end
16
+
17
+ def process_if_string_keys(data)
18
+ return unless data["request"]["method"] == "POST"
19
+ data["request"]["data"] = STRING_MASK
20
+ end
10
21
  end
11
22
  end
@@ -1,13 +1,24 @@
1
1
  module Raven
2
2
  class Processor::RemoveStacktrace < Processor
3
- def process(value)
4
- if value[:exception]
5
- value[:exception][:values].map do |single_exception|
6
- single_exception.delete(:stacktrace) if single_exception[:stacktrace]
7
- end
3
+ def process(data)
4
+ process_if_symbol_keys(data) if data[:exception]
5
+ process_if_string_keys(data) if data["exception"]
6
+
7
+ data
8
+ end
9
+
10
+ private
11
+
12
+ def process_if_symbol_keys(data)
13
+ data[:exception][:values].map do |single_exception|
14
+ single_exception.delete(:stacktrace) if single_exception[:stacktrace]
8
15
  end
16
+ end
9
17
 
10
- value
18
+ def process_if_string_keys(data)
19
+ data["exception"]["values"].map do |single_exception|
20
+ single_exception.delete("stacktrace") if single_exception["stacktrace"]
21
+ end
11
22
  end
12
23
  end
13
24
  end
@@ -29,7 +29,9 @@ module Raven
29
29
  end
30
30
  rescue Faraday::ClientError => ex
31
31
  error_info = ex.message
32
- error_info += " Error in headers is: #{ex.response[:headers]['x-sentry-error']}" if ex.response[:headers]['x-sentry-error']
32
+ if ex.response && ex.response[:headers]['x-sentry-error']
33
+ error_info += " Error in headers is: #{ex.response[:headers]['x-sentry-error']}"
34
+ end
33
35
  raise Raven::Error, error_info
34
36
  end
35
37
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Raven
3
3
  # Freezing this constant breaks in 1.9.x
4
- VERSION = "2.3.0" # rubocop:disable Style/MutableConstant
4
+ VERSION = "2.3.1" # rubocop:disable Style/MutableConstant
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday