Django 1.4.6发行说明

2013年8月13日

Django1.4.6修复了1.4系列中以前的Django版本中存在的一个安全问题,以及另一个bug。

这是Django1.4系列中的第六个bugfix/security版本。

通过用户提供的重定向URL减轻了可能的XSS攻击

Django在某些情况下依赖于用户输入(例如 django.contrib.auth.views.login(), django.contrib.comments, and i18n) to redirect the user to an "on success" URL. The security checks for these redirects (namely django.utils.http.is_safe_url()) didn't check if the scheme is http(s) and as such allowed javascript:... 要输入的URL。如果开发商依赖 is_safe_url() 为了提供安全的重定向目标并将这样的URL放到链接中,他们可能会遭受XSS攻击。此错误当前不影响Django,因为我们只将此URL放入 Location 响应头和浏览器似乎忽略了那里的javascript。

错误修正

  • override_settings() 装饰符。如果你击中了 AttributeError: 'Settings' object has no attribute '_original_allowed_hosts' 例外的是,它可能是固定的(20636)。