Skip to content
Skills Library
Security · Analysis

vulnerability-data-processing

/vulnerability-data-processing

Process vulnerability scan results from Trivy JSON output, extract HIGH/CRITICAL severity vulnerabilities with complete metadata (CVE, CVSS scores, fix versions, references). Use this skill whenever you need to transform raw vulnerability data into structured format with proper field mapping and CVSS score prioritization.

Licence
MIT
Last repository change
02.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 02.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Process vulnerability scan results from Trivy JSON output, extract HIGH/CRITICAL severity vulnerabilities with complete metadata (CVE, CVSS scores, fix versions, references). Use this skill whenever you need to transform raw vulnerability data into structured format with proper field mapping and CVSS score prioritization.

Original author description

Process vulnerability scan results from Trivy JSON output, extract HIGH/CRITICAL severity vulnerabilities with complete metadata (CVE, CVSS scores, fix versions, references). Use this skill whenever you need to transform raw vulnerability data into structured format with proper field mapping and CVSS score prioritization.

How it works

  1. Overview
  2. Input Format
  3. Processing Steps
  4. Validation Checks
  5. Python Implementation Pattern
  6. Common Field Transformations
  7. Error Handling
  8. Output
  9. Next Steps
Original SKILL.md headings · 193 lines, 617 words
SKILL.md preview
---
name: vulnerability-data-processing
description: Process vulnerability scan results from Trivy JSON output, extract HIGH/CRITICAL severity vulnerabilities with complete metadata (CVE, CVSS scores, fix versions, references). Use this skill whenever you need to transform raw vulnerability data into structured format with proper field mapping and CVSS score prioritization.
---

# Vulnerability Data Processing and Extraction

## Overview

This skill handles transforming raw Trivy JSON vulnerability scan results into structured data for reporting. It handles field extraction, CVSS score selection, and data validation.

## Input Format

Trivy JSON output with structure:
```json
{
  "Results": [
    {
      "Target": "package-lock.json",
      "Type": "npm",
      "Vulnerabilities": [
        {
          "VulnerabilityID": "CVE-2021-12345",
          "PkgName": "package-name",
          "InstalledVersion": "1.0.0",
          "FixedVersion": "1.0.1",
          "Severity": "HIGH",
          "Title": "Vulnerability description",
          "Description": "Detailed description",
          "CVSS": {
            "nvd": {
              "V3Vector": "CVSS:3.1/AV:N/AC:L/...",
              "V3Score": 7.5
            },
            "ghsa": {
              "V3Score": 7.4
            }
          },
          "References": ["https://..."]
        }
      ]
    }
  ]
}
```

## Processing Steps

### 1. Parse Trivy JSON Output

Read the JSON file and validate structure:
- Check that `Results` array exists
- Filter to `Results[].Vulnerabilities[]` entries
- Skip if `Vulnerabilities` is empty or null

### 2. Filter by Severity

Keep only `Severity == "HIGH"` or `Severity == "CRITICAL"`.

### 3. Extract CVSS Score

CVSS scores are nested under the `CVSS` object with multiple sources. Extract in priority:

```python
def get_cvss_score(vuln):
    cvss = vuln.get("CVSS", {})

    # Priority: NVD > GHSA > RedHat
    if "nvd" in cvss and "V3Score" in cvss["nvd"]:
        return cvss["nvd"]["V3Score"]
    if "ghsa" in cvss and "V3Score" in cvss["ghsa"]:
        return cvss["ghsa"]["V3Score"]
    if "redhat" in cvss and "V3Score" in cvss["redhat"]:
        return cvss["redhat"]["V3Score"]

    return None  # Mark as N/A if missing
```

### 4. Extract Fixed Version

```python
fixed = vuln.get("FixedVersion", "")
fixed_version = fixed if fixed else "N/A"
```

### 5. Extract Reference URL

Take the first valid HTTP/HTTPS URL from the References array:

```python
references = vuln.get("References", [])
url = next((ref for ref in references if ref.startswith("http")), "N/A")
```

### 6. Build Output Record

Map each vulnerability to:

```python
record = {
    "Package": vuln["PkgName"],
    "Version": vuln["InstalledVersion"],
    "CVE_ID": vuln["VulnerabilityID"],
    "Severity": vuln["Severity"],
    "CVSS_Score": cvss_score if cvss_score else "N/A",
    "Fixed_Version": fixed_version,
    "Title": vuln.get("Title", vuln.get("Description", "N/A")),
    "Url": url
}
```

### 7. Deduplication

If the same CVE appears multiple times (different packages), keep all entries. If the same package+CVE appears multiple times, keep first occurrence.

## Validation Checks

- **CVE_ID format**: Should match `CVE-\d{4}-\d{4,}` pattern
- **Severity**: Must be "HIGH" or "CRITICAL"
- **CVSS_Score**: Should be numeric 0-10 or "N/A"
- **Version fields**: Non-empty strings
- **Title length**: Use first 200 chars if exceeds limit

## Python Implementation Pattern

```python
import json

def process_vulnerabilities(json_file):
    with open(json_file, 'r') as f:
        data = json.load(f)

    records = []
    for result in data.get("Results", []):
        for vuln in result.get("Vulnerabilities", []):
            if vuln["Severity"] not in ["HIGH", "CRITICAL"]:
                continue

            # Extract fields (use helper functions above)
            record = {
                "Package": vuln["PkgName"],
                "Version": vuln["InstalledVersion"],
                "CVE_ID": vuln["VulnerabilityID"],
                "Severity": vuln["Severity"],
                "CVSS_Score": get_cvss_score(vuln),
                "Fixed_Version": vuln.get("FixedVersion") or "N/A",
                "Title": vuln.get("Title", ""),
                "Url": get_first_url(vuln.get("References", []))
            }
            records.append(record)

    return records
```

## Common Field Transformations

| Source Field | Target Field | Transformation |
|--------------|--------------|-----------------|
| VulnerabilityID | CVE_ID | Use as-is |
| PkgName | Package | Use as-is |
| InstalledVersion | Version | Use as-is |
| FixedVersion | Fixed_Version | Empty → "N/A" |
| Severity | Severity | Use as-is (pre-filtered) |
| CVSS.*.V3Score | CVSS_Score | Select first available, fallback "N/A" |
| Title/Description | Title | Prefer Title, fallback to Description |
| References[0] | Url | Extract first HTTP URL, fallback "N/A" |

## Error Handling

- **Invalid JSON**: Log error and exit — file must be valid JSON
- **Missing fields**: Use "N/A" as fallback
- **Empty results**: Return empty list (no vulnerabilities found)
- **Malformed severity**: Log warning and skip record

## Output

Returns list of dictionaries ready for CSV export:
```python
[
    {
        "Package": "express",
        "Version": "4.17.1",
        "CVE_ID": "CVE-2022-12345",
        "Severity": "HIGH",
        "CVSS_Score": 7.5,
        "Fixed_Version": "4.17.2",
        "Title": "Vulnerability in express",
        "Url": "https://nvd.nist.gov/vuln/detail/CVE-2022-12345"
    },
    ...
]
```

## Next Steps

Pass the processed records to the CSV export skill for final report generation.

Versions

The database has no other skills named vulnerability-data-processing.

Database snapshot: 13.11.2026 · package version a94de78d49cf (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100npm-vulnerability-scanning
    Scan npm package-lock.json files for vulnerabilities using Trivy in offline mode. Extracts HIGH and CRITICAL severity vulnerabilities with detailed metadata (CVE, CVSS, fix versions). Use this skill whenever you need to audit npm dependencies for security issues, especially when…
  • 100cvss-score-extraction
    Extract CVSS (Common Vulnerability Scoring System) scores from Trivy vulnerability JSON output with proper fallback handling across multiple score sources (NVD, GHSA, RedHat). Use this skill whenever processing vulnerability scan results that require numeric severity scores,…
  • 100nvd-cve
    Search the National Vulnerability Database for CVEs - find vulnerabilities by keyword or ID, get CVSS scores, weaknesses, affected configurations, and remediation references. Use when looking up a CVE, scanning for vulnerabilities, running a security audit, or checking if a…
  • 100cvss-scoring
    Produces CVSS v4.0 vector strings from plain-text vulnerability descriptions by systematically evaluating base metrics. Use when scoring a vulnerability, generating a CVSS vector, or estimating severity.
  • 100cvss-v31-v40-scoring-and-vector-calculation
    Use this skill when calculate accurate CVSS v3.1 and v4.0 vulnerability scores and vector strings.
  • 100implementing-epss-score-for-vulnerability-prioritization
    Queries FIRST's Exploit Prediction Scoring System (EPSS) API to fetch exploitation-probability and percentile scores for CVEs, then uses those scores to prioritize vulnerability remediation. Use when triaging or ranking a vulnerability backlog by real-world 30-day exploitation…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.