Skip to content

gh-127502: Update XML vulnerability table #135294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 7, 2025
Merged

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 9, 2025

Python 3.11-3.15 include expat 2.7.1 which is not vulnerable.

expat 2.6.0 was released in February 2024.


📚 Documentation preview 📚: https://cpython-previews--135294.org.readthedocs.build/

Python 3.11-3.15 include expat 2.7.1 which is not vulnerable.

expat 2.6.0 was released in February 2024.
@encukou
Copy link
Member

encukou commented Jun 9, 2025

Do you think the table should be kept, now that it says Safe almost everywhere?

@vstinner
Copy link
Member Author

vstinner commented Jun 9, 2025

Do you think the table should be kept, now that it says Safe almost everywhere?

The table has many notes with pyexpat versions. There are likely old Python versions in the wild with old pyexat versions.

The question is more if we need to keep the big red warning at the top:

The XML modules are not secure against erroneous or maliciously constructed data. If you need to parse untrusted or unauthenticated data see the XML vulnerabilities and The defusedxml Package sections.

Maybe this warning can just be removed.

Since Python XML modules are now safe by default, we can maybe remove references to the defusedxml project which is no longer needed.

Note: The latest defused version (0.7.0) was released in 2021. There is a 0.8.0rc2 version around since September 2023 with no final release. The project seems to be unmaintained (latest commit: 2 years ago).

@vstinner
Copy link
Member Author

vstinner commented Jun 9, 2025

I updated my PR to remove the red warning and remove references to defusedxml.

@hannob
Copy link

hannob commented Jun 9, 2025

There are similar warnings in several other files, e.g.:

Doc/library/xml.etree.elementtree.rst
Doc/library/xml.dom.pulldom.rst
Doc/library/xml.dom.minidom.rst
Doc/library/xml.sax.rst

Replace also "XML Vulnerabilities" with "XML Security".
@vstinner
Copy link
Member Author

There are similar warnings in several other files

Good catch. I replaced most warnings with notes. I replaced also "XML Vulnerabilities" with "XML Security".

I kept the warnings for XML-RPC client and server since the XML table still says that XML-RPC is vulnerable to decompression bomb.

@encukou
Copy link
Member

encukou commented Jun 11, 2025

The table has many notes with pyexpat versions. There are likely old Python versions in the wild with old pyexat versions.

So maybe the whole table, and the list of vulnerabilities, could be replaced with something like: “Expat versions lower that 2.6.0 may be vulnerable to :cve:xxx-xxx and :cve:xxx-xxx. Python may be vulnerable if it uses such older versions of Expat as a system-provided library, it may be vulnerable. Check :const:!pyexpat.EXPAT_VERSION.”
and maybe a link to defusedxml for details?

@sethmlarson, is it OK to remove the note “The XML processing modules arenot secure against maliciously constructed data”, if all known vulnerabilities are fixed?

@vstinner
Copy link
Member Author

On Linux, Python is usually linked to the system expat library, and so we don't control the expat version. For this reason, I would prefer to keep the table for now. The table contains a lot of information and has many notes.

@vstinner
Copy link
Member Author

vstinner commented Jul 1, 2025

@encukou: I removed the table, please review again.

@vstinner
Copy link
Member Author

vstinner commented Jul 1, 2025

cc @serhiy-storchaka

@sethmlarson
Copy link
Contributor

@encukou Apologies for the delay, I'm now back from all the conferences in June. I think we're good to remove the table and mentions of "don't use with untrusted data" if we have remediated all known vulnerabilities. Thanks for this!

@vstinner
Copy link
Member Author

vstinner commented Jul 3, 2025

@encukou @serhiy-storchaka: What do you think of the updated PR? I addressed your reviews.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@encukou encukou merged commit cb99d99 into python:main Jul 7, 2025
29 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jul 7, 2025
@miss-islington-app
Copy link

Thanks @vstinner for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 7, 2025
* Remove the table
* Replace warnings with notes

Latest releases of Python 3.9-3.15 include expat 2.7.1 which is not vulnerable.

expat 2.6.0 was released in February 2024.
(cherry picked from commit cb99d99)

Co-authored-by: Victor Stinner <[email protected]>
@encukou
Copy link
Member

encukou commented Jul 7, 2025

Thank you!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 7, 2025
* Remove the table
* Replace warnings with notes

Latest releases of Python 3.9-3.15 include expat 2.7.1 which is not vulnerable.

expat 2.6.0 was released in February 2024.
(cherry picked from commit cb99d99)

Co-authored-by: Victor Stinner <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jul 7, 2025

GH-136359 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jul 7, 2025
@bedevere-app
Copy link

bedevere-app bot commented Jul 7, 2025

GH-136360 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jul 7, 2025
@vstinner vstinner deleted the xml_safe branch July 7, 2025 09:04
@vstinner
Copy link
Member Author

vstinner commented Jul 7, 2025

Thanks for reviews.

vstinner added a commit that referenced this pull request Jul 7, 2025
gh-127502: Remove XML vulnerability table (GH-135294)

* Remove the table
* Replace warnings with notes

Latest releases of Python 3.9-3.15 include expat 2.7.1 which is not vulnerable.

expat 2.6.0 was released in February 2024.
(cherry picked from commit cb99d99)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this pull request Jul 7, 2025
gh-127502: Remove XML vulnerability table (GH-135294)

* Remove the table
* Replace warnings with notes

Latest releases of Python 3.9-3.15 include expat 2.7.1 which is not vulnerable.

expat 2.6.0 was released in February 2024.
(cherry picked from commit cb99d99)

Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants