@@ -18,7 +18,7 @@ class Messages:
1818 def map_severity_to_sarif (severity : str ) -> str :
1919 """
2020 Map Socket severity levels to SARIF levels (GitHub code scanning).
21-
21+
2222 'low' -> 'note'
2323 'medium' or 'middle' -> 'warning'
2424 'high' or 'critical' -> 'error'
@@ -211,8 +211,11 @@ def create_security_comment_sarif(diff) -> dict:
211211 manifest_files = []
212212 if alert .introduced_by and isinstance (alert .introduced_by , list ):
213213 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 )
216219 elif isinstance (entry , str ):
217220 manifest_files .extend ([m .strip () for m in entry .split (";" ) if m .strip ()])
218221 elif hasattr (alert , 'manifests' ) and alert .manifests :
@@ -246,7 +249,7 @@ def create_security_comment_sarif(diff) -> dict:
246249 for mf in manifest_files :
247250 line_number , line_content = Messages .find_line_in_file (pkg_name , pkg_version , mf )
248251 if line_number < 1 :
249- line_number = 1
252+ line_number = 1 # Ensure SARIF compliance.
250253 logging .debug ("Alert %s: Manifest %s, line %d: %s" , rule_id , mf , line_number , line_content )
251254 locations .append ({
252255 "physicalLocation" : {
0 commit comments