提交 21b00ce2 编写于 作者: J Justin Collins

Support chained model calls in RedirectCheck

上级 6f11f825
......@@ -142,7 +142,7 @@ class Brakeman::CheckRedirect < Brakeman::BaseCheck
if node_type? exp, :or
model_instance? exp.lhs or model_instance? exp.rhs
elsif call? exp
if model_name? exp.target or friendly_model? exp.target and
if model_target? exp and
(@model_find_calls.include? exp.method or exp.method.to_s.match(/^find_by_/))
true
else
......@@ -151,6 +151,13 @@ class Brakeman::CheckRedirect < Brakeman::BaseCheck
end
end
def model_target? exp
return false unless call? exp
model_name? exp.target or
friendly_model? exp.target or
model_target? exp.target
end
#Returns true if exp is (probably) a friendly model instance
#using the FriendlyId gem
def friendly_model? exp
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册