{"title":"Django 3.2.2 release notes","version":"dev","locale":"en","docname":"releases/3.2.2","url":"/en/dev/releases/3.2.2/","canonical":"https://djangodocs.dev/en/dev/releases/3.2.2/","summary":"Django 3.2.2 fixes a security issue and a bug in 3.2.1. On Python 3.9.5+, URLValidator didn’t prohibit newlines and tabs.","html":"<h1>Django 3.2.2 release notes<a class=\"heading-anchor\" href=\"#django-3-2-2-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>May 6, 2021</em></p>\n<p>Django 3.2.2 fixes a security issue and a bug in 3.2.1.</p>\n<section id=\"cve-2021-32052-header-injection-possibility-since-urlvalidator-accepted-newlines-in-input-on-python-3-9-5\">\n<h2>CVE-2021-32052: Header injection possibility since <code class=\"docutils literal notranslate\">URLValidator</code> accepted newlines in input on Python 3.9.5+<a class=\"heading-anchor\" href=\"#cve-2021-32052-header-injection-possibility-since-urlvalidator-accepted-newlines-in-input-on-python-3-9-5\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>On Python 3.9.5+, <a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.URLValidator\" title=\"django.core.validators.URLValidator\"><code class=\"xref py py-class docutils literal notranslate\">URLValidator</code></a> didn’t prohibit\nnewlines and tabs. If you used values with newlines in HTTP response, you could\nsuffer from header injection attacks. Django itself wasn’t vulnerable because\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a> prohibits newlines in HTTP headers.</p>\n<p>Moreover, the <code class=\"docutils literal notranslate\">URLField</code> form field which uses <code class=\"docutils literal notranslate\">URLValidator</code> silently\nremoves newlines and tabs on Python 3.9.5+, so the possibility of newlines\nentering your data only existed if you are using this validator outside of the\nform fields.</p>\n<p>This issue was introduced by the <a class=\"extlink-bpo reference external\" href=\"https://bugs.python.org/issue?&#64;action=redirect&amp;bpo=43882\">bpo-43882</a> fix.</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>Prevented, following a regression in Django 3.2.1, <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-makemigrations\"><code class=\"xref std std-djadmin docutils literal notranslate\">makemigrations</code></a>\nfrom generating infinite migrations for a model with <code class=\"docutils literal notranslate\">Meta.ordering</code>\ncontained <code class=\"docutils literal notranslate\">OrderBy</code> expressions (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/32714\">#32714</a>).</p></li>\n</ul>\n</section>","rootId":"django-3-2-2-release-notes","toc":[{"title":"CVE-2021-32052: Header injection possibility since URLValidator accepted newlines in input on Python 3.9.5+","anchor":"cve-2021-32052-header-injection-possibility-since-urlvalidator-accepted-newlines-in-input-on-python-3-9-5","children":[]},{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/3.2.3","title":"Django 3.2.3 release notes","url":"/en/dev/releases/3.2.3/"},"next":{"docname":"releases/3.2.1","title":"Django 3.2.1 release notes","url":"/en/dev/releases/3.2.1/"},"formats":{"html":"/en/dev/releases/3.2.2/","markdown":"/en/dev/releases/3.2.2.md","json":"/en/dev/releases/3.2.2.json"},"source":"https://github.com/django/django/blob/main/docs/releases/3.2.2.txt","official":"https://docs.djangoproject.com/en/dev/releases/3.2.2/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2"],"inLocales":["en"]}