AGENT SKILL

trivy-offline-vulnerability-scanning

Scan a dependency lockfile with Trivy in **offline mode** using a pre-existing local vulnerability DB cache, producing a JSON report.

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 0
Forks
1

01 前言 Front Matter

name
trivy-offline-vulnerability-scanning
description
Scan a dependency lockfile with Trivy in **offline mode** using a pre-existing local vulnerability DB cache, producing a JSON report.

03 SKILL.md 正文

Steps

  1. Confirm the target file exists (e.g., /root/package-lock.json).
  2. Confirm Trivy is available and record its version (trivy --version) for audit traceability.
  3. Choose a Trivy cache directory (e.g., /root/trivy-cache or the default Trivy cache) and verify the DB already exists at <cache-dir>/db/trivy.db and has metadata.json.
    • If the DB is missing, stop and require a pre-seeded offline DB to be provided/available locally (do not download during the audit run).
  4. Run the scan against the lockfile using offline flags and JSON output:
    • trivy fs /root/package-lock.json --scanners vuln --format json --output /root/trivy_report.json --skip-db-update --offline-scan --cache-dir <cache-dir>
  5. Verify /root/trivy_report.json was created and contains Results[].Vulnerabilities[] entries (or confirm it is empty if no vulns).

Expected Result

A machine-readable JSON vulnerability report is created (e.g., /root/trivy_report.json) without performing any network DB download/update during execution.

04 同仓库更多 Skills