security: Prevent arbitrary method invocation on conditions in if tag.

This commit is contained in:
Dylan Thacker-Smith
2013-10-28 11:19:25 -04:00
parent 71a386f723
commit cc982e92d0
3 changed files with 11 additions and 2 deletions

View File

@@ -157,4 +157,10 @@ class IfElseTagTest < Test::Unit::TestCase
assert_template_result('yes',
%({% if 'gnomeslab-and-or-liquid' contains 'gnomeslab-and-or-liquid' %}yes{% endif %}))
end
def test_operators_are_whitelisted
assert_raise(SyntaxError) do
assert_template_result('', %({% if 1 or throw or or 1 %}yes{% endif %}))
end
end
end # IfElseTest