You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation for the xml.etree.ElementTree API contains the following stark warning: Warning: The xml.etree.ElementTree module is not secure against maliciously constructed data. If you need to parse untrusted or unauthenticated data see XML vulnerabilities.
Similar warnings exist on the documentation pages of other XML standard library functions.
From what I can tell, this warning is outdated, and should probably be reconsidered. If I look at the referenced info here https://docs.python.org/3/library/xml.html#xml-vulnerabilities
it does say "Vulnerable" for 3 of the 6 issues for the etree API, but each contains a footnote, essentially saying that this is no longer true for a current version of Expat.
Correct me if I'm wrong, but I interpret that this means using these APIs is fine and secure, as long as one does not use an outdated version of Expat with known vulnerabilities. I don't think this justifies the stark warning above.
@sethmlarson, do we have a better mechanism than tracking these in the docs?
I agree that the table is now obsolete. We might need a note that you need to keep the system expat up to date if using that, and perhaps links to CVEs.
Not sure about removing the note itself -- how careful should we be about unknown vulnerabilities?
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Jun 9, 2025
I propose #135294 to update the stable. Windows and macOS use expat 2.7.1, most Linux distributions should use expat >= 2.6 (expat 2.6 was released in February 2024). There are (1) and (6) notes to indicate the minimum expat version which is safe.
Uh oh!
There was an error while loading. Please reload this page.
Documentation
The documentation for the xml.etree.ElementTree API contains the following stark warning:
Warning: The xml.etree.ElementTree module is not secure against maliciously constructed data. If you need to parse untrusted or unauthenticated data see XML vulnerabilities.
Similar warnings exist on the documentation pages of other XML standard library functions.
From what I can tell, this warning is outdated, and should probably be reconsidered. If I look at the referenced info here
https://docs.python.org/3/library/xml.html#xml-vulnerabilities
it does say "Vulnerable" for 3 of the 6 issues for the etree API, but each contains a footnote, essentially saying that this is no longer true for a current version of Expat.
Correct me if I'm wrong, but I interpret that this means using these APIs is fine and secure, as long as one does not use an outdated version of Expat with known vulnerabilities. I don't think this justifies the stark warning above.
Linked PRs
The text was updated successfully, but these errors were encountered: