{"title":"Django 4.2.6 release notes","version":"dev","locale":"en","docname":"releases/4.2.6","url":"/en/dev/releases/4.2.6/","canonical":"https://djangodocs.dev/en/dev/releases/4.2.6/","summary":"Django 4.2.6 fixes a security issue with severity “moderate” and several bugs in 4.2.5.","html":"<h1>Django 4.2.6 release notes<a class=\"heading-anchor\" href=\"#django-4-2-6-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>October 4, 2023</em></p>\n<p>Django 4.2.6 fixes a security issue with severity “moderate” and several bugs\nin 4.2.5.</p>\n<section id=\"cve-2023-43665-denial-of-service-possibility-in-django-utils-text-truncator\">\n<h2>CVE-2023-43665: Denial-of-service possibility in <code class=\"docutils literal notranslate\">django.utils.text.Truncator</code><a class=\"heading-anchor\" href=\"#cve-2023-43665-denial-of-service-possibility-in-django-utils-text-truncator\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Following the fix for <span class=\"target\" id=\"index-0\"></span><a class=\"cve reference external\" href=\"https://www.cve.org/CVERecord?id=CVE-2019-14232\"><strong>CVE 2019-14232</strong></a>, the regular expressions used in the\nimplementation of <code class=\"docutils literal notranslate\">django.utils.text.Truncator</code>’s <code class=\"docutils literal notranslate\">chars()</code> and <code class=\"docutils literal notranslate\">words()</code>\nmethods (with <code class=\"docutils literal notranslate\">html=True</code>) were revised and improved. However, these regular\nexpressions still exhibited linear backtracking complexity, so when given a\nvery long, potentially malformed HTML input, the evaluation would still be\nslow, leading to a potential denial of service vulnerability.</p>\n<p>The <code class=\"docutils literal notranslate\">chars()</code> and <code class=\"docutils literal notranslate\">words()</code> methods are used to implement the\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-truncatechars_html\"><code class=\"xref std std-tfilter docutils literal notranslate\">truncatechars_html</code></a> and <a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-truncatewords_html\"><code class=\"xref std std-tfilter docutils literal notranslate\">truncatewords_html</code></a> template\nfilters, which were thus also vulnerable.</p>\n<p>The input processed by <code class=\"docutils literal notranslate\">Truncator</code>, when operating in HTML mode, has been\nlimited to the first five million characters in order to avoid potential\nperformance and memory issues.</p>\n</section>\n<section id=\"bugfixes\">\n<h2>Bugfixes<a class=\"heading-anchor\" href=\"#bugfixes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul>\n<li><p>Fixed a regression in Django 4.2.5 where overriding the deprecated\n<code class=\"docutils literal notranslate\">DEFAULT_FILE_STORAGE</code> and <code class=\"docutils literal notranslate\">STATICFILES_STORAGE</code> settings in tests caused\nthe main <code class=\"docutils literal notranslate\">STORAGES</code> to mutate (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34821\">#34821</a>).</p></li>\n<li><p>Fixed a regression in Django 4.2 that caused unnecessary casting of string\nbased fields (<code class=\"docutils literal notranslate\">CharField</code>, <code class=\"docutils literal notranslate\">EmailField</code>, <code class=\"docutils literal notranslate\">TextField</code>, <code class=\"docutils literal notranslate\">CICharField</code>,\n<code class=\"docutils literal notranslate\">CIEmailField</code>, and <code class=\"docutils literal notranslate\">CITextField</code>) used with the <code class=\"docutils literal notranslate\">__isnull</code> lookup on\nPostgreSQL. As a consequence, indexes using an <code class=\"docutils literal notranslate\">__isnull</code> expression or\ncondition created before Django 4.2 wouldn’t be used by the query planner,\nleading to a performance regression (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/34840\">#34840</a>).</p>\n<p>You may need to recreate such indexes created in your database with Django\n4.2 to 4.2.5, as they contain unnecessary <code class=\"docutils literal notranslate\">::text</code> casting. Find candidate\nindexes with this query:</p>\n<div class=\"code-block\" data-language=\"sql\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">SQL</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"SQL code\"><code><span class=\"k\">SELECT</span> indexname<span class=\"p\">,</span> indexdef\n<span class=\"k\">FROM</span> pg_indexes\n<span class=\"k\">WHERE</span> indexdef <span class=\"k\">LIKE</span> <span class=\"s1\">&#39;%::text IS %NULL&#39;</span><span class=\"p\">;</span>\n</code></pre></div>\n</li>\n</ul>\n</section>","rootId":"django-4-2-6-release-notes","toc":[{"title":"CVE-2023-43665: Denial-of-service possibility in django.utils.text.Truncator","anchor":"cve-2023-43665-denial-of-service-possibility-in-django-utils-text-truncator","children":[]},{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/4.2.7","title":"Django 4.2.7 release notes","url":"/en/dev/releases/4.2.7/"},"next":{"docname":"releases/4.2.5","title":"Django 4.2.5 release notes","url":"/en/dev/releases/4.2.5/"},"formats":{"html":"/en/dev/releases/4.2.6/","markdown":"/en/dev/releases/4.2.6.md","json":"/en/dev/releases/4.2.6.json"},"source":"https://github.com/django/django/blob/main/docs/releases/4.2.6.txt","official":"https://docs.djangoproject.com/en/dev/releases/4.2.6/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2"],"inLocales":["en"]}