Skip to content
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

Remove lxml from DUO107 #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
21 changes: 0 additions & 21 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 All @@ -37,11 +36,6 @@ def test_xml_import_usage(self):
lineno=3,
col_offset=0,
message=dlint.linters.BadXMLUseLinter._error_tmpl
),
dlint.linters.base.Flake8Result(
lineno=4,
col_offset=0,
message=dlint.linters.BadXMLUseLinter._error_tmpl
)
]

Expand Down Expand Up @@ -108,21 +102,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()