We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e67dfd commit 6e1f96dCopy full SHA for 6e1f96d
1 file changed
Lib/test/test_xmlrpc.py
@@ -208,6 +208,15 @@ def test_dump_encoding(self):
208
self.assertEqual(xmlrpclib.loads(strg)[0][0], value)
209
self.assertEqual(xmlrpclib.loads(strg)[1], methodname)
210
211
+ def test_methodname_sanitization(self):
212
+ # gh-148954: test that methodname is sanitized in dumps()
213
+ payload = 'foo</methodName><injected attr="evil"/><methodName>bar'
214
+ s = xmlrpclib.dumps((), methodname=payload)
215
+ self.assertIn('<methodName>foo</methodName><injected attr="evil"/><methodName>bar</methodName>', s)
216
+ self.assertNotIn('<injected attr="evil"/>', s)
217
+ load, m = xmlrpclib.loads(s)
218
+ self.assertEqual(m, payload)
219
+
220
def test_dump_bytes(self):
221
sample = b"my dog has fleas"
222
self.assertEqual(sample, xmlrpclib.Binary(sample))
0 commit comments