Compare commits

...

9 Commits

Author SHA1 Message Date
Justin Li
27507d087e Bump version to 2.6.3 2015-07-23 17:00:30 -04:00
Justin Li
0d0ece6ece Update history for 2.6.3 2015-07-23 16:59:44 -04:00
Dylan Thacker-Smith
435babc051 Fix a timezone test failure. 2015-07-23 16:51:20 -04:00
Arthur Neves
4f33cd1eae Bump to version 2.6.2 2015-01-23 10:18:03 -05:00
Florian Weingarten
1854cd17ab Bump version to 2.6.1 2015-01-23 10:17:18 -05:00
Arthur Nogueira Neves
69c2575485 Merge pull request #503 from parkr/patch-1
Remove duplicate `index0` key in htmltags
2014-12-30 13:15:04 -05:00
Parker Moore
0e98b29665 Remove duplicate index0 key in htmltags
Half of #502.
2014-12-26 16:33:47 -05:00
Florian Weingarten
deeb813d53 Merge pull request #300 from Shopify/cherry_pick_security_fix_to_2-6-stable
Cherry pick security fix to 2-6-stable
2014-01-10 10:20:41 -08:00
Florian Weingarten
eb409ff237 Cherry pick security fix (#274) to 2-6-stable 2014-01-10 11:22:28 -05:00
6 changed files with 39 additions and 8 deletions

View File

@@ -3,7 +3,21 @@
IMPORTANT: Liquid 2.6 is going to be the last version of Liquid which maintains explicit Ruby 1.8 compatability.
The following releases will only be tested against Ruby 1.9 and Ruby 2.0 and are likely to break on Ruby 1.8.
## 2.6.0 / 2013-11-25 / branch "2.6-stable"
## 2.6.3 / 2015-07-23 / branch "2-6-stable"
* Fix test failure under certain timezones [Dylan Thacker-Smith]
## 2.6.2 / 2015-01-23
* Remove duplicate hash key [Parker Moore]
## 2.6.1 / 2014-01-10
Security fix, cherry-picked from master (4e14a65):
* Don't call to_sym when creating conditions for security reasons, see #273 [Bouke van der Bijl, bouk]
* Prevent arbitrary method invocation on condition objects, see #274 [Dylan Thacker-Smith, dylanahsmith]
## 2.6.0 / 2013-11-25
* ...
* Bugfix for #106: fix example servlet [gnowoel]

View File

@@ -43,7 +43,6 @@ module Liquid
'index0' => index,
'col' => col + 1,
'col0' => col,
'index0' => index,
'rindex' => length - index,
'rindex0' => length - index - 1,
'first' => (index == 0),

View File

@@ -15,6 +15,7 @@ module Liquid
SyntaxHelp = "Syntax Error in tag 'if' - Valid syntax: if [expression]"
Syntax = /(#{QuotedFragment})\s*([=!<>a-z_]+)?\s*(#{QuotedFragment})?/o
ExpressionsAndOperators = /(?:\b(?:\s?and\s?|\s?or\s?)\b|(?:\s*(?!\b(?:\s?and\s?|\s?or\s?)\b)(?:#{QuotedFragment}|\S+)\s*)+)/o
BOOLEAN_OPERATORS = %w(and or)
def initialize(tag_name, markup, tokens)
@blocks = []
@@ -61,7 +62,8 @@ module Liquid
raise(SyntaxError, SyntaxHelp) unless expressions.shift.to_s =~ Syntax
new_condition = Condition.new($1, $2, $3)
new_condition.send(operator.to_sym, condition)
raise SyntaxError, "invalid boolean operator" unless BOOLEAN_OPERATORS.include?(operator)
new_condition.send(operator, condition)
condition = new_condition
end
@@ -71,8 +73,6 @@ module Liquid
@blocks.push(block)
@nodelist = block.attach(Array.new)
end
end
Template.register_tag('if', If)

View File

@@ -1,4 +1,4 @@
# encoding: utf-8
module Liquid
VERSION = "2.6.0"
VERSION = "2.6.3"
end

View File

@@ -157,8 +157,10 @@ class StandardFiltersTest < Test::Unit::TestCase
assert_equal nil, @filters.date(nil, "%B")
assert_equal "07/05/2006", @filters.date(1152098955, "%m/%d/%Y")
assert_equal "07/05/2006", @filters.date("1152098955", "%m/%d/%Y")
with_timezone("UTC") do
assert_equal "07/05/2006", @filters.date(1152098955, "%m/%d/%Y")
assert_equal "07/05/2006", @filters.date("1152098955", "%m/%d/%Y")
end
end
@@ -248,4 +250,14 @@ class StandardFiltersTest < Test::Unit::TestCase
def test_cannot_access_private_methods
assert_template_result('a',"{{ 'a' | to_number }}")
end
private
def with_timezone(tz)
old_tz = ENV['TZ']
ENV['TZ'] = tz
yield
ensure
ENV['TZ'] = old_tz
end
end # StandardFiltersTest

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