{"title":"Django 1.5.2 release notes","version":"dev","locale":"en","docname":"releases/1.5.2","url":"/en/dev/releases/1.5.2/","canonical":"https://djangodocs.dev/en/dev/releases/1.5.2/","summary":"This is Django 1.5.2, a bugfix and security release for Django 1.5. Django relies on user input in some cases (e.g. django.contrib.auth.views.login()…","html":"<h1>Django 1.5.2 release notes<a class=\"heading-anchor\" href=\"#django-1-5-2-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>August 13, 2013</em></p>\n<p>This is Django 1.5.2, a bugfix and security release for Django 1.5.</p>\n<section id=\"mitigated-possible-xss-attack-via-user-supplied-redirect-urls\">\n<h2>Mitigated possible XSS attack via user-supplied redirect URLs<a class=\"heading-anchor\" href=\"#mitigated-possible-xss-attack-via-user-supplied-redirect-urls\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django relies on user input in some cases (e.g.\n<code class=\"docutils literal notranslate\">django.contrib.auth.views.login()</code>, <code class=\"docutils literal notranslate\">django.contrib.comments</code>, and\n<a class=\"reference internal\" href=\"/en/dev/topics/i18n/\"><span class=\"doc\">i18n</span></a>) to redirect the user to an “on success” URL.\nThe security checks for these redirects (namely\n<code class=\"docutils literal notranslate\">django.utils.http.is_safe_url()</code>) didn’t check if the scheme is <code class=\"docutils literal notranslate\">http(s)</code>\nand as such allowed <code class=\"docutils literal notranslate\">javascript:...</code> URLs to be entered. If a developer\nrelied on <code class=\"docutils literal notranslate\">is_safe_url()</code> to provide safe redirect targets and put such a\nURL into a link, they could suffer from a XSS attack. This bug doesn’t affect\nDjango currently, since we only put this URL into the <code class=\"docutils literal notranslate\">Location</code> response\nheader and browsers seem to ignore JavaScript there.</p>\n</section>\n<section id=\"xss-vulnerability-in-django-contrib-admin\">\n<h2>XSS vulnerability in <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/#module-django.contrib.admin\" title=\"django.contrib.admin: Django's admin site.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.admin</code></a><a class=\"heading-anchor\" href=\"#xss-vulnerability-in-django-contrib-admin\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>If a <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.URLField\" title=\"django.db.models.URLField\"><code class=\"xref py py-class docutils literal notranslate\">URLField</code></a> is used in Django 1.5, it displays the\ncurrent value of the field and a link to the target on the admin change page.\nThe display routine of this widget was flawed and allowed for XSS.</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 with <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.prefetch_related\" title=\"django.db.models.query.QuerySet.prefetch_related\"><code class=\"xref py py-meth docutils literal notranslate\">prefetch_related()</code></a>\n(#19607) as well as some <code class=\"docutils literal notranslate\">pickle</code> regressions with <code class=\"docutils literal notranslate\">prefetch_related</code>\n(#20157 and #20257).</p></li>\n<li><p>Fixed a regression in <a class=\"reference internal\" href=\"/en/dev/ref/contrib/gis/#module-django.contrib.gis\" title=\"django.contrib.gis: Geographic Information System (GIS) extensions for Django\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.gis</code></a> in the Google Map output on\nPython 3 (#20773).</p></li>\n<li><p>Made <code class=\"docutils literal notranslate\">DjangoTestSuiteRunner.setup_databases</code> properly handle aliases for\nthe default database (#19940) and prevented <code class=\"docutils literal notranslate\">teardown_databases</code> from\nattempting to tear down aliases (#20681).</p></li>\n<li><p>Fixed the <code class=\"docutils literal notranslate\">django.core.cache.backends.memcached.MemcachedCache</code> backend’s\n<code class=\"docutils literal notranslate\">get_many()</code> method on Python 3 (#20722).</p></li>\n<li><p>Fixed <a class=\"reference internal\" href=\"/en/dev/ref/contrib/humanize/#module-django.contrib.humanize\" title=\"django.contrib.humanize: A set of Django template filters useful for adding a &quot;human touch&quot; to data.\"><code class=\"xref py py-mod docutils literal notranslate\">django.contrib.humanize</code></a> translation syntax errors. Affected\nlanguages: Mexican Spanish, Mongolian, Romanian, Turkish (#20695).</p></li>\n<li><p>Added support for wheel packages (#19252).</p></li>\n<li><p>The CSRF token now rotates when a user logs in.</p></li>\n<li><p>Some Python 3 compatibility fixes including #20212 and #20025.</p></li>\n<li><p>Fixed some rare cases where <a class=\"reference internal\" href=\"/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.get\" title=\"django.db.models.query.QuerySet.get\"><code class=\"xref py py-meth docutils literal notranslate\">get()</code></a>\nexceptions recursed infinitely (#20278).</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/django-admin/#django-admin-makemessages\"><code class=\"xref std std-djadmin docutils literal notranslate\">makemessages</code></a> no longer crashes with <code class=\"docutils literal notranslate\">UnicodeDecodeError</code>\n(#20354).</p></li>\n<li><p>Fixed <code class=\"docutils literal notranslate\">geojson</code> detection with SpatiaLite.</p></li>\n<li><p><a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertContains\" title=\"django.test.SimpleTestCase.assertContains\"><code class=\"xref py py-meth docutils literal notranslate\">assertContains()</code></a> once again works with\nbinary content (#20237).</p></li>\n<li><p>Fixed <a class=\"reference internal\" href=\"/en/dev/ref/models/fields/#django.db.models.ManyToManyField\" title=\"django.db.models.ManyToManyField\"><code class=\"xref py py-class docutils literal notranslate\">ManyToManyField</code></a> if it has a Unicode <code class=\"docutils literal notranslate\">name</code>\nparameter (#20207).</p></li>\n<li><p>Ensured that the WSGI request’s path is correctly based on the\n<code class=\"docutils literal notranslate\">SCRIPT_NAME</code> environment variable or the <a class=\"reference internal\" href=\"/en/dev/ref/settings/#std-setting-FORCE_SCRIPT_NAME\"><code class=\"xref std std-setting docutils literal notranslate\">FORCE_SCRIPT_NAME</code></a>\nsetting, regardless of whether or not either has a trailing slash (#20169).</p></li>\n<li><p>Fixed an obscure bug with the <a class=\"reference internal\" href=\"/en/dev/topics/testing/tools/#django.test.override_settings\" title=\"django.test.override_settings\"><code class=\"xref py py-func docutils literal notranslate\">override_settings()</code></a>\ndecorator. If you hit an <code class=\"docutils literal notranslate\">AttributeError: 'Settings' object has no attribute\n'_original_allowed_hosts'</code> exception, it’s probably fixed (#20636).</p></li>\n</ul>\n</section>","rootId":"django-1-5-2-release-notes","toc":[{"title":"Mitigated possible XSS attack via user-supplied redirect URLs","anchor":"mitigated-possible-xss-attack-via-user-supplied-redirect-urls","children":[]},{"title":"XSS vulnerability in django.contrib.admin","anchor":"xss-vulnerability-in-django-contrib-admin","children":[]},{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.5.3","title":"Django 1.5.3 release notes","url":"/en/dev/releases/1.5.3/"},"next":{"docname":"releases/1.5.1","title":"Django 1.5.1 release notes","url":"/en/dev/releases/1.5.1/"},"formats":{"html":"/en/dev/releases/1.5.2/","markdown":"/en/dev/releases/1.5.2.md","json":"/en/dev/releases/1.5.2.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.5.2.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.5.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"]}