mirror of
https://github.com/django/django.git
synced 2025-10-30 17:16:10 +00:00
Patch CSRF-protection system to deal with reported security issue. Announcement and details to follow.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13698 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -9,6 +9,7 @@ from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG
|
||||
from django.template import get_library, Library, InvalidTemplateLibrary
|
||||
from django.template.smartif import IfParser, Literal
|
||||
from django.conf import settings
|
||||
from django.utils.html import escape
|
||||
from django.utils.encoding import smart_str, smart_unicode
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
@@ -42,7 +43,7 @@ class CsrfTokenNode(Node):
|
||||
if csrf_token == 'NOTPROVIDED':
|
||||
return mark_safe(u"")
|
||||
else:
|
||||
return mark_safe(u"<div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='%s' /></div>" % (csrf_token))
|
||||
return mark_safe(u"<div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='%s' /></div>" % escape(csrf_token))
|
||||
else:
|
||||
# It's very probable that the token is missing because of
|
||||
# misconfiguration, so we raise a warning
|
||||
|
||||
Reference in New Issue
Block a user