{"title":"Django 1.4.2 release notes","version":"dev","locale":"en","docname":"releases/1.4.2","url":"/en/dev/releases/1.4.2/","canonical":"https://djangodocs.dev/en/dev/releases/1.4.2/","summary":"This is the second security release in the Django 1.4 series. Some parts of Django – independent of end-user-written applications – make use of full URLs…","html":"<h1>Django 1.4.2 release notes<a class=\"heading-anchor\" href=\"#django-1-4-2-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>October 17, 2012</em></p>\n<p>This is the second security release in the Django 1.4 series.</p>\n<section id=\"host-header-poisoning\">\n<h2>Host header poisoning<a class=\"heading-anchor\" href=\"#host-header-poisoning\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Some parts of Django – independent of end-user-written applications – make\nuse of full URLs, including domain name, which are generated from the HTTP Host\nheader. Some attacks against this are beyond Django’s ability to control, and\nrequire the web server to be properly configured; Django’s documentation has\nfor some time contained notes advising users on such configuration.</p>\n<p>Django’s own built-in parsing of the Host header is, however, still vulnerable,\nas was reported to us recently. The Host header parsing in Django 1.3.3 and\nDjango 1.4.1 – specifically, <code class=\"docutils literal notranslate\">django.http.HttpRequest.get_host()</code> – was\nincorrectly handling username/password information in the header. Thus, for\nexample, the following Host header would be accepted by Django when running on\n<code class=\"docutils literal notranslate\">validsite.com</code>:</p>\n<div class=\"code-block\" data-language=\"text\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</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=\"Text code\"><code>Host: validsite.com:random@evilsite.com\n</code></pre></div>\n<p>Using this, an attacker can cause parts of Django – particularly the\npassword-reset mechanism – to generate and display arbitrary URLs to users.</p>\n<p>To remedy this, the parsing in <code class=\"docutils literal notranslate\">HttpRequest.get_host()</code> is being modified;\nHost headers which contain potentially dangerous content (such as\nusername/password pairs) now raise the exception\n<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\">django.core.exceptions.SuspiciousOperation</code></a>.</p>\n<p>Details of this issue were initially posted online as a <a class=\"reference external\" href=\"https://www.djangoproject.com/weblog/2012/oct/17/security/\">security advisory</a>.</p>\n</section>\n<section id=\"backwards-incompatible-changes\">\n<h2>Backwards incompatible changes<a class=\"heading-anchor\" href=\"#backwards-incompatible-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul class=\"simple\">\n<li><p>The newly introduced <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.GenericIPAddressField\" title=\"django.db.models.GenericIPAddressField\"><code class=\"xref py py-class docutils literal notranslate\">GenericIPAddressField</code></a>\nconstructor arguments have been adapted to match those of all other model\nfields. The first two keyword arguments are now verbose_name and name.</p></li>\n</ul>\n</section>\n<section id=\"other-bugfixes-and-changes\">\n<h2>Other bugfixes and changes<a class=\"heading-anchor\" href=\"#other-bugfixes-and-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul class=\"simple\">\n<li><p>Subclass HTMLParser only for appropriate Python versions (#18239).</p></li>\n<li><p>Added batch_size argument to qs.bulk_create() (#17788).</p></li>\n<li><p>Fixed a small regression in the admin filters where wrongly formatted dates\npassed as url parameters caused an unhandled ValidationError (#18530).</p></li>\n<li><p>Fixed an endless loop bug when accessing permissions in templates (#18979)</p></li>\n<li><p>Fixed some Python 2.5 compatibility issues</p></li>\n<li><p>Fixed an issue with quoted filenames in Content-Disposition header (#19006)</p></li>\n<li><p>Made the context option in <code class=\"docutils literal notranslate\">trans</code> and <code class=\"docutils literal notranslate\">blocktrans</code> tags accept literals\nwrapped in single quotes (#18881).</p></li>\n<li><p>Numerous documentation improvements and fixes.</p></li>\n</ul>\n</section>","rootId":"django-1-4-2-release-notes","toc":[{"title":"Host header poisoning","anchor":"host-header-poisoning","children":[]},{"title":"Backwards incompatible changes","anchor":"backwards-incompatible-changes","children":[]},{"title":"Other bugfixes and changes","anchor":"other-bugfixes-and-changes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.4.3","title":"Django 1.4.3 release notes","url":"/en/dev/releases/1.4.3/"},"next":{"docname":"releases/1.4.1","title":"Django 1.4.1 release notes","url":"/en/dev/releases/1.4.1/"},"formats":{"html":"/en/dev/releases/1.4.2/","markdown":"/en/dev/releases/1.4.2.md","json":"/en/dev/releases/1.4.2.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.4.2.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.4.2/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9","1.8"],"inLocales":["en"]}