mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
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 to 93cae5cb2f.
This commit is contained in:
committed by
Jacob Walls
parent
6c82b0bc91
commit
41b43c74bd
@@ -1967,8 +1967,8 @@ class Queries5Tests(TestCase):
|
||||
def test_extra_select_alias_sql_injection(self):
|
||||
crafted_alias = """injected_name" from "queries_note"; --"""
|
||||
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):
|
||||
Note.objects.extra(select={crafted_alias: "1"})
|
||||
|
||||
Reference in New Issue
Block a user