[New-bugs-announce] [issue30909] ServerProxy should not make requests with malformed XML

Alex Corcoles report at bugs.python.org
Wed Jul 12 11:22:13 EDT 2017


New submission from Alex Corcoles:

https://docs.python.org/3.7/library/xmlrpc.client.html says:

"""
When passing strings, characters special to XML such as <, >, and & will be automatically escaped. However, it’s the caller’s responsibility to ensure that the string is free of characters that aren’t allowed in XML, such as the control characters with ASCII values between 0 and 31 (except, of course, tab, newline and carriage return); failing to do this will result in an XML-RPC request that isn’t well-formed XML. If you have to pass arbitrary bytes via XML-RPC, use bytes or bytearray classes or the Binary wrapper class described below.
"""

The XML-RPC spec at http://xmlrpc.scripting.com/spec.html says:

"""
What characters are allowed in strings? Non-printable characters? Null characters? Can a "string" be used to hold an arbitrary chunk of binary data?

Any characters are allowed in a string except < and &, which are encoded as < and &. A string can be used to encode binary data.
"""

I believe strings should be XML-escaped correctly or at the very least, an assertion should be made to ensure no malformed XML is ever generated.

----------
components: XML
messages: 298226
nosy: Alex Corcoles
priority: normal
severity: normal
status: open
title: ServerProxy should not make requests with malformed XML
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30909>
_______________________________________


More information about the New-bugs-announce mailing list