MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / severities

Method severities

vulnerabilities/pipelines/nvd_importer.py:198–229  ·  view source on GitHub ↗

Return a list of VulnerabilitySeverity for this CVE.

(self)

Source from the content-addressed store, hash-verified

196
197 @property
198 def severities(self):
199 """
200 Return a list of VulnerabilitySeverity for this CVE.
201 """
202 severities = []
203 metrics = get_item(self.cve_item, "cve", "metrics") or {}
204 url = f"https://nvd.nist.gov/vuln/detail/{self.cve_id}"
205 metric_configs = [
206 ("cvssMetricV40", severity_systems.CVSSV4),
207 ("cvssMetricV31", severity_systems.CVSSV31),
208 ("cvssMetricV30", severity_systems.CVSSV3),
209 ("cvssMetricV2", severity_systems.CVSSV2),
210 ]
211
212 for key, default_system in metric_configs:
213 items = metrics.get(key) or []
214
215 for item in items:
216 cvss_data = item.get("cvssData") or {}
217 system = default_system
218 if key == "cvssMetricV31" and cvss_data.get("version") != "3.1":
219 system = severity_systems.CVSSV3
220
221 severities.append(
222 VulnerabilitySeverity(
223 system=system,
224 value=str(cvss_data.get("baseScore") or ""),
225 scoring_elements=str(cvss_data.get("vectorString") or ""),
226 url=url,
227 )
228 )
229 return severities
230
231 @property
232 def reference_urls(self):

Callers

nothing calls this directly

Calls 3

get_itemFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected