]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
HTML-escape the plain traceback in cgitb's HTML output, to prevent
authorGeorg Brandl <georg@python.org>
Tue, 15 May 2007 20:19:42 +0000 (20:19 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 15 May 2007 20:19:42 +0000 (20:19 +0000)
the traceback inadvertently or maliciously closing the comment and
injecting HTML into the error page.
 (backport from rev. 55348)

Lib/cgitb.py
Misc/NEWS

index a52800afef55d361e3270a8db343aea97041c9cf..86e4eb9a2eaad26a2852a9e7a7d7c6576f638142 100644 (file)
@@ -182,7 +182,8 @@ function calls leading up to the error, in the order they occurred.</p>'''
 
 %s
 -->
-''' % ''.join(traceback.format_exception(etype, evalue, etb))
+''' % pydoc.html.escape(
+          ''.join(traceback.format_exception(etype, evalue, etb)))
 
 def text((etype, evalue, etb), context=5):
     """Return a plain text document describing a given traceback."""
index 280b6aa34936dbe21c784b1990660ba5998e4025..e8ea8cc01a5895dd9f847c21eabd2cc13c5ad74d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -26,6 +26,10 @@ Extension Modules
 Library
 -------
 
+- HTML-escape the plain traceback in cgitb's HTML output, to prevent
+  the traceback inadvertently or maliciously closing the comment and
+  injecting HTML into the error page.
+
 - idle: Honor the "Cancel" action in the save dialog (Debian bug #299092).
 
 Tests