fix: version-gate defusedxml by Python version#596
Open
vasiliadi wants to merge 2 commits into
Open
Conversation
Coverage Report for CI Build 25830137455Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Contributor
Author
|
Or, alternatively, we could stop supporting Python 3.10 since it's nearing end-of-life. And revert #352 Also, this could be done after the EOL of 3.10. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Version-gate the XML backend and dependency so Python 3.8-3.10 keeps using
defusedxml, while Python 3.11+ uses the stdlibxml.etree.ElementTreebackend.Why
PR #352 made
defusedxmlunconditional for all supported Python versions.We’re now gating it because Python’s XML security guidance changed in python/cpython#135294. That change narrows the practical risk to older Expat versions and removes the older blanket recommendation pattern for always using
defusedxml.For this project, we chose the simple version-based rule:
defusedxmlElementTreeThe reason for that cutoff is to preserve extra protection on older supported Python versions while avoiding an unnecessary hard dependency on newer Python versions.
Validation
defusedxmldefusedxml