@@ -18,7 +18,7 @@ class Messages:
18
18
def map_severity_to_sarif (severity : str ) -> str :
19
19
"""
20
20
Map Socket severity levels to SARIF levels (GitHub code scanning).
21
-
21
+
22
22
'low' -> 'note'
23
23
'medium' or 'middle' -> 'warning'
24
24
'high' or 'critical' -> 'error'
@@ -211,8 +211,11 @@ def create_security_comment_sarif(diff) -> dict:
211
211
manifest_files = []
212
212
if alert .introduced_by and isinstance (alert .introduced_by , list ):
213
213
for entry in alert .introduced_by :
214
- if isinstance (entry , list ) and len (entry ) >= 2 :
215
- manifest_files .append (entry [1 ].strip ())
214
+ # Accept lists or tuples
215
+ if isinstance (entry , (list , tuple )) and len (entry ) >= 2 :
216
+ # Split the second element if it contains semicolons
217
+ files = [f .strip () for f in entry [1 ].split (";" ) if f .strip ()]
218
+ manifest_files .extend (files )
216
219
elif isinstance (entry , str ):
217
220
manifest_files .extend ([m .strip () for m in entry .split (";" ) if m .strip ()])
218
221
elif hasattr (alert , 'manifests' ) and alert .manifests :
@@ -246,7 +249,7 @@ def create_security_comment_sarif(diff) -> dict:
246
249
for mf in manifest_files :
247
250
line_number , line_content = Messages .find_line_in_file (pkg_name , pkg_version , mf )
248
251
if line_number < 1 :
249
- line_number = 1
252
+ line_number = 1 # Ensure SARIF compliance.
250
253
logging .debug ("Alert %s: Manifest %s, line %d: %s" , rule_id , mf , line_number , line_content )
251
254
locations .append ({
252
255
"physicalLocation" : {
0 commit comments