sqreen 1.6.4 → 1.6.5
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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cc4c4bcf86488934c2048d33804dd07398484e09
         | 
| 4 | 
            +
              data.tar.gz: 4d4bb6a78d00ef04d6d824f01f1194a156cb019b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1ab651db3fb58f44551e4c04885da9bf0c7543a51c479565e8baf23cb7739d83b0b14196ac6958515462b34103542916875da9516cac8517b0f54a74cfa437ee
         | 
| 7 | 
            +
              data.tar.gz: b6886860a4d6a9d118bc675c4ea6b1e70fe6093c9cbda35691f89a9058e845b1270f75b67c9b2bbacd4f4e3a40b013fc5ba733c9cc8d269e5b2806a510c4b699
         | 
| @@ -244,6 +244,7 @@ module Sqreen | |
| 244 244 | 
             
                      when Array
         | 
| 245 245 | 
             
                        look_into.concat(val)
         | 
| 246 246 | 
             
                      else
         | 
| 247 | 
            +
                        next if val.respond_to?(:seek)
         | 
| 247 248 | 
             
                        val.each { |v| look_into << v } if val.respond_to?(:each)
         | 
| 248 249 | 
             
                      end
         | 
| 249 250 | 
             
                    end
         | 
| @@ -266,6 +267,7 @@ module Sqreen | |
| 266 267 | 
             
                      when Array
         | 
| 267 268 | 
             
                        look_into.concat(val)
         | 
| 268 269 | 
             
                      else
         | 
| 270 | 
            +
                        next if val.respond_to?(:seek)
         | 
| 269 271 | 
             
                        if val.respond_to?(:each)
         | 
| 270 272 | 
             
                          val.each { |v| look_into << v }
         | 
| 271 273 | 
             
                        else
         | 
| @@ -15,15 +15,16 @@ module Sqreen | |
| 15 15 | 
             
                  # The remaining code is only to find out if user entry was an attack,
         | 
| 16 16 | 
             
                  # and record it. Since we don't rely on it to respond to user, it would
         | 
| 17 17 | 
             
                  # be better to do it in background.
         | 
| 18 | 
            -
                  def report_dangerous_xss(value)
         | 
| 18 | 
            +
                  def report_dangerous_xss?(value)
         | 
| 19 19 | 
             
                    found = match_regexp(value)
         | 
| 20 20 |  | 
| 21 | 
            -
                    return unless found
         | 
| 21 | 
            +
                    return false unless found
         | 
| 22 22 | 
             
                    infos = {
         | 
| 23 23 | 
             
                      :found => found,
         | 
| 24 24 | 
             
                      :payload => value,
         | 
| 25 25 | 
             
                    }
         | 
| 26 26 | 
             
                    record_event(infos)
         | 
| 27 | 
            +
                    true
         | 
| 27 28 | 
             
                  end
         | 
| 28 29 | 
             
                end
         | 
| 29 30 | 
             
                # look for reflected XSS with erb template engine
         | 
| @@ -43,14 +44,14 @@ module Sqreen | |
| 43 44 | 
             
                    Sqreen.log.debug { format('Found unescaped user param: %s', value) }
         | 
| 44 45 |  | 
| 45 46 | 
             
                    saved_value = value.dup
         | 
| 47 | 
            +
                    return unless report_dangerous_xss?(saved_value)
         | 
| 48 | 
            +
             | 
| 46 49 | 
             
                    # potential XSS! let's escape
         | 
| 47 50 | 
             
                    if block &&
         | 
| 48 51 | 
             
                       (!framework || !find_whitelisted_path(framework.request_path.to_s))
         | 
| 49 52 | 
             
                      args[0].replace(CGI.escape_html(value))
         | 
| 50 53 | 
             
                    end
         | 
| 51 54 |  | 
| 52 | 
            -
                    report_dangerous_xss(saved_value)
         | 
| 53 | 
            -
             | 
| 54 55 | 
             
                    advise_action(nil)
         | 
| 55 56 | 
             
                  end
         | 
| 56 57 | 
             
                end
         | 
| @@ -72,7 +73,7 @@ module Sqreen | |
| 72 73 |  | 
| 73 74 | 
             
                    return unless value.is_a?(String)
         | 
| 74 75 |  | 
| 75 | 
            -
                    report_dangerous_xss(value)
         | 
| 76 | 
            +
                    return unless report_dangerous_xss?(value)
         | 
| 76 77 |  | 
| 77 78 | 
             
                    return unless block
         | 
| 78 79 | 
             
                    # potential XSS! let's escape
         | 
| @@ -139,9 +140,8 @@ module Sqreen | |
| 139 140 | 
             
                    return unless Haml::VERSION < '5'
         | 
| 140 141 | 
             
                    attrs = args[-1]
         | 
| 141 142 | 
             
                    new_attrs, found_xss = Haml4CompilerBuildAttributeCB.clean_hash_key(attrs) do |key|
         | 
| 142 | 
            -
                      if !key.nil? && key.is_a?(String) && framework.full_params_include?(key)
         | 
| 143 | 
            +
                      if !key.nil? && key.is_a?(String) && framework.full_params_include?(key) && report_dangerous_xss?(key)
         | 
| 143 144 | 
             
                        Sqreen.log.debug { format('Found unescaped user param: %s', key) }
         | 
| 144 | 
            -
                        report_dangerous_xss(key)
         | 
| 145 145 | 
             
                        [CGI.escape_html(key), true]
         | 
| 146 146 | 
             
                      else
         | 
| 147 147 | 
             
                        [key, false]
         | 
| @@ -209,7 +209,7 @@ module Sqreen | |
| 209 209 |  | 
| 210 210 | 
             
                    return unless value.is_a?(String)
         | 
| 211 211 |  | 
| 212 | 
            -
                    report_dangerous_xss(value)
         | 
| 212 | 
            +
                    return unless report_dangerous_xss?(value)
         | 
| 213 213 |  | 
| 214 214 | 
             
                    return unless block
         | 
| 215 215 | 
             
                    # potential XSS! let's escape
         | 
    
        data/lib/sqreen/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sqreen
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.6. | 
| 4 | 
            +
              version: 1.6.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sqreen
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-06-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: execjs
         |