1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed CVE-2022-41323 -- Prevented locales being interpreted as regular expressions.

Thanks to Benjamin Balder Bach for the report.
This commit is contained in:
Adam Johnson
2022-09-02 09:44:05 +01:00
committed by Carlton Gibson
parent 4771a1694b
commit e5ea284294
5 changed files with 23 additions and 3 deletions

View File

@@ -346,7 +346,7 @@ class LocalePrefixPattern:
@property
def regex(self):
# This is only used by reverse() and cached in _reverse_dict.
return re.compile(self.language_prefix)
return re.compile(re.escape(self.language_prefix))
@property
def language_prefix(self):