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

CheckSQL: Add test for merge_conditions

which does not appear to be in Rails 3
上级 dac47f51
......@@ -14,4 +14,11 @@ class User < ActiveRecord::Base
def get_something x
self.find(:all, :conditions => "where blah = #{x}")
end
def test_merge_conditions
#Should not warn
User.find(:all, :conditions => merge_conditions(some_conditions))
User.find(:all, :conditions => self.merge_conditions(some_conditions))
find(:all, :conditions => User.merge_conditions(some_conditions))
end
end
......@@ -474,6 +474,15 @@ class Rails2Tests < Test::Unit::TestCase
:file => /home_controller\.rb/
end
def test_sql_injection_merge_conditions
assert_no_warning :type => :warning,
:warning_type => "SQL Injection",
:line => 22,
:message => /^Possible SQL injection near line 22: find/,
:confidence => 0,
:file => /user\.rb/
end
def test_escape_once
results = find :type => :template,
:warning_type => "Cross Site Scripting",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册