@@ -18,46 +18,48 @@ def get_findings(self, file, test):
18
18
findings = []
19
19
data = json .load (file )
20
20
21
- if not isinstance (data , dict ) or "results " not in data :
21
+ if not isinstance (data , dict ) or "matches " not in data :
22
22
return findings
23
23
24
- for result in data ["results " ]:
25
- image = result .get ("image " , "Unknown Image" )
26
- matches = result .get ("Matches " , {})
27
- artifact = result . get ( "artifact" , {})
28
- distro = result .get ("distro" , {})
24
+ for match in data ["matches " ]:
25
+ cycle = match .get ("Cycle " , {} )
26
+ artifact = match .get ("artifact " , {})
27
+
28
+ title = f" { cycle .get ('ProductName' , 'Unknown Product' ) } EOL Information"
29
29
30
- title = f"{ matches .get ('ProductName' , 'Unknown Product' )} EOL Information"
31
30
description_lines = [
32
- f"**Image:** { image } " ,
33
- f"**Product Name:** { matches .get ('ProductName' , 'N/A' )} " ,
34
- f"**Release Cycle:** { matches .get ('ReleaseCycle' , 'N/A' )} " ,
35
- f"**EOL Date:** { matches .get ('Eol' , 'N/A' )} " ,
36
- f"**Latest Release Date:** { matches .get ('LatestReleaseDate' , 'N/A' )} " ,
37
- f"**Release Date:** { matches .get ('ReleaseDate' , 'N/A' )} " ,
31
+ f"**Product Name:** { cycle .get ('ProductName' , 'N/A' )} " ,
32
+ f"**Release Cycle:** { cycle .get ('ReleaseCycle' , 'N/A' )} " ,
33
+ f"**EOL Date:** { cycle .get ('Eol' , 'N/A' )} " ,
34
+ f"**Latest Release Date:** { cycle .get ('LatestReleaseDate' , 'N/A' )} " ,
35
+ f"**Release Date:** { cycle .get ('ReleaseDate' , 'N/A' )} " ,
38
36
f"**Artifact Name:** { artifact .get ('name' , 'N/A' )} " ,
39
37
f"**Artifact Version:** { artifact .get ('version' , 'N/A' )} " ,
40
38
f"**Artifact Type:** { artifact .get ('type' , 'N/A' )} " ,
41
- f"**Licenses:** { ', ' .join (artifact .get ('licenses' , []))} " ,
39
+ f"**Licenses:** { ', ' .join (artifact .get ('licenses' , [])) if artifact . get ( 'licenses' ) else 'N/A' } " ,
42
40
f"**Package URL:** { artifact .get ('purl' , 'N/A' )} " ,
43
- f"**Distro Name:** { distro .get ('name' , 'N/A' )} " ,
44
- f"**Distro Version:** { distro .get ('version' , 'N/A' )} " ,
41
+ f"**CPEs:** { ', ' .join (artifact .get ('cpes' , [])) if artifact .get ('cpes' ) else 'N/A' } " ,
45
42
]
46
43
47
44
locations = artifact .get ("locations" , [])
48
- location_info = []
49
- for loc in locations :
50
- path = loc .get ("path" , "" )
51
- layer_id = loc .get ("layerID" , "" )
52
- location_info .append (f"Path: { path } , LayerID: { layer_id } " )
53
- if location_info :
45
+ if locations :
46
+ location_info = [
47
+ f"Path: { loc .get ('path' , '' )} , LayerID: { loc .get ('layerID' , '' )} "
48
+ for loc in locations
49
+ ]
54
50
description_lines .append ("**Locations:**\n " + "\n " .join (location_info ))
55
51
52
+ metadata = artifact .get ("metadata" , {})
53
+ if isinstance (metadata , dict ) and "files" in metadata :
54
+ file_paths = [f .get ("path" , "" ) for f in metadata ["files" ] if "path" in f ]
55
+ if file_paths :
56
+ description_lines .append ("**Files:**\n " + "\n " .join (file_paths ))
57
+
56
58
description = "\n " .join (description_lines )
57
59
58
60
# Determine severity based on EOL date
59
61
severity = "Info"
60
- eol_str = matches .get ("Eol" , "" )
62
+ eol_str = cycle .get ("Eol" , "" )
61
63
try :
62
64
eol_date = datetime .strptime (eol_str , "%Y-%m-%d" )
63
65
now = datetime .now ()
@@ -84,7 +86,8 @@ def get_findings(self, file, test):
84
86
static_finding = True ,
85
87
dynamic_finding = False ,
86
88
nb_occurences = 1 ,
87
- references = matches .get ("ProductPermalink" , "" ),
89
+ cwe = 672 ,
90
+ references = cycle .get ("ProductPermalink" , "" ),
88
91
)
89
92
90
93
findings .append (finding )
0 commit comments