{"title":"Django 1.7.7 release notes","version":"dev","locale":"en","docname":"releases/1.7.7","url":"/en/dev/releases/1.7.7/","canonical":"https://djangodocs.dev/en/dev/releases/1.7.7/","summary":"Django 1.7.7 fixes several bugs and security issues in 1.7.6. Last year strip_tags() was changed to work iteratively.","html":"<h1>Django 1.7.7 release notes<a class=\"heading-anchor\" href=\"#django-1-7-7-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>March 18, 2015</em></p>\n<p>Django 1.7.7 fixes several bugs and security issues in 1.7.6.</p>\n<section id=\"denial-of-service-possibility-with-strip-tags\">\n<h2>Denial-of-service possibility with <code class=\"docutils literal notranslate\">strip_tags()</code><a class=\"heading-anchor\" href=\"#denial-of-service-possibility-with-strip-tags\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Last year <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>  was changed to work\niteratively. The problem is that the size of the input it’s processing can\nincrease on each iteration which results in an infinite loop in\n<code class=\"docutils literal notranslate\">strip_tags()</code>. This issue only affects versions of Python that haven’t\nreceived <a class=\"extlink-bpo reference external\" href=\"https://bugs.python.org/issue?&#64;action=redirect&amp;bpo=20288\">a bugfix in HTMLParser</a>; namely Python &lt; 2.7.7 and\n3.3.5. Some operating system vendors have also backported the fix for the\nPython bug into their packages of earlier versions.</p>\n<p>To remedy this issue, <code class=\"docutils literal notranslate\">strip_tags()</code> will now return the original input if\nit detects the length of the string it’s processing increases. Remember that\nabsolutely NO guarantee is provided about the results of <code class=\"docutils literal notranslate\">strip_tags()</code> being\nHTML safe. So NEVER mark safe the result of a <code class=\"docutils literal notranslate\">strip_tags()</code> call without\nescaping it first, for example with <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\">escape()</code></a>.</p>\n</section>\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> and <a class=\"reference internal\" href=\"/en/dev/topics/i18n/\"><span class=\"doc\">i18n</span></a>)\nto redirect the user to an “on success” URL. The security checks for these\nredirects (namely <code class=\"docutils literal notranslate\">django.utils.http.is_safe_url()</code>) accepted URLs with\nleading control characters and so considered URLs like <code class=\"docutils literal notranslate\">\\x08javascript:...</code>\nsafe. This issue doesn’t affect Django currently, since we only put this URL\ninto the <code class=\"docutils literal notranslate\">Location</code> response header and browsers seem to ignore JavaScript\nthere. Browsers we tested also treat URLs prefixed with control characters such\nas <code class=\"docutils literal notranslate\">%08//example.com</code> as relative paths so redirection to an unsafe target\nisn’t a problem either.</p>\n<p>However, if a developer relies on <code class=\"docutils literal notranslate\">is_safe_url()</code> to\nprovide safe redirect targets and puts such a URL into a link, they could\nsuffer from an XSS attack as some browsers such as Google Chrome ignore control\ncharacters at the start of a URL in an anchor <code class=\"docutils literal notranslate\">href</code>.</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 renaming of classes in migrations where renaming a subclass would\ncause incorrect state to be recorded for objects that referenced the\nsuperclass (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/24354\">#24354</a>).</p></li>\n<li><p>Stopped writing migration files in dry run mode when merging migration\nconflicts. When <code class=\"docutils literal notranslate\">makemigrations --merge</code> is called with <code class=\"docutils literal notranslate\">verbosity=3</code> the\nmigration file is written to <code class=\"docutils literal notranslate\">stdout</code> (<a class=\"extlink-ticket reference external\" href=\"https://code.djangoproject.com/ticket/24427\">#24427</a>).</p></li>\n</ul>\n</section>","rootId":"django-1-7-7-release-notes","toc":[{"title":"Denial-of-service possibility with strip_tags()","anchor":"denial-of-service-possibility-with-strip-tags","children":[]},{"title":"Mitigated possible XSS attack via user-supplied redirect URLs","anchor":"mitigated-possible-xss-attack-via-user-supplied-redirect-urls","children":[]},{"title":"Bugfixes","anchor":"bugfixes","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/1.7.8","title":"Django 1.7.8 release notes","url":"/en/dev/releases/1.7.8/"},"next":{"docname":"releases/1.7.6","title":"Django 1.7.6 release notes","url":"/en/dev/releases/1.7.6/"},"formats":{"html":"/en/dev/releases/1.7.7/","markdown":"/en/dev/releases/1.7.7.md","json":"/en/dev/releases/1.7.7.json"},"source":"https://github.com/django/django/blob/main/docs/releases/1.7.7.txt","official":"https://docs.djangoproject.com/en/dev/releases/1.7.7/","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"]}