提交 4fc89dec 编写于 作者: J Justin Collins

Do not process appending to HAML template variable

in the alias processor. Should fix #168
上级 0277eefd
......@@ -74,7 +74,8 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
res
#_hamlout.buffer <<
#This seems to be used rarely, but directly appends args to output buffer
#This seems to be used rarely, but directly appends args to output buffer.
#Has something to do with values of blocks?
elsif sexp? target and method == :<< and is_buffer_target? target
@inside_concat = true
out = exp.arglist[1] = process(exp.arglist[1])
......
......@@ -96,11 +96,17 @@ class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
false
end
#Ignore `<<` calls on template variables which are used by the templating
#library (HAML, ERB, etc.)
def find_push_target exp
if sexp? exp
if exp.node_type == :lvar and (exp.value == :_buf or exp.value == :_erbout)
return nil
elsif exp.node_type == :ivar and exp.value == :@output_buffer
return nil
elsif exp.node_type == :call and exp.target.node_type == :call and
exp.target.method == :_hamlout and exp.method == :buffer
return nil
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册