Class: Scanny::Checks::SystemTools::UnzipCheck

Inherits:
Check
  • Object
show all
Includes:
Helpers
Defined in:
lib/scanny/checks/system_tools/unzip_check.rb

Instance Method Summary collapse

Methods included from Helpers

#build_pattern_exec_command

Methods inherited from Check

#compiled_pattern, #issue, #strict?, #visit

Instance Method Details

#check(node) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/scanny/checks/system_tools/unzip_check.rb', line 14

def check(node)
  if Machete.matches?(node, build_pattern_exec_command(/unzip.*-:/))
    issue :high, warning_message, :cwe => [23, 88]
  elsif Machete.matches?(node, build_pattern_exec_command(/unzip\s+[^(=|&)]/))
    issue :medium, warning_message, :cwe => [23, 88]
  end
end

#patternObject



7
8
9
10
11
12
# File 'lib/scanny/checks/system_tools/unzip_check.rb', line 7

def pattern
  [
    build_pattern_exec_command(/unzip\s+[^(=|&)]/),
    build_pattern_exec_command(/unzip.*-:/)
  ].join("|")
end