From c25abd43e8877b4a7098f79eaacb248710731c2b Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sat, 28 Sep 2019 04:59:37 +0900 Subject: [PATCH] bpo-38243, xmlrpc.server: Escape the server_title (GH-16373) Escape the server title of xmlrpc.server.DocXMLRPCServer when rendering the document page as HTML. CVE: CVE-2019-16935 Upstream-Status: Backport [https://github.com/python/cpython/commit/e8650a4f8c7fb76f570d4ca9c1fbe44e91c8dfaa] Signed-off-by: Chen Qi --- Lib/test/test_docxmlrpc.py | 16 ++++++++++++++++ Lib/xmlrpc/server.py | 3 ++- .../2019-09-25-13-21-09.bpo-38243.1pfz24.rst | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Security/2019-09-25-13-21-09.bpo-38243.1pfz24.rst diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py index f077f05f5b..38215659b6 100644 --- a/Lib/test/test_docxmlrpc.py +++ b/Lib/test/test_docxmlrpc.py @@ -1,5 +1,6 @@ from xmlrpc.server import DocXMLRPCServer import http.client +import re import sys import threading from test import support @@ -193,6 +194,21 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase): b'method_annotation(x: bytes)'), response.read()) + def test_server_title_escape(self): + # bpo-38243: Ensure that the server title and documentation + # are escaped for HTML. + self.serv.set_server_title('test_title