| 1 |
========================== |
| 2 |
Django 4.2.6 release notes |
| 3 |
========================== |
| 4 |
|
| 5 |
*October 4, 2023* |
| 6 |
|
| 7 |
Django 4.2.6 fixes a security issue with severity "moderate" and several bugs |
| 8 |
in 4.2.5. |
| 9 |
|
| 10 |
CVE-2023-43665: Denial-of-service possibility in ``django.utils.text.Truncator`` |
| 11 |
================================================================================ |
| 12 |
|
| 13 |
Following the fix for :cve:`2019-14232`, the regular expressions used in the |
| 14 |
implementation of ``django.utils.text.Truncator``'s ``chars()`` and ``words()`` |
| 15 |
methods (with ``html=True``) were revised and improved. However, these regular |
| 16 |
expressions still exhibited linear backtracking complexity, so when given a |
| 17 |
very long, potentially malformed HTML input, the evaluation would still be |
| 18 |
slow, leading to a potential denial of service vulnerability. |
| 19 |
|
| 20 |
The ``chars()`` and ``words()`` methods are used to implement the |
| 21 |
:tfilter:`truncatechars_html` and :tfilter:`truncatewords_html` template |
| 22 |
filters, which were thus also vulnerable. |
| 23 |
|
| 24 |
The input processed by ``Truncator``, when operating in HTML mode, has been |
| 25 |
limited to the first five million characters in order to avoid potential |
| 26 |
performance and memory issues. |
| 27 |
|
| 28 |
Bugfixes |
| 29 |
======== |
| 30 |
|
| 31 |
* Fixed a regression in Django 4.2.5 where overriding the deprecated |
| 32 |
``DEFAULT_FILE_STORAGE`` and ``STATICFILES_STORAGE`` settings in tests caused |
| 33 |
the main ``STORAGES`` to mutate (:ticket:`34821`). |
| 34 |
|
| 35 |
* Fixed a regression in Django 4.2 that caused unnecessary casting of string |
| 36 |
based fields (``CharField``, ``EmailField``, ``TextField``, ``CICharField``, |
| 37 |
``CIEmailField``, and ``CITextField``) used with the ``__isnull`` lookup on |
| 38 |
PostgreSQL. As a consequence, indexes using an ``__isnull`` expression or |
| 39 |
condition created before Django 4.2 wouldn't be used by the query planner, |
| 40 |
leading to a performance regression (:ticket:`34840`). |
| 41 |
|
| 42 |
You may need to recreate such indexes created in your database with Django |
| 43 |
4.2 to 4.2.5, as they contain unnecessary ``::text`` casting. Find candidate |
| 44 |
indexes with this query: |
| 45 |
|
| 46 |
.. code-block:: sql |
| 47 |
|
| 48 |
SELECT indexname, indexdef |
| 49 |
FROM pg_indexes |
| 50 |
WHERE indexdef LIKE '%::text IS %NULL'; |