提交 480d55c9 编写于 作者: J Justin Collins

Add tests for command injection via locals

which should be medium confidence warnings
上级 c0b87152
......@@ -43,4 +43,9 @@ class OtherController < ApplicationController
def test_mail_to
@user = User.find(current_user)
end
def test_command_injection_locals
`#{some_command}`
system("ls #{some_files}")
end
end
......@@ -15,7 +15,7 @@ class Rails3Tests < Test::Unit::TestCase
:controller => 1,
:model => 5,
:template => 30,
:warning => 31
:warning => 33
}
end
......@@ -63,6 +63,24 @@ class Rails3Tests < Test::Unit::TestCase
:file => /home_controller\.rb/
end
def test_command_injection_non_user_input_backticks
assert_warning :type => :warning,
:warning_type => "Command Injection",
:line => 48,
:message => /^Possible\ command\ injection/,
:confidence => 1,
:file => /other_controller\.rb/
end
def test_command_injection_non_user_input_system
assert_warning :type => :warning,
:warning_type => "Command Injection",
:line => 49,
:message => /^Possible\ command\ injection/,
:confidence => 1,
:file => /other_controller\.rb/
end
def test_file_access_concatenation
assert_warning :type => :warning,
:warning_type => "File Access",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册