mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 18:30:40 -07:00
Convert Strainer to white-list method protection
After moving the method existence check from Context into Strainer, updated Strainer to only accept invokation methods that were added via filter Modules, and done in a way that respond_to? is never called, preventing unconstrained Symbol table growth.
This commit is contained in:
@@ -189,10 +189,10 @@ class ContextTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
context = Context.new
|
||||
methods_before = context.strainer.methods.map { |method| method.to_s }
|
||||
assert_equal "Wookie", context.invoke("hi", "Wookie")
|
||||
|
||||
context.add_filters(filter)
|
||||
methods_after = context.strainer.methods.map { |method| method.to_s }
|
||||
assert_equal (methods_before + ["hi"]).sort, methods_after.sort
|
||||
assert_equal "Wookie hi!", context.invoke("hi", "Wookie")
|
||||
end
|
||||
|
||||
def test_add_item_in_outer_scope
|
||||
|
||||
Reference in New Issue
Block a user