提交 1c63c28d 编写于 作者: J Justin Collins

Add test for interpolation in first argument

上级 65445789
......@@ -169,4 +169,8 @@ class Product < ActiveRecord::Base
#Should not warn
Product.last("blah = '#{params[:id].to_f}'")
end
def test_interpolation_in_first_arg
Product.where("x = #{params[:x]} AND y = ?", y)
end
end
......@@ -15,7 +15,7 @@ class Rails31Tests < Test::Unit::TestCase
:model => 0,
:template => 4,
:controller => 1,
:warning => 44 }
:warning => 45 }
end
def test_without_protection
......@@ -411,6 +411,15 @@ class Rails31Tests < Test::Unit::TestCase
:file => /product\.rb/
end
def test_sql_injection_interpolation_in_first_arg
assert_warning :type => :warning,
:warning_type => "SQL Injection",
:line => 174,
:message => /^Possible\ SQL\ injection/,
:confidence => 0,
:file => /product\.rb/
end
def test_select_vulnerability
assert_warning :type => :template,
:warning_type => "Cross Site Scripting",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册