| name | vulnerability-json-parsing |
| description | Extracting specific security metadata (CVE, CVSS, Fix versions) from structured vulnerability reports like npm audit JSON or OSV. |
Extracting Metadata
When parsing the JSON output from a security audit tool (like npm audit --json), focus on the following fields within the advisories or vulnerabilities objects:
- Package Name: The key or
name field in the vulnerability object.
- Installed Version: Cross-referenced from the
package-lock.json or the version field in the audit report.
- CVE ID: Found under
cves (array) or identifiers. Use the primary CVE ID (e.g., CVE-2023-xxxx). If unavailable, look for GHSA (GitHub Security Advisory) IDs.
- Severity: The
severity field (e.g., high, critical).
- CVSS Score: Often found under
cvss.score or within the advisory metadata. If missing from the local audit, it may need to be fetched via the reference URL provided.
- Fixed Version: Look for
fixAvailable.version or patched_versions. If no patch is available, denote as N/A.
- Title/Description: Found in the
title or summary field.
- Reference URL: Found in the
url or references array.
Python Processing Example
Use the json and csv modules in Python to transform the audit data:
import json
import csv
def extract_vulnerabilities(json_data):
results = []
return results