Skip to content

Commit 1683f7e

Browse files
author
Orlando Barrera II
committed
Improved the sarif file parsing
1 parent bdb6de1 commit 1683f7e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

socketsecurity/core/messages.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ def get_manifest_type_url(manifest_file: str, pkg_name: str, pkg_version: str) -
175175
def create_security_comment_sarif(diff) -> dict:
176176
"""
177177
Create a SARIF-compliant JSON object for alerts. This function now:
178-
- Accepts multiple manifest files (from alert.introduced_by or alert.manifests)
179-
- Generates one SARIF location per manifest file.
180-
- Supports various language-specific manifest types.
178+
- Accepts multiple manifest files (from alert.introduced_by or alert.manifests)
179+
- Generates one SARIF location per manifest file.
180+
- Supports various language-specific manifest types.
181181
"""
182182
# (Optional: handle scan failure based on alert.error flags)
183183
if len(diff.new_alerts) == 0:
@@ -221,7 +221,9 @@ def create_security_comment_sarif(diff) -> dict:
221221
manifest_files.extend([m.strip() for m in entry.split(";") if m.strip()])
222222
elif hasattr(alert, 'manifests') and alert.manifests:
223223
manifest_files = [mf.strip() for mf in alert.manifests.split(";") if mf.strip()]
224-
else:
224+
225+
# Fallback if no manifest file was determined.
226+
if not manifest_files:
225227
manifest_files = ["requirements.txt"]
226228

227229
# Use the first manifest for URL generation.

0 commit comments

Comments
 (0)