Skip to content

Commit

Permalink
Merge pull request #151 from 0x41424142/patch
Browse files Browse the repository at this point in the history
CodeFactor Security Findings
  • Loading branch information
0x41424142 authored Oct 7, 2024
2 parents 2d3a655 + 6db233b commit 57af21a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
13 changes: 12 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "qualysdk"
version = "0.1.48"
version = "0.1.49"
description = "SDK for interacting with Qualys APIs, across most modules the platform offers."
authors = ["0x41424142 <jake@jakelindsay.uk>", "0x4A616B65 <jake.lindsay@thermofisher.com>"]
maintainers = ["Jake Lindsay <jake@jakelindsay.uk>"]
Expand Down Expand Up @@ -39,6 +39,7 @@ psycopg2-binary = [
{version = "^2.9.9", platform = "darwin"},
]
xmltodict = "^0.13.0"
defusedxml = "^0.7.1"


[tool.poetry.urls]
Expand Down
7 changes: 4 additions & 3 deletions qualysdk/base/xml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
xml_parser.py - contains the xml_parser function that parses an XML string into a dictionary.
"""

from lxml import etree
from lxml.etree import _Comment
from defusedxml.lxml import fromstring


def xml_parser(xml_string, attr_prefix="@", cdata_key="#text"):
Expand All @@ -28,7 +29,7 @@ def parse_element(element):
parsed_dict[attr_prefix + key] = value
# Parse child elements
for child in element:
if isinstance(child, etree._Comment):
if isinstance(child, _Comment):
continue # Skip comments
child_dict = parse_element(child)
if child.tag in parsed_dict:
Expand All @@ -46,5 +47,5 @@ def parse_element(element):
parsed_dict = text
return parsed_dict

root = etree.fromstring(xml_string)
root = fromstring(xml_string)
return {root.tag: parse_element(root)}
2 changes: 1 addition & 1 deletion qualysdk/totalcloud/data_classes/Evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __post_init__(self):
try:
setattr(self, field, datetime.fromisoformat(value))
except:
pass
setattr(self, field, None)

def to_dict(self):
return asdict(self)
Expand Down

0 comments on commit 57af21a

Please sign in to comment.