Skip to content

Commit ee07eb7

Browse files
committed
PR#4005: Fix bandit "nosec" comments
Merges #4005 https://pagure.io/koji/pull-request/4005 Fixes: #4004 https://pagure.io/koji/issue/4004 Fix bandit warnings
2 parents 167ee01 + 77b7e3a commit ee07eb7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

koji/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1503,13 +1503,15 @@ def parse_pom(path=None, contents=None):
15031503
contents = fixEncoding(contents)
15041504

15051505
try:
1506-
xml.sax.parseString(contents, handler) # nosec - trusted data
1506+
# trusted data, skipping bandit test
1507+
xml.sax.parseString(contents, handler) # nosec
15071508
except xml.sax.SAXParseException:
15081509
# likely an undefined entity reference, so lets try replacing
15091510
# any entity refs we can find and see if we get something parseable
15101511
handler.reset()
15111512
contents = ENTITY_RE.sub('?', contents)
1512-
xml.sax.parseString(contents, handler) # nosec - trusted data
1513+
# trusted data, skipping bandit test
1514+
xml.sax.parseString(contents, handler) # nosec
15131515

15141516
for field in fields:
15151517
if field not in util.to_list(values.keys()):

vm/kojivmd

+2-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,8 @@ class VMExecTask(BaseTaskHandler):
751751
raise koji.BuildError('unsupported file type: %s' % type)
752752
koji.ensuredir(os.path.dirname(localpath))
753753
# closing needs to be used for requests < 2.18.0
754-
# nosec - skipping missing timeout, it would be done on VM lifecycle level
754+
# skipping missing timeout, it would be done on VM lifecycle level
755+
# bypass bandit warning
755756
with closing(requests.get(remote_url, stream=True)) as response: # nosec
756757
response.raise_for_status()
757758
with open(localpath, 'wb') as f:

0 commit comments

Comments
 (0)