mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +00:00
Fixed CVE-2020-7471 -- Properly escaped StringAgg(delimiter) parameter.
This commit is contained in:
parent
6b178a3e93
commit
eb31d84532
7 changed files with 45 additions and 5 deletions
|
|
@ -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'})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue