44
55from dojo .models import Endpoint , Finding
66from dojo .tools .locations import LocationData
7+ from dojo .utils import parse_cvss_data
78
89SEVERITY_MAP = {
910 "INFORMATIONAL" : "Info" ,
@@ -31,6 +32,7 @@ def get_item(self, finding: dict, test):
3132 references = []
3233 unsaved_vulnerability_ids = []
3334 epss_score = finding .get ("EpssScore" )
35+ cvss_data = {}
3436 description = f"This is an Inspector Finding\n { finding .get ('Description' , '' )} " + "\n "
3537 description += f"**AWS Finding ARN:** { finding_id } \n "
3638 description += f"**AwsAccountId:** { finding .get ('AwsAccountId' , '' )} \n "
@@ -52,6 +54,10 @@ def get_item(self, finding: dict, test):
5254 references .append (vendor_url )
5355 if vulnerability .get ("EpssScore" ) is not None :
5456 epss_score = vulnerability .get ("EpssScore" )
57+ # Extract and validate CVSS vectors using the common parse_cvss_data helper
58+ for cvss_entry in vulnerability .get ("Cvss" , []):
59+ if not cvss_data and cvss_entry .get ("BaseVector" ):
60+ cvss_data = parse_cvss_data (cvss_entry .get ("BaseVector" ))
5561 if finding .get ("ProductFields" , {}).get ("aws/inspector/FindingStatus" , "ACTIVE" ) == "ACTIVE" :
5662 mitigated = None
5763 is_Mitigated = False
@@ -120,6 +126,22 @@ def get_item(self, finding: dict, test):
120126 result .unsaved_endpoints = locations
121127 if epss_score is not None :
122128 result .epss_score = epss_score
129+ if cvss_data :
130+ if cvss_data .get ("cvssv3" ):
131+ result .cvssv3 = cvss_data ["cvssv3" ]
132+ if cvss_data .get ("cvssv4" ):
133+ result .cvssv4 = cvss_data ["cvssv4" ]
134+ # Build severity justification from available CVSS data
135+ severity_parts = []
136+ if cvss_data .get ("cvssv3" ):
137+ severity_parts .append (f"CVSS v3 vector: { cvss_data ['cvssv3' ]} " )
138+ if cvss_data .get ("cvssv4" ):
139+ severity_parts .append (f"CVSS v4 vector: { cvss_data ['cvssv4' ]} " )
140+ severity_label = finding .get ("Severity" , {}).get ("Label" , "" )
141+ if severity_label :
142+ severity_parts .append (f"AWS severity: { severity_label } " )
143+ if severity_parts :
144+ result .severity_justification = "\n " .join (severity_parts )
123145 # Add the unsaved vulnerability ids
124146 result .unsaved_vulnerability_ids = unsaved_vulnerability_ids
125147 return result
0 commit comments