mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
[6.0.x] Fixed CVE-2025-59681 -- Protected QuerySet.annotate(), alias(), aggregate(), and extra() against SQL injection in column aliases on MySQL/MariaDB.
Thanks sw0rd1ight for the report. Follow up to93cae5cb2f. Backport of41b43c74bdfrom main.
This commit is contained in:
committed by
Jacob Walls
parent
ee0610673b
commit
4ceaaee7e0
@@ -2244,8 +2244,8 @@ class AggregateTestCase(TestCase):
|
||||
def test_alias_sql_injection(self):
|
||||
crafted_alias = """injected_name" from "aggregation_author"; --"""
|
||||
msg = (
|
||||
"Column aliases cannot contain whitespace characters, quotation marks, "
|
||||
"semicolons, or SQL comments."
|
||||
"Column aliases cannot contain whitespace characters, hashes, quotation "
|
||||
"marks, semicolons, or SQL comments."
|
||||
)
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
Author.objects.aggregate(**{crafted_alias: Avg("age")})
|
||||
|
||||
Reference in New Issue
Block a user