Remove support for taint_mode on ruby versions that don't support it

This commit is contained in:
Dylan Thacker-Smith
2019-12-19 11:12:51 -05:00
parent 6c6382ed69
commit 40c68c9c83
6 changed files with 60 additions and 37 deletions
+8 -1
View File
@@ -69,7 +69,14 @@ module Liquid
# :lax is the default, and ignores the taint flag completely
# :warn adds a warning, but does not interrupt the rendering
# :error raises an error when tainted output is used
attr_writer :taint_mode
# @deprecated Since it is being deprecated in ruby itself.
def taint_mode=(mode)
taint_supported = Object.new.taint.tainted?
if mode != :lax && !taint_supported
raise NotImplementedError, "#{RUBY_ENGINE} #{RUBY_VERSION} doesn't support taint checking"
end
@taint_mode = mode
end
attr_accessor :default_exception_renderer
Template.default_exception_renderer = lambda do |exception|
+1 -1
View File
@@ -143,8 +143,8 @@ module Liquid
end
def taint_check(context, obj)
return unless obj.tainted?
return if Template.taint_mode == :lax
return unless obj.tainted?
@markup =~ QuotedFragment
name = Regexp.last_match(0)