提交 25e05d22 编写于 作者: O oreoshake 提交者: Dave Worth

Mass assignments were being clobbered, make api use consistent

上级 c6136f10
......@@ -21,7 +21,6 @@ class Brakeman::CheckMassAssignment < Brakeman::BaseCheck
return if models.empty?
@results = Set.new
Brakeman.debug "Finding possible mass assignment calls on #{models.length} models"
calls = tracker.find_call :chained => true, :targets => models, :methods => [:new,
......@@ -45,7 +44,7 @@ class Brakeman::CheckMassAssignment < Brakeman::BaseCheck
check = check_call call
if check and not @results.include? call
if check and not duplicate? res
@results << call
model = tracker.models[res[:chain].first]
......
......@@ -23,8 +23,6 @@ class Brakeman::CheckWithoutProtection < Brakeman::BaseCheck
return if models.empty?
@results = Set.new
Brakeman.debug "Finding all mass assignments"
calls = tracker.find_call :targets => models, :methods => [:new,
:attributes=,
......@@ -45,7 +43,7 @@ class Brakeman::CheckWithoutProtection < Brakeman::BaseCheck
call = res[:call]
last_arg = call[3][-1]
if hash? last_arg and not @results.include? call
if hash? last_arg and not duplicate? res
hash_iterate(last_arg) do |k,v|
if symbol? k and k[1] == :without_protection and v[0] == :true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册