| name | cvss-score-extraction |
| description | Extract CVSS (Common Vulnerability Scoring System) scores from vulnerability data sources with proper fallback handling. This skill covers understanding CVSS v3, handling multiple score sources (NVD, GHSA, RedHat), implementing source priority logic, and dealing with missing scores in security reporting. |
CVSS Score Extraction
Extract CVSS v3 scores from vulnerability data using a source priority cascade.
Source Priority
NVD → GHSA → RedHat → N/A
NVD (National Vulnerability Database) is most authoritative, followed by GitHub Security Advisories, then RedHat.
Data Structure (Trivy Format)
{
"CVSS": {
"nvd": { "V3Score": 9.8, "V2Score": 7.5 },
"ghsa": { "V3Score": 9.8 }
}
}
Python Implementation
def get_cvss_score(vuln_data):
"""Extract CVSS v3 score with source priority: NVD > GHSA > RedHat."""
cvss = vuln_data.get('CVSS', {})
if not isinstance(cvss, dict):
return 'N/A'
for source in ['nvd', 'ghsa', 'redhat']:
if source in cvss and isinstance(cvss[source], dict):
score = cvss[source].get('V3Score')
if score is not None and isinstance(score, (int, float)):
return score
return 'N/A'
Score Ranges
| Score | Severity |
|---|
| 9.0-10.0 | Critical |
| 7.0-8.9 | High |
| 4.0-6.9 | Medium |
| 0.1-3.9 | Low |