Skip to content

Commit 4b004f3

Browse files
committed
HOTFIX: Fix AppSec Score Card for iOS
1 parent 2c712e2 commit 4b004f3

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

mobsf/StaticAnalyzer/views/android/db_interaction.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def get_context_from_db_entry(db_entry: QuerySet) -> dict:
9494
except Exception:
9595
msg = 'Fetching data from the DB failed.'
9696
logger.exception(msg)
97+
return None
9798

9899

99100
def get_context_from_analysis(app_dic,

mobsf/StaticAnalyzer/views/common/appsec.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ def get_android_dashboard(context, from_ctx=False):
216216
data = context
217217
else:
218218
data = adb(context)
219+
if not data:
220+
return findings
219221
# Certificate Analysis
220222
if (data.get('certificate_analysis')
221223
and 'certificate_findings' in data['certificate_analysis']):
@@ -281,6 +283,8 @@ def get_ios_dashboard(context, from_ctx=False):
281283
data = context
282284
else:
283285
data = idb(context)
286+
if not data:
287+
return findings
284288
# Transport Security
285289
if (data.get('ats_analysis')
286290
and 'ats_findings' in data['ats_analysis']):
@@ -369,13 +373,13 @@ def appsec_dashboard(request, checksum, api=False):
369373
'Invalid Hash',
370374
api)
371375
android_static_db = StaticAnalyzerAndroid.objects.filter(
372-
MD5=checksum)
376+
MD5=checksum).first()
373377
ios_static_db = StaticAnalyzerIOS.objects.filter(
374-
MD5=checksum)
375-
if android_static_db.exists():
376-
context = get_android_dashboard(android_static_db)
377-
elif ios_static_db.exists():
378-
context = get_ios_dashboard(ios_static_db)
378+
MD5=checksum).first()
379+
if android_static_db:
380+
context = get_android_dashboard([android_static_db])
381+
elif ios_static_db:
382+
context = get_ios_dashboard([ios_static_db])
379383
else:
380384
if api:
381385
return {'not_found': 'Report not found or supported'}

mobsf/StaticAnalyzer/views/ios/db_interaction.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def get_context_from_db_entry(db_entry):
7878
except Exception:
7979
msg = 'Fetching data from the DB failed.'
8080
logger.exception(msg)
81+
return None
8182

8283

8384
def get_context_from_analysis(app_dict,

0 commit comments

Comments
 (0)