mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-17 01:40:42 -07:00
Check and handle when a tainted variable is used
This commit is contained in:
@@ -94,6 +94,16 @@ module Liquid
|
||||
end
|
||||
filterargs << keyword_args unless keyword_args.empty?
|
||||
output = context.invoke(filter[0], output, *filterargs)
|
||||
end.tap do |obj|
|
||||
if obj.tainted?
|
||||
case Template.taint_mode
|
||||
when :warn
|
||||
@warnings ||= []
|
||||
@warnings << "variable '#{@name}' is tainted and was not escaped"
|
||||
when :error
|
||||
raise TaintedError, "Error - variable '#{@name}' is tainted and was not escaped"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user