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

Do not include nil in call chains

上级 a3dab552
......@@ -41,7 +41,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
Brakeman.debug "Finding possible SQL calls using constantized()"
calls.concat tracker.find_call(:methods => @sql_targets).select { |result| constantize_call? result }
connect_targets = active_record_models.keys + [nil, :"ActiveRecord::Base"]
connect_targets = active_record_models.keys + [:connection, :"ActiveRecord::Base"]
calls.concat tracker.find_call(:targets => connect_targets, :methods => @connection_calls, :chained => true).select { |result| connect_call? result }
Brakeman.debug "Finding calls to named_scope or scope"
......
......@@ -152,6 +152,8 @@ class Brakeman::FindAllCalls < Brakeman::BasicProcessor
def get_chain call
if node_type? call, :call, :attrasgn
get_chain(call.target) + [call.method]
elsif call.nil?
[]
else
[get_target(call)]
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册