[codex] Remove defusedxml dependency#1549
Merged
Merged
Conversation
| from typing_extensions import LiteralString | ||
|
|
||
| from defusedxml import ElementTree | ||
| from xml.etree import ElementTree |
|
|
||
| import re | ||
| from pathlib import Path | ||
| from xml.etree import ElementTree |
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
Removes the
defusedxmlruntime dependency and replaces its two uses with a small stdlib-based XML helper.Details
lib/utils/safe_xml.py, which usesxml.etree.ElementTreeafter rejecting DTD and entity declarations.defusedxmlfrom runtime requirements and PyInstaller hidden imports.typing_extensionsusage from runtime code while touching the affected imports.Impact
The CLI can start without
defusedxmlinstalled, while still rejecting the XML constructs that mattered for XXE-style input. Packaged installs and PyInstaller builds no longer include the unused dependency.Validation
python3 -m unittest tests.utils.test_safe_xmlpython3 -m unittest tests.utils.test_safe_xml tests.parse.test_nmap tests.utils.test_mimetype tests.parse.test_config tests.parse.test_headers tests.core.test_importable_apipython3 -m py_compile lib/utils/safe_xml.py lib/parse/nmap.py lib/utils/mimetype.py lib/core/decorators.py tests/utils/test_safe_xml.pypython3 dirsearch.py -hpython3 dirsearch.py --wordlist-status -w tests/static/wordlist.txt -qA broader requester/scanner unittest run was not available in this local environment because
httpxis not installed.