Merge pull request #1216 from Shopify/unsupported-taint-mode

Remove support for taint_mode on ruby versions that don't support it
This commit is contained in:
Dylan Thacker-Smith
2020-01-07 10:12:36 -05:00
committed by GitHub
7 changed files with 60 additions and 42 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)