Django 1.4.21 版本发行说明
Django 1.4.21 fixes several security issues in 1.4.20.
The built-in session backends now create a session record only if the session is actually modified; empty session records are not created. Thus this potential DoS is now only possible if the site chooses to expose a session-modifying view to anonymous users.
Header injection possibility since validators accept newlines in input
Some of Django’s built-in validators (, most seriously) didn’t prohibit newline characters (due to the usage of $
instead of \Z
in the regular expressions). If you use values with newlines in HTTP response or email headers, you can suffer from header injection attacks. Django itself isn’t vulnerable because HttpResponse and the mail sending utilities in prohibit newlines in HTTP and SMTP headers, respectively. While the validators have been fixed in Django, if you’re creating HTTP responses or email messages in other ways, it’s a good idea to ensure that those methods prohibit newlines as well. You might also want to validate that any existing data in your application doesn’t contain unexpected newlines.
The undocumented, internally unused validate_integer()
function is now stricter as it validates using a regular expression instead of simply casting the value using int()
and checking if an exception was raised.