提交 ed11c3da 编写于 作者: J Justin Collins

Add test for indexing libraries

上级 ffeba98d
class SweetLib
def do_some_cool_stuff bad
`ls #{bad}`
end
end
...@@ -16,7 +16,7 @@ class Rails4Tests < Test::Unit::TestCase ...@@ -16,7 +16,7 @@ class Rails4Tests < Test::Unit::TestCase
:controller => 0, :controller => 0,
:model => 1, :model => 1,
:template => 2, :template => 2,
:generic => 37 :generic => 38
} }
end end
...@@ -476,6 +476,18 @@ class Rails4Tests < Test::Unit::TestCase ...@@ -476,6 +476,18 @@ class Rails4Tests < Test::Unit::TestCase
:user_input => s(:call, s(:call, s(:params), :[], s(:lit, :more_ids)), :join, s(:str, ",")) :user_input => s(:call, s(:call, s(:params), :[], s(:lit, :more_ids)), :join, s(:str, ","))
end end
def test_command_injection_in_library
assert_warning :type => :warning,
:warning_code => 14,
:fingerprint => "9a11e7271784d69c667ad82481596096781a4873297d3f7523d290f51465f9d6",
:warning_type => "Command Injection",
:line => 3,
:message => /^Possible\ command\ injection/,
:confidence => 1,
:relative_path => "lib/sweet_lib.rb",
:user_input => s(:lvar, :bad)
end
def test_sql_injection_CVE_2013_6417 def test_sql_injection_CVE_2013_6417
assert_warning :type => :warning, assert_warning :type => :warning,
:warning_code => 69, :warning_code => 69,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册