Vulnerability csv reporting
Generate structured CSV security audit reports from vulnerability data with proper filtering and formatting. This skill covers CSV schema design for security reports, using Python csv.DictWriter, severity-based filtering, and field mapping from JSON to tabular format.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill vulnerability-csv-reportingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
2.7 KB, 582 tokens by cl100k_base, as published. Nobody here has run it
Vulnerability CSV Report Generation
Generate CSV security audit reports from Trivy JSON output with severity filtering.
CSV Schema
| Column | Type | Description | Example |
|---|---|---|---|
| Package | String | Vulnerable package name | express |
| Version | String | Installed version | 4.17.1 |
| CVE_ID | String | Vulnerability identifier | CVE-2022-24999 |
| Severity | Enum | Risk level (CRITICAL/HIGH) | CRITICAL |
| CVSS_Score | Float/String | Numeric score or N/A | 9.8 |
| Fixed_Version | String | Patched version or N/A | 4.18.0 |
| Title | String | Vulnerability description | XSS in Express.js |
| Url | String | Reference link | https://avd.aquasec.com/... |
Python Implementation
import json
import csv
def generate_vulnerability_csv(json_input, csv_output, severity_filter=['HIGH', 'CRITICAL']):
with open(json_input, 'r', encoding='utf-8') as f:
data = json.load(f)
vulnerabilities = []
if 'Results' in data:
for result in data['Results']:
for vuln in result.get('Vulnerabilities', []):
severity = vuln.get('Severity', 'UNKNOWN')
if severity in severity_filter:
vulnerabilities.append({
"Package": vuln.get('PkgName', 'N/A'),
"Version": vuln.get('InstalledVersion', 'N/A'),
"CVE_ID": vuln.get('VulnerabilityID', 'N/A'),
"Severity": severity,
"CVSS_Score": get_cvss_score(vuln),
"Fixed_Version": vuln.get('FixedVersion') or 'N/A',
"Title": vuln.get('Title') or 'No description',
"Url": vuln.get('PrimaryURL', '')
})
headers = ["Package", "Version", "CVE_ID", "Severity",
"CVSS_Score", "Fixed_Version", "Title", "Url"]
with open(csv_output, 'w', newline='', encoding='utf-8') as f:
writer = csv.DictWriter(f, fieldnames=headers)
writer.writeheader()
writer.writerows(vulnerabilities)
return len(vulnerabilities)
Best Practices
- Always use
newline=''andencoding='utf-8'when opening CSV files - Use
N/Afor missing data — never leave fields empty - Use
csv.DictWriterfor readable, maintainable code - Validate that FixedVersion is not None before writing
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.