sqreen 1.7.1 → 1.7.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5741aa7c3b34891c2a790746a3bdaa41b89af92b
|
4
|
+
data.tar.gz: bf1170f3d02dc780352e4c55a5f26862ce0a340e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87ca7a7ae12ab3b762c12b4c051d0fbf7bce0f16a4b11d9b80462aff8ba01a2f3ce4c8ddcd41c41cc9c93ddb4f920384f6812410b0c4089ffd3c78e2812c4490
|
7
|
+
data.tar.gz: d93a22ee357be92f2fe75b877f2be5af7d7b947ca605102743a241c7592b300d8fd43ad2cb19c7cc707bb832512edf56a5df6fbaf05851dc5fb64b91b123bf8f
|
@@ -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: ruby
|
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
|