Skip to content

Commit

Permalink
Remove lxml from DUO107
Browse files Browse the repository at this point in the history
defusedxml.lxml [was only ever an example](https://github.com/tiran/defusedxml#defusedxmllxml) and tiran/defusedxml#38.
  • Loading branch information
hughdavenport committed May 18, 2022
1 parent ce0b19c commit 4af3486
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
1 change: 0 additions & 1 deletion dlint/linters/bad_xml_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class BadXMLUseLinter(bad_module_use.BadModuleUseLinter):
@property
def illegal_modules(self):
return [
'lxml',
'xml',
'xmlrpclib',
]
Expand Down
2 changes: 1 addition & 1 deletion docs/linters/DUO107.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DUO107

This linter searches for use of the `lxml`, `xml`, `xmlrpclib` modules. These
This linter searches for use of the `xml`, `xmlrpclib` modules. These
libraries are not hardened against many common XML attacks. The `defusedxml`
library should be preferred to these modules.

Expand Down
16 changes: 0 additions & 16 deletions tests/test_bad_xml_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def test_xml_import_usage(self):
"""
import xml
import xmlrpclib
import lxml
"""
)

Expand Down Expand Up @@ -108,21 +107,6 @@ def test_element_parse_import_usage(self):

assert result == expected

def test_defused_lxml_usage(self):
python_node = self.get_ast_node(
"""
from defusedxml import lxml
"""
)

linter = dlint.linters.BadXMLUseLinter()
linter.visit(python_node)

result = linter.get_results()
expected = []

assert result == expected


if __name__ == "__main__":
unittest.main()

0 comments on commit 4af3486

Please sign in to comment.