lib/brakeman/processors/template_alias_processor.rb in brakeman-3.0.1 vs lib/brakeman/processors/template_alias_processor.rb in brakeman-3.0.2
- old
+ new
@@ -1,8 +1,9 @@
require 'set'
require 'brakeman/processors/alias_processor'
require 'brakeman/processors/lib/render_helper'
+require 'brakeman/processors/lib/render_path'
require 'brakeman/tracker'
#Processes aliasing in templates.
#Handles calls to +render+.
class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
@@ -17,17 +18,17 @@
end
#Process template
def process_template name, args
if @called_from
- unless @called_from.grep(/Template:#{name}$/).empty?
+ if @called_from.include_template? name
Brakeman.debug "Skipping circular render from #{@template[:name]} to #{name}"
return
end
- super name, args, @called_from + ["Template:#{@template[:name]}"]
+ super name, args, @called_from.dup.add_template_render(@template[:name])
else
- super name, args, ["Template:#{@template[:name]}"]
+ super name, args, Brakeman::RenderPath.new.add_template_render(@template[:name])
end
end
#Determine template name
def template_name name