Skip to content

Commit 4495770

Browse files
committed
Bandit lint fixes
1 parent b744d71 commit 4495770

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

mobsfscan/manifest.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def assetlinks_check(self, intent):
307307
"""Well known assetlink check."""
308308
iden = 'sha256_cert_fingerprints'
309309
well_known_path = '/.well-known/assetlinks.json'
310+
rule = 'android_manifest_well_known_assetlinks'
310311
well_knowns = set()
311312

312313
applink_data = intent.get('data')
@@ -327,18 +328,24 @@ def assetlinks_check(self, intent):
327328
well_knowns.add(c_url)
328329
for w_url in well_knowns:
329330
try:
331+
status = True
330332
r = requests.get(
331333
w_url,
332-
allow_redirects=True)
334+
allow_redirects=True,
335+
timeout=5)
333336
if not (str(r.status_code).startswith('2')
334337
and iden in str(r.json())):
335-
add_finding(
336-
self.findings,
337-
self.xml_path,
338-
'android_manifest_well_known_assetlinks',
339-
(w_url, r.status_code))
338+
status = False
339+
rcode = r.status_code
340340
except Exception:
341-
pass
341+
status = False
342+
rcode = 0
343+
if not status:
344+
add_finding(
345+
self.findings,
346+
self.xml_path,
347+
rule
348+
(w_url, rcode))
342349

343350

344351
class TaskHijackingChecks:

0 commit comments

Comments
 (0)