spektr 0.5.4 → 0.5.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 +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/spektr/checks/base.rb +3 -3
- data/lib/spektr/checks/mass_assignment.rb +13 -6
- data/lib/spektr/checks/sqli.rb +3 -1
- data/lib/spektr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3f2e35ede68f8a611ce58a5ad3a4fc251e3d18191b9f1bc7fb314666d789063
|
|
4
|
+
data.tar.gz: 908740bb4515316fa1c5a69a0b583ea282251a3483fc33a704f83e63521fe249
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f92ec1f4949da94bad355d9062b825fbb96480bdf6fe9fb424a421afbaa132cae4b9d0313d0f7af902e25b6ac6141ddc871ecd01cc8f4e4118bd0e7082f362d3
|
|
7
|
+
data.tar.gz: b6e240e0449e4fb858ae591aaeec936a18502741e105b56b30f00c05c6286a7ce690cfb3ae7d66ce07c5f53c64eb8f6bff55420b0f016d2764d30cba5bb090eb
|
data/CHANGELOG.md
CHANGED
data/lib/spektr/checks/base.rb
CHANGED
|
@@ -106,10 +106,10 @@ module Spektr
|
|
|
106
106
|
node.body.body.each do |item|
|
|
107
107
|
return user_input? item
|
|
108
108
|
end
|
|
109
|
-
when :string_node, :symbol_node, :constant_read_node, :integer_node, :
|
|
109
|
+
when :string_node, :symbol_node, :constant_read_node, :integer_node, :constant_path_node, :nil_node, :true_node, :false_node, :self_node, :global_variable_read_node
|
|
110
110
|
# do nothing
|
|
111
111
|
else
|
|
112
|
-
Spektr
|
|
112
|
+
::Spektr.logger.debug "Unknown argument type #{node.type.inspect} #{node.inspect}"
|
|
113
113
|
end
|
|
114
114
|
false
|
|
115
115
|
end
|
|
@@ -199,7 +199,7 @@ module Spektr
|
|
|
199
199
|
when :string_node, :symbol_node, :integer_node, :constant_path_node, :nil_node, :true_node, :false_node, :self_node, :global_variable_read_node
|
|
200
200
|
# do nothing
|
|
201
201
|
else
|
|
202
|
-
Spektr
|
|
202
|
+
Spektr.logger.debug "Unknown argument type #{node.type}"
|
|
203
203
|
end
|
|
204
204
|
end
|
|
205
205
|
|
|
@@ -23,13 +23,20 @@ module Spektr
|
|
|
23
23
|
argument = call.arguments&.arguments&.first
|
|
24
24
|
next if argument.nil?
|
|
25
25
|
::Spektr.logger.debug "Mass assignment check at #{call.location.start_line}"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
next unless user_input?(argument)
|
|
27
|
+
if argument.type == :local_variable_read_node
|
|
28
|
+
variable = @target.lvars.find do |n|
|
|
29
|
+
n.name == argument.name
|
|
30
|
+
end
|
|
31
|
+
param = variable.value
|
|
32
|
+
else
|
|
33
|
+
param = argument
|
|
32
34
|
end
|
|
35
|
+
# we check for permit! separately
|
|
36
|
+
next if param.respond_to?(:name) && param.name == :permit!
|
|
37
|
+
# check for permit with arguments
|
|
38
|
+
next if param.respond_to?(:name) && param.name == :permit && param.arguments
|
|
39
|
+
warn! @target, self, call.location, "Mass assignment"
|
|
33
40
|
end
|
|
34
41
|
@target.find_calls(:permit!).each do |call|
|
|
35
42
|
unless call.arguments
|
data/lib/spektr/checks/sqli.rb
CHANGED
|
@@ -19,7 +19,9 @@ module Spektr
|
|
|
19
19
|
|
|
20
20
|
].each do |m|
|
|
21
21
|
@target.find_calls(m).each do |call|
|
|
22
|
-
|
|
22
|
+
arguments = call.arguments&.arguments&.first
|
|
23
|
+
next if arguments && arguments.type == :keyword_hash_node
|
|
24
|
+
check_argument(arguments, m, call)
|
|
23
25
|
end
|
|
24
26
|
end
|
|
25
27
|
[:calculate].each do |m|
|
data/lib/spektr/version.rb
CHANGED