mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed CVE-2020-7471 -- Properly escaped StringAgg(delimiter) parameter.
This commit is contained in:
committed by
Carlton Gibson
parent
6b178a3e93
commit
eb31d84532
@@ -169,6 +169,10 @@ class TestGeneralAggregate(PostgreSQLTestCase):
|
||||
with self.assertRaises(TypeError):
|
||||
AggregateTestModel.objects.aggregate(stringagg=StringAgg('char_field'))
|
||||
|
||||
def test_string_agg_delimiter_escaping(self):
|
||||
values = AggregateTestModel.objects.aggregate(stringagg=StringAgg('char_field', delimiter="'"))
|
||||
self.assertEqual(values, {'stringagg': "Foo1'Foo2'Foo4'Foo3"})
|
||||
|
||||
def test_string_agg_charfield(self):
|
||||
values = AggregateTestModel.objects.aggregate(stringagg=StringAgg('char_field', delimiter=';'))
|
||||
self.assertEqual(values, {'stringagg': 'Foo1;Foo2;Foo4;Foo3'})
|
||||
|
||||
Reference in New Issue
Block a user