提交 3764a992 编写于 作者: J Justin Collins

Ignore table_name() in SQL

上级 427736e8
......@@ -95,7 +95,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
when :array
return check_arguments(arg[1])
when :string_interp
return true
return true if check_string_interp arg
when :call
return check_call(arg)
else
......@@ -108,6 +108,18 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
false
end
def check_string_interp arg
arg.each do |exp|
#For now, don't warn on interpolation of Model.table_name
#but check for other 'safe' things in the future
if sexp? exp and exp.node_type == :string_eval
if call? exp[1] and (model_name?(exp[1][1]) or exp[1][1].nil?) and exp[1][2] == :table_name
return false
end
end
end
end
#Check call for user input and string building
def check_call exp
target = exp[1]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册