{"title":"Django 5.1.4 release notes","version":"dev","locale":"en","docname":"releases/5.1.4","url":"/en/dev/releases/5.1.4/","canonical":"https://djangodocs.dev/en/dev/releases/5.1.4/","summary":"Django 5.1.4 fixes one security issue with severity “high”, one security issue with severity “moderate”, and several bugs in 5.1.3.","html":"<h1>Django 5.1.4 release notes<a class=\"heading-anchor\" href=\"#django-5-1-4-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>December 4, 2024</em></p>\n<p>Django 5.1.4 fixes one security issue with severity “high”, one security issue\nwith severity “moderate”, and several bugs in 5.1.3.</p>\n<section id=\"cve-2024-53907-denial-of-service-possibility-in-strip-tags\">\n<h2>CVE-2024-53907: Denial-of-service possibility in <code class=\"docutils literal notranslate\">strip_tags()</code><a class=\"heading-anchor\" href=\"#cve-2024-53907-denial-of-service-possibility-in-strip-tags\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.html.strip_tags\" title=\"django.utils.html.strip_tags\"><code class=\"xref py py-func docutils literal notranslate\">strip_tags()</code></a> would be extremely slow to evaluate\ncertain inputs containing large sequences of nested incomplete HTML entities.\nThe <code class=\"docutils literal notranslate\">strip_tags()</code> method is used to implement the corresponding\n<a class=\"reference internal\" href=\"/en/dev/ref/templates/builtins/#std-templatefilter-striptags\"><code class=\"xref std std-tfilter docutils literal notranslate\">striptags</code></a> template filter, which was thus also vulnerable.</p>\n<p><code class=\"docutils literal notranslate\">strip_tags()</code> now has an upper limit of recursive calls to <code class=\"docutils literal notranslate\">HTMLParser</code>\nbefore raising a <a class=\"reference internal\" href=\"/en/dev/ref/exceptions/#django.core.exceptions.SuspiciousOperation\" title=\"django.core.exceptions.SuspiciousOperation\"><code class=\"xref py py-exc docutils literal notranslate\">SuspiciousOperation</code></a> exception.</p>\n<p>Remember that absolutely NO guarantee is provided about the results of\n<code class=\"docutils literal notranslate\">strip_tags()</code> being HTML safe. So NEVER mark safe the result of a\n<code class=\"docutils literal notranslate\">strip_tags()</code> call without escaping it first, for example with\n<a class=\"reference internal\" href=\"/en/dev/ref/utils/#django.utils.html.escape\" title=\"django.utils.html.escape\"><code class=\"xref py py-func docutils literal notranslate\">django.utils.html.escape()</code></a>.</p>\n</section>\n<section id=\"cve-2024-53908-potential-sql-injection-via-haskey-lhs-rhs-on-oracle\">\n<h2>CVE-2024-53908: Potential SQL injection via <code class=\"docutils literal notranslate\">HasKey(lhs, rhs)</code> on Oracle<a class=\"heading-anchor\" href=\"#cve-2024-53908-potential-sql-injection-via-haskey-lhs-rhs-on-oracle\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Direct usage of the <code class=\"docutils literal notranslate\">django.db.models.fields.json.HasKey</code> lookup on Oracle\nwas subject to SQL injection if untrusted data was used as a <code class=\"docutils literal notranslate\">lhs</code> value.</p>\n<p>Applications that use the <a class=\"reference internal\" href=\"/en/dev/topics/db/queries/#std-fieldlookup-jsonfield.has_key\"><code class=\"xref std std-lookup docutils literal notranslate\">has_key</code></a> lookup through\nthe <code class=\"docutils literal notranslate\">__</code> syntax are unaffected.</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 class=\"simple\">\n<li><p>Fixed a crash in <code class=\"docutils literal notranslate\">createsuperuser</code> on Python 3.13+ caused by an unhandled\n<code class=\"docutils literal notranslate\">OSError</code> when the username could not be determined (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35942\">#35942</a>).</p></li>\n<li><p>Fixed a regression in Django 5.1 where relational fields were not updated\nwhen calling <code class=\"docutils literal notranslate\">Model.refresh_from_db()</code> on instances with deferred fields\n(<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/35950\">#35950</a>).</p></li>\n</ul>\n</section>","rootId":"django-5-1-4-release-notes","toc":[{"title":"CVE-2024-53907: Denial-of-service possibility in strip_tags()","anchor":"cve-2024-53907-denial-of-service-possibility-in-strip-tags","children":[]},{"title":"CVE-2024-53908: Potential SQL injection via HasKey(lhs, rhs) on Oracle","anchor":"cve-2024-53908-potential-sql-injection-via-haskey-lhs-rhs-on-oracle","children":[]},{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/5.1.5","title":"Django 5.1.5 release notes","url":"/en/dev/releases/5.1.5/"},"next":{"docname":"releases/5.1.3","title":"Django 5.1.3 release notes","url":"/en/dev/releases/5.1.3/"},"formats":{"html":"/en/dev/releases/5.1.4/","markdown":"/en/dev/releases/5.1.4.md","json":"/en/dev/releases/5.1.4.json"},"source":"https://github.com/django/django/blob/main/docs/releases/5.1.4.txt","official":"https://docs.djangoproject.com/en/dev/releases/5.1.4/","inVersions":["dev","6.1","6.0","5.2","5.1"],"inLocales":["en"]}