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

Constants for unknown model and formbuilder calls

上级 8d24838a
require 'set'
require 'brakeman/processors/alias_processor'
require 'brakeman/processors/lib/render_helper'
require 'brakeman/tracker'
#Processes aliasing in templates.
#Handles calls to +render+.
......@@ -37,6 +38,9 @@ class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
name
end
UNKNOWN_MODEL_CALL = Sexp.new(:call, Sexp.new(:const, Brakeman::Tracker::UNKNOWN_MODEL), :new)
FORM_BUILDER_CALL = Sexp.new(:call, Sexp.new(:const, :FormBuilder), :new)
#Looks for form methods and iterating over collections of Models
def process_call_with_block exp
process_default exp
......@@ -55,14 +59,14 @@ class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
if model == target.target
env[Sexp.new(:lvar, arg)] = Sexp.new(:call, model, :new)
else
env[Sexp.new(:lvar, arg)] = Sexp.new(:call, Sexp.new(:const, Brakeman::Tracker::UNKNOWN_MODEL), :new)
env[Sexp.new(:lvar, arg)] = UNKNOWN_MODEL_CALL
end
process block if sexp? block
end
elsif FORM_METHODS.include? method
if arg.is_a? Symbol
env[Sexp.new(:lvar, arg)] = Sexp.new(:call, Sexp.new(:const, :FormBuilder), :new)
env[Sexp.new(:lvar, arg)] = FORM_BUILDER_CALL
process block if sexp? block
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册