sentry-raven 2.5.0 → 2.5.1
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 +4 -4
 - data/README.md +1 -1
 - data/lib/raven/integrations/rack-timeout.rb +1 -1
 - data/lib/raven/interfaces/stack_trace.rb +15 -12
 - data/lib/raven/processor.rb +1 -1
 - data/lib/raven/processor/sanitizedata.rb +8 -1
 - data/lib/raven/processor/utf8conversion.rb +22 -6
 - data/lib/raven/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 591ad299f0dbdc5e0c5e980fd0406733a90c6ffa
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bdbcf9a5152af5c5bfd459f302be3439080dbca1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: dc97bc821db8541a18dc10cf031c6c8684cc6aa1b2200bad974e1e8d11460dabe59e59d144651e27cc8117965452b1ff2ef3a031f14736f801ec7ac1836e1609
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9e6c6de2b3eda11d19514736823f487fd5a66cddde4bbdbc81a1a4e6382ea2fd4a42d3d5ed0eae5208245f1c10c98b612a6479c4331b3eda70a0090d128e1aba
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -7,7 +7,7 @@ A client and integration layer for the [Sentry](https://github.com/getsentry/sen 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            ## Requirements
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            We test on Ruby 1.9, 2.2 and 2. 
     | 
| 
      
 10 
     | 
    
         
            +
            We test on Ruby 1.9, 2.2, 2.3, and 2.4 at the latest patchlevel/teeny version. We also support JRuby 1.7 and 9.0. Our Rails integration works with Rails 4.2+ (including Rails 5).
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            ## Getting Started
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # We need to do this because of the way integration loading works
         
     | 
| 
       2 
     | 
    
         
            -
            require "rack/timeout/base"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "rack/timeout/base" unless defined?(Rack::Timeout)
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            # This integration is a good example of how to change how exceptions
         
     | 
| 
       5 
5 
     | 
    
         
             
            # get grouped by Sentry's UI. Simply override #raven_context in
         
     | 
| 
         @@ -38,6 +38,7 @@ module Raven 
     | 
|
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                  def filename
         
     | 
| 
       40 
40 
     | 
    
         
             
                    return if abs_path.nil?
         
     | 
| 
      
 41 
     | 
    
         
            +
                    return @filename if @filename
         
     | 
| 
       41 
42 
     | 
    
         | 
| 
       42 
43 
     | 
    
         
             
                    prefix =
         
     | 
| 
       43 
44 
     | 
    
         
             
                      if under_project_root? && in_app
         
     | 
| 
         @@ -48,9 +49,21 @@ module Raven 
     | 
|
| 
       48 
49 
     | 
    
         
             
                        longest_load_path
         
     | 
| 
       49 
50 
     | 
    
         
             
                      end
         
     | 
| 
       50 
51 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                    prefix ? abs_path[prefix.to_s.chomp(File::SEPARATOR).length + 1..-1] : abs_path
         
     | 
| 
      
 52 
     | 
    
         
            +
                    @filename = prefix ? abs_path[prefix.to_s.chomp(File::SEPARATOR).length + 1..-1] : abs_path
         
     | 
| 
       52 
53 
     | 
    
         
             
                  end
         
     | 
| 
       53 
54 
     | 
    
         | 
| 
      
 55 
     | 
    
         
            +
                  def to_hash(*args)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    data = super(*args)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    data[:filename] = filename
         
     | 
| 
      
 58 
     | 
    
         
            +
                    data.delete(:vars) unless vars && !vars.empty?
         
     | 
| 
      
 59 
     | 
    
         
            +
                    data.delete(:pre_context) unless pre_context && !pre_context.empty?
         
     | 
| 
      
 60 
     | 
    
         
            +
                    data.delete(:post_context) unless post_context && !post_context.empty?
         
     | 
| 
      
 61 
     | 
    
         
            +
                    data.delete(:context_line) unless context_line && !context_line.empty?
         
     | 
| 
      
 62 
     | 
    
         
            +
                    data
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                  private
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
       54 
67 
     | 
    
         
             
                  def under_project_root?
         
     | 
| 
       55 
68 
     | 
    
         
             
                    project_root && abs_path.start_with?(project_root)
         
     | 
| 
       56 
69 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -60,17 +73,7 @@ module Raven 
     | 
|
| 
       60 
73 
     | 
    
         
             
                  end
         
     | 
| 
       61 
74 
     | 
    
         | 
| 
       62 
75 
     | 
    
         
             
                  def longest_load_path
         
     | 
| 
       63 
     | 
    
         
            -
                    $LOAD_PATH.select { | 
     | 
| 
       64 
     | 
    
         
            -
                  end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                  def to_hash(*args)
         
     | 
| 
       67 
     | 
    
         
            -
                    data = super(*args)
         
     | 
| 
       68 
     | 
    
         
            -
                    data[:filename] = filename
         
     | 
| 
       69 
     | 
    
         
            -
                    data.delete(:vars) unless vars && !vars.empty?
         
     | 
| 
       70 
     | 
    
         
            -
                    data.delete(:pre_context) unless pre_context && !pre_context.empty?
         
     | 
| 
       71 
     | 
    
         
            -
                    data.delete(:post_context) unless post_context && !post_context.empty?
         
     | 
| 
       72 
     | 
    
         
            -
                    data.delete(:context_line) unless context_line && !context_line.empty?
         
     | 
| 
       73 
     | 
    
         
            -
                    data
         
     | 
| 
      
 76 
     | 
    
         
            +
                    $LOAD_PATH.select { |path| abs_path.start_with?(path.to_s) }.max_by(&:size)
         
     | 
| 
       74 
77 
     | 
    
         
             
                  end
         
     | 
| 
       75 
78 
     | 
    
         
             
                end
         
     | 
| 
       76 
79 
     | 
    
         
             
              end
         
     | 
    
        data/lib/raven/processor.rb
    CHANGED
    
    
| 
         @@ -40,9 +40,16 @@ module Raven 
     | 
|
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                private
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
      
 43 
     | 
    
         
            +
                # CGI.parse takes our nice UTF-8 strings and converts them back to ASCII,
         
     | 
| 
      
 44 
     | 
    
         
            +
                # so we have to convert them back, again.
         
     | 
| 
      
 45 
     | 
    
         
            +
                def utf8_processor
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @utf8_processor ||= Processor::UTF8Conversion.new
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
       43 
49 
     | 
    
         
             
                def sanitize_query_string(query_string)
         
     | 
| 
       44 
50 
     | 
    
         
             
                  query_hash = CGI.parse(query_string)
         
     | 
| 
       45 
     | 
    
         
            -
                   
     | 
| 
      
 51 
     | 
    
         
            +
                  sanitized = utf8_processor.process(query_hash)
         
     | 
| 
      
 52 
     | 
    
         
            +
                  processed_query_hash = process(sanitized)
         
     | 
| 
       46 
53 
     | 
    
         
             
                  URI.encode_www_form(processed_query_hash)
         
     | 
| 
       47 
54 
     | 
    
         
             
                end
         
     | 
| 
       48 
55 
     | 
    
         | 
| 
         @@ -1,19 +1,25 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Raven
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Processor::UTF8Conversion < Processor
         
     | 
| 
      
 3 
     | 
    
         
            +
                # Slightly misnamed - actually just removes any bytes with invalid encoding
         
     | 
| 
      
 4 
     | 
    
         
            +
                # Previously, our JSON backend required UTF-8. Since we now use the built-in
         
     | 
| 
      
 5 
     | 
    
         
            +
                # JSON, we can use any encoding, but it must be valid anyway so we can do
         
     | 
| 
      
 6 
     | 
    
         
            +
                # things like call #match and #slice on strings
         
     | 
| 
      
 7 
     | 
    
         
            +
                REPLACE = "".freeze
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       3 
9 
     | 
    
         
             
                def process(value)
         
     | 
| 
       4 
10 
     | 
    
         
             
                  case value
         
     | 
| 
       5 
     | 
    
         
            -
                  when Array
         
     | 
| 
       6 
     | 
    
         
            -
                    !value.frozen? ? value.map! { |v| process v } : value.map { |v| process v }
         
     | 
| 
       7 
11 
     | 
    
         
             
                  when Hash
         
     | 
| 
       8 
12 
     | 
    
         
             
                    !value.frozen? ? value.merge!(value) { |_, v| process v } : value.merge(value) { |_, v| process v }
         
     | 
| 
      
 13 
     | 
    
         
            +
                  when Array
         
     | 
| 
      
 14 
     | 
    
         
            +
                    !value.frozen? ? value.map! { |v| process v } : value.map { |v| process v }
         
     | 
| 
       9 
15 
     | 
    
         
             
                  when Exception
         
     | 
| 
       10 
16 
     | 
    
         
             
                    return value if value.message.valid_encoding?
         
     | 
| 
       11 
     | 
    
         
            -
                    clean_exc = value.class.new( 
     | 
| 
      
 17 
     | 
    
         
            +
                    clean_exc = value.class.new(remove_invalid_bytes(value.message))
         
     | 
| 
       12 
18 
     | 
    
         
             
                    clean_exc.set_backtrace(value.backtrace)
         
     | 
| 
       13 
19 
     | 
    
         
             
                    clean_exc
         
     | 
| 
       14 
20 
     | 
    
         
             
                  when String
         
     | 
| 
       15 
21 
     | 
    
         
             
                    return value if value.valid_encoding?
         
     | 
| 
       16 
     | 
    
         
            -
                     
     | 
| 
      
 22 
     | 
    
         
            +
                    remove_invalid_bytes(value)
         
     | 
| 
       17 
23 
     | 
    
         
             
                  else
         
     | 
| 
       18 
24 
     | 
    
         
             
                    value
         
     | 
| 
       19 
25 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -21,8 +27,18 @@ module Raven 
     | 
|
| 
       21 
27 
     | 
    
         | 
| 
       22 
28 
     | 
    
         
             
                private
         
     | 
| 
       23 
29 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                 
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
                # Stolen from RSpec
         
     | 
| 
      
 31 
     | 
    
         
            +
                # https://github.com/rspec/rspec-support/blob/f0af3fd74a94ff7bb700f6ba06dbdc67bba17fbf/lib/rspec/support/encoded_string.rb#L120-L139
         
     | 
| 
      
 32 
     | 
    
         
            +
                if String.method_defined?(:scrub) # 2.1+
         
     | 
| 
      
 33 
     | 
    
         
            +
                  def remove_invalid_bytes(string)
         
     | 
| 
      
 34 
     | 
    
         
            +
                    string.scrub!(REPLACE)
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
                else
         
     | 
| 
      
 37 
     | 
    
         
            +
                  def remove_invalid_bytes(string)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    string.chars.map do |char|
         
     | 
| 
      
 39 
     | 
    
         
            +
                      char.valid_encoding? ? char : REPLACE
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end.join
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
       26 
42 
     | 
    
         
             
                end
         
     | 
| 
       27 
43 
     | 
    
         
             
              end
         
     | 
| 
       28 
44 
     | 
    
         
             
            end
         
     | 
    
        data/lib/raven/version.rb
    CHANGED
    
    
    
        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.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.5.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-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-05-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: faraday
         
     |