{"title":"Django 1.6.6 release notes","version":"dev","locale":"en","docname":"releases/1.6.6","url":"/en/dev/releases/1.6.6/","canonical":"https://djangodocs.dev/en/dev/releases/1.6.6/","summary":"Django 1.6.6 fixes several security issues and bugs in 1.6.5. In certain situations, URL reversing could generate scheme-relative URLs (URLs starting with…","html":"<h1>Django 1.6.6 release notes<a class=\"heading-anchor\" href=\"#django-1-6-6-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>August 20, 2014</em></p>\n<p>Django 1.6.6 fixes several security issues and bugs in 1.6.5.</p>\n<section id=\"reverse-could-generate-urls-pointing-to-other-hosts\">\n<h2><code class=\"docutils literal notranslate\">reverse()</code> could generate URLs pointing to other hosts<a class=\"heading-anchor\" href=\"#reverse-could-generate-urls-pointing-to-other-hosts\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>In certain situations, URL reversing could generate scheme-relative URLs  (URLs\nstarting with two slashes), which could unexpectedly redirect a user  to a\ndifferent host. An attacker could exploit this, for example, by redirecting\nusers to a phishing site designed to ask for user’s passwords.</p>\n<p>To remedy this, URL reversing now ensures that no URL starts with two slashes\n(//), replacing the second slash with its URL encoded counterpart (%2F). This\napproach ensures that semantics stay the same, while making the URL relative to\nthe domain and not to the scheme.</p>\n</section>\n<section id=\"file-upload-denial-of-service\">\n<h2>File upload denial-of-service<a class=\"heading-anchor\" href=\"#file-upload-denial-of-service\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Before this release, Django’s file upload handing in its default configuration\nmay degrade to producing a huge number of <code class=\"docutils literal notranslate\">os.stat()</code> system calls when a\nduplicate filename is uploaded. Since <code class=\"docutils literal notranslate\">stat()</code> may invoke IO, this may\nproduce a huge data-dependent slowdown that slowly worsens over time. The net\nresult is that given enough time, a user with the ability to upload files can\ncause poor performance in the upload handler, eventually causing it to become\nvery slow simply by uploading 0-byte files. At this point, even a slow network\nconnection and few HTTP requests would be all that is necessary to make a site\nunavailable.</p>\n<p>We’ve remedied the issue by changing the algorithm for generating file names\nif a file with the uploaded name already exists.\n<a class=\"reference internal\" href=\"/en/dev/ref/files/storage/#django.core.files.storage.Storage.get_available_name\" title=\"django.core.files.storage.Storage.get_available_name\"><code class=\"xref py py-meth docutils literal notranslate\">Storage.get_available_name()</code></a> now appends an\nunderscore plus a random 7 character alphanumeric string (e.g. <code class=\"docutils literal notranslate\">&quot;_x3a1gho&quot;</code>),\nrather than iterating through an underscore followed by a number (e.g.\n<code class=\"docutils literal notranslate\">&quot;_1&quot;</code>, <code class=\"docutils literal notranslate\">&quot;_2&quot;</code>, etc.).</p>\n</section>\n<section id=\"remoteusermiddleware-session-hijacking\">\n<h2><code class=\"docutils literal notranslate\">RemoteUserMiddleware</code> session hijacking<a class=\"heading-anchor\" href=\"#remoteusermiddleware-session-hijacking\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>When using the <a class=\"reference internal\" href=\"/en/dev/ref/middleware/#django.contrib.auth.middleware.RemoteUserMiddleware\" title=\"django.contrib.auth.middleware.RemoteUserMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">RemoteUserMiddleware</code></a>\nand the <code class=\"docutils literal notranslate\">RemoteUserBackend</code>, a change to the <code class=\"docutils literal notranslate\">REMOTE_USER</code> header between\nrequests without an intervening logout could result in the prior user’s session\nbeing co-opted by the subsequent user. The middleware now logs the user out on\na failed login attempt.</p>\n</section>\n<section id=\"data-leakage-via-query-string-manipulation-in-contrib-admin\">\n<h2>Data leakage via query string manipulation in <code class=\"docutils literal notranslate\">contrib.admin</code><a class=\"heading-anchor\" href=\"#data-leakage-via-query-string-manipulation-in-contrib-admin\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>In older versions of Django it was possible to reveal any field’s data by\nmodifying the “popup” and “to_field” parameters of the query string on an admin\nchange form page. For example, requesting a URL like\n<code class=\"docutils literal notranslate\">/admin/auth/user/?_popup=1&amp;t=password</code> and viewing the page’s HTML allowed\nviewing the password hash of each user. While the admin requires users to have\npermissions to view the change form pages in the first place, this could leak\ndata if you rely on users having access to view only certain fields on a model.</p>\n<p>To address the issue, an exception will now be raised if a <code class=\"docutils literal notranslate\">to_field</code> value\nthat isn’t a related field to a model that has been registered with the admin\nis specified.</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>Corrected email and URL validation to reject a trailing dash\n(<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/22579\">#22579</a>).</p></li>\n<li><p>Prevented indexes on PostgreSQL virtual fields (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/22514\">#22514</a>).</p></li>\n<li><p>Prevented edge case where values of FK fields could be initialized with a\nwrong value when an inline model formset is created for a relationship\ndefined to point to a field other than the PK (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/13794\">#13794</a>).</p></li>\n<li><p>Restored <code class=\"docutils literal notranslate\">pre_delete</code>  signals for <code class=\"docutils literal notranslate\">GenericRelation</code> cascade deletion\n(<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/22998\">#22998</a>).</p></li>\n<li><p>Fixed transaction handling when specifying non-default database in\n<code class=\"docutils literal notranslate\">createcachetable</code> and <code class=\"docutils literal notranslate\">flush</code> (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/23089\">#23089</a>).</p></li>\n<li><p>Fixed the “ORA-01843: not a valid month” errors when using Unicode\nwith older versions of Oracle server (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/20292\">#20292</a>).</p></li>\n<li><p>Restored bug fix for sending Unicode email with Python 2.6.5 and below\n(<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/19107\">#19107</a>).</p></li>\n<li><p>Prevented <code class=\"docutils literal notranslate\">UnicodeDecodeError</code> in <code class=\"docutils literal notranslate\">runserver</code> with non-UTF-8 and\nnon-English locale (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/23265\">#23265</a>).</p></li>\n<li><p>Fixed JavaScript errors while editing multi-geometry objects in the\nOpenLayers widget (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/23137\">#23137</a>, <a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/23293\">#23293</a>).</p></li>\n<li><p>Prevented a crash on Python 3 with query strings containing unencoded\nnon-ASCII characters (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/22996\">#22996</a>).</p></li>\n</ul>\n</section>","rootId":"django-1-6-6-release-notes","toc":[{"title":"reverse() could generate URLs pointing to other hosts","anchor":"reverse-could-generate-urls-pointing-to-other-hosts","children":[]},{"title":"File upload denial-of-service","anchor":"file-upload-denial-of-service","children":[]},{"title":"RemoteUserMiddleware session hijacking","anchor":"remoteusermiddleware-session-hijacking","children":[]},{"title":"Data leakage via query string manipulation in contrib.admin","anchor":"data-leakage-via-query-string-manipulation-in-contrib-admin","children":[]},{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.6.7","title":"Django 1.6.7 release notes","url":"/en/dev/releases/1.6.7/"},"next":{"docname":"releases/1.6.5","title":"Django 1.6.5 release notes","url":"/en/dev/releases/1.6.5/"},"formats":{"html":"/en/dev/releases/1.6.6/","markdown":"/en/dev/releases/1.6.6.md","json":"/en/dev/releases/1.6.6.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.6.6.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.6.6/","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"]}