sqreen 1.7.1-java → 1.7.2-java
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: 8223ebd05a7bc08f9b17998ec2f44cddb5e1e958
|
4
|
+
data.tar.gz: e203f67c6f078dd1003a1e47a351e0f41df83987
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5e7309f49b33393de0480239146c6f89265dfae21fadcfc2183964f388f6a00e1259fe30269c716733846b6349b12555bf7e0f9c8112b0c28ad2db4fa363b88
|
7
|
+
data.tar.gz: 71e8adf17dbe6cbcfea8467160f3b5560ab0ff71429ab33bf1fa84db366bc0c7e9b56cae2e118144db5829b2a77b8ece1e6359f304bfa5cad657be84d4e7f259
|
@@ -61,6 +61,8 @@ module Sqreen
|
|
61
61
|
|
62
62
|
returns = []
|
63
63
|
callbacks.each do |cb|
|
64
|
+
# If record_request is part of callbacks we should filter after it ran
|
65
|
+
next if cb.whitelisted?
|
64
66
|
rule = cb.rule_name if cb.respond_to?(:rule_name)
|
65
67
|
Sqreen.log.debug { "running pre cb #{cb}" }
|
66
68
|
Sqreen::PerformanceNotifications.instrument("Callbacks/#{rule || cb.class.name}/pre") do
|
@@ -7,6 +7,7 @@ module Sqreen
|
|
7
7
|
module Rules
|
8
8
|
# matcher behavior
|
9
9
|
module Matcher
|
10
|
+
attr_reader :min_size
|
10
11
|
def self.prepare_re_pattern(value, options, case_sensitive)
|
11
12
|
res = 0
|
12
13
|
res |= Regexp::MULTILINE if options.include?('multiline')
|
@@ -33,6 +34,7 @@ module Sqreen
|
|
33
34
|
'equals'.freeze => lambda { |value, str| str == value },
|
34
35
|
}
|
35
36
|
|
37
|
+
sizes = []
|
36
38
|
patterns.each do |entry|
|
37
39
|
next unless entry
|
38
40
|
type = entry['type']
|
@@ -56,25 +58,28 @@ module Sqreen
|
|
56
58
|
end
|
57
59
|
@string[opt] = { :ci => [], :cs => [] } unless @string.key?(opt)
|
58
60
|
@string[opt][case_type] << val
|
59
|
-
|
61
|
+
sizes << entry.fetch('min_length') { val.size }
|
60
62
|
when 'regexp'
|
61
63
|
pattern = Matcher.prepare_re_pattern(val, opt, case_sensitive)
|
62
64
|
next unless pattern
|
63
65
|
@regexp_patterns << pattern
|
66
|
+
sizes << entry['min_length']
|
64
67
|
else
|
65
68
|
raise Sqreen::Exception, "No such matcher type #{type}"
|
66
69
|
end
|
67
70
|
end
|
68
71
|
|
72
|
+
@min_size = sizes.min unless sizes.any?(&:nil?)
|
73
|
+
|
69
74
|
return unless [@regexp_patterns, @string].map(&:empty?).all?
|
70
75
|
msg = "no key 'regexp' nor 'match' in data (had #{@data.keys})"
|
71
76
|
raise Sqreen::Exception, msg
|
72
77
|
end
|
73
78
|
|
74
79
|
def match(str)
|
75
|
-
return if str.nil? || str.empty?
|
76
|
-
str = enforce_encoding(str)
|
77
|
-
istr = str.downcase
|
80
|
+
return if str.nil? || str.empty? || !str.is_a?(String)
|
81
|
+
str = enforce_encoding(str) unless str.ascii_only?
|
82
|
+
istr = str.downcase unless @string.empty?
|
78
83
|
|
79
84
|
@string.each do |type, cases|
|
80
85
|
fun = @funs[type]
|
@@ -100,7 +105,6 @@ module Sqreen
|
|
100
105
|
end
|
101
106
|
else
|
102
107
|
@regexp_patterns.each do |p|
|
103
|
-
warn(Encoding.compatible?(p, str).inspect)
|
104
108
|
return p if p.match(str)
|
105
109
|
end
|
106
110
|
end
|
@@ -110,8 +114,6 @@ module Sqreen
|
|
110
114
|
private
|
111
115
|
|
112
116
|
def enforce_encoding(str)
|
113
|
-
return str unless str.is_a?(String)
|
114
|
-
return str if str.ascii_only?
|
115
117
|
encoded8bit = str.encoding.name == 'ASCII-8BIT'
|
116
118
|
return str if !encoded8bit && str.valid_encoding?
|
117
119
|
str.chars.map do |v|
|
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.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Sqreen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|