diff --git a/mobsf/StaticAnalyzer/views/common/appsec.py b/mobsf/StaticAnalyzer/views/common/appsec.py index b94e106bc..cb89fe56d 100644 --- a/mobsf/StaticAnalyzer/views/common/appsec.py +++ b/mobsf/StaticAnalyzer/views/common/appsec.py @@ -38,9 +38,20 @@ def common_fields(findings, data): sev = cd['metadata']['severity'] desc = cd['metadata']['description'] ref = cd['metadata'].get('ref', '') + + files_dict = cd.get('files', {}) + files_lines = [f'{file}, line(s) {lines}' + for file, lines in files_dict.items()] + all_files_str = '\n'.join(files_lines) + + if files_dict: + fdesc = f'{desc}\n{ref}\n\nFiles:\n{all_files_str}' + else: + fdesc = f'{desc}\n{ref}' + findings[sev].append({ 'title': cd['metadata']['description'], - 'description': f'{desc}\n{ref}', + 'description': fdesc, 'section': 'code', }) # Permissions