From 58e08e80e362db79eb0fd775dc81faad90dca47a Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 2 Aug 2017 16:22:35 -0400 Subject: [1.10.x] Fixed CVE-2017-12794 -- Fixed XSS possibility in traceback section of technical 500 debug page. This is a security fix. --- django/views/debug.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'django/views/debug.py') diff --git a/django/views/debug.py b/django/views/debug.py index 0ed55fdfe4..327ff433c5 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -775,38 +775,37 @@ TECHNICAL_500_TEMPLATE = ("""

Traceback {% if not is_email %} Switch to copy-and-paste view{% endif %}

- {% autoescape off %}
- {% endautoescape %}
{% if not is_email %}
@@ -888,9 +886,9 @@ In template {{ template_info.name }}, error at line {{ template_info.line }} Traceback:{% for frame in frames %} {% ifchanged frame.exc_cause %}{% if frame.exc_cause %}{% if frame.exc_cause_explicit %} -The above exception ({{ frame.exc_cause }}) was the direct cause of the following exception: +The above exception ({{ frame.exc_cause|force_escape }}) was the direct cause of the following exception: {% else %} -During handling of the above exception ({{ frame.exc_cause }}), another exception occurred: +During handling of the above exception ({{ frame.exc_cause|force_escape }}), another exception occurred: {% endif %}{% endif %}{% endifchanged %} File "{{ frame.filename|escape }}" in {{ frame.function|escape }} {% if frame.context_line %} {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %}{% endfor %} -- cgit v1.3