run2_npm-vulnerability-scanning-enhanced
Enhanced npm vulnerability scanning with Trivy supporting multiple severity levels and complete metadata extraction
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 92
- Forks
- 7
01 前言 Front Matter
- name
- run2_npm-vulnerability-scanning-enhanced
- description
- Enhanced npm vulnerability scanning with Trivy supporting multiple severity levels and complete metadata extraction
03 SKILL.md 正文
Enhanced npm Dependency Vulnerability Scanning
Purpose
Scan npm package-lock.json files for vulnerabilities using Trivy with complete metadata extraction, including severity sources, vendor data, and multiple reference URLs.
Key Improvements Over V1
- Multiple Severity Sources: Track severity from different vendors (GHSA, NVD, RedHat)
- Vendor-specific Scoring: Extract vendor severity codes for better analysis
- Multiple References: Capture all reference URLs, not just primary
- Data Enrichment: Include DataSource information for audit trail
- Timestamp Tracking: Record publication and modification dates
Installation & Setup
Prerequisites
- Trivy 0.40.0+ installed
- npm package-lock.json file
- Access to offline vulnerability database
Setup
# Install Trivy
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
# Verify installation
trivy --version
Scan Configuration
Command with Enhanced Metadata
trivy fs /root/package-lock.json \
--format json \
--output vulnerabilities.json \
--scanners vuln \
--skip-db-update \
--severity HIGH,CRITICAL
JSON Output Structure
Enhanced Trivy output includes:
{
"Results": [
{
"Target": "package-lock.json",
"Type": "npm",
"Vulnerabilities": [
{
"VulnerabilityID": "CVE-2022-25883",
"PkgName": "semver",
"InstalledVersion": "7.3.7",
"FixedVersion": "7.5.2, 6.3.1, 5.7.2",
"Severity": "HIGH",
"SeveritySource": "ghsa",
"VendorSeverity": {
"ghsa": 3,
"nvd": 7
},
"Title": "nodejs-semver: Regular expression denial of service",
"Description": "...",
"PrimaryURL": "https://avd.aquasec.com/nvd/cve-2022-25883",
"References": [
"https://nvd.nist.gov/vuln/detail/CVE-2022-25883",
"https://github.com/advisories/GHSA-c2qf-rxjj-qqgw"
],
"DataSource": {
"ID": "ghsa",
"Name": "GitHub Security Advisory npm"
},
"PublishedDate": "2022-11-16T14:15:00Z",
"LastModifiedDate": "2023-09-01T10:00:00Z"
}
]
}
]
}
Data Extraction Fields
For each vulnerability record:
| Field | Source | Notes |
|---|---|---|
VulnerabilityID |
Direct | Primary CVE ID (handle comma-separated) |
PkgName |
Direct | Package name (may include scope) |
InstalledVersion |
Direct | Exact installed version |
FixedVersion |
Direct | First fixed version (may have multiple) |
Severity |
Severity field |
HIGH or CRITICAL only |
SeveritySource |
Track source | ghsa, nvd, or other |
Title |
Direct | Vulnerability title |
PrimaryURL |
Direct | Primary reference URL |
| References | Direct | All reference URLs |
Severity Filtering
Valid Severities for This Audit
- HIGH
- CRITICAL
Severity Source Priority
- GHSA (GitHub) - Most recent data
- NVD (NIST) - Most authoritative
- RedHat - Vendor-specific
- Ubuntu - Ubuntu-specific
- Other sources - Use if available
Vendor Severity Codes
GHSA uses numeric severity codes:
- 0 = LOW
- 1 = MODERATE
- 2 = MEDIUM
- 3 = HIGH
- 4 = CRITICAL
NVD uses numeric CVSS scores (0.0-10.0)
Handling Edge Cases
Multiple CVE IDs
Some vulnerabilities may report multiple CVE IDs separated by commas:
"CVE-2023-XXXXX, CVE-2023-YYYYY"
Split and process each separately while maintaining package/version context.
Multiple Fixed Versions
When multiple branches are maintained:
"FixedVersion": "7.5.2, 6.3.1, 5.7.2"
Extract the first fixed version for the matched major version if possible.
Incomplete FixedVersion Data
Some vulnerabilities may not have fixes:
"FixedVersion": ""
Use "N/A" in reports.
Reference URL Priority
PrimaryURL: Use as primary referenceReferencesarray: Include if primary is missing- Construct NVD URL if needed:
https://nvd.nist.gov/vuln/detail/{CVE-ID}
Audit Trail Elements
Track for audit purposes:
- DataSource.ID: Which database provided the vulnerability info
- DataSource.Name: Human-readable database name
- PublishedDate: When the CVE was published
- LastModifiedDate: When the record was last updated
This enables tracking which vulnerabilities came from which sources and how current the data is.
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.