Software dependency audit

From XuShuwenn/RedAct · View interactive version

Software dependency audit is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Perform security audits on package-lock.json files to identify and report HIGH/CRITICAL severity vulnerabilities in CSV format.

How to use this skill

Skill file

Software Dependency Audit

When to Use

Execution Protocol

Execution Protocol

Key Steps

  1. Read /root/package-lock.json for dependency tree

1a. Before scanning, confirm the chosen offline scanner is usable in the current environment: verify the binary exists and, when applicable, that any required local vulnerability DB/cache is present so the scan can complete without network access and setup/download logs are not mistaken for finished results.

1b. Prefer machine-readable scan output written under /root/... so findings can be filtered and mapped reliably into the required CSV schema.

  1. Scan for vulnerabilities using offline tools (trivy, npm audit)

2a. In restricted/offline environments, first check for a local scanner cache/database and prefer offline scan flags when cached data is available; for example, use options such as --skip-db-update and --offline-scan when supported.

2b. Prefer a two-stage workflow: save a full machine-readable scan artifact (for example JSON under /root/...) first, then transform that saved artifact into the final CSV with a short script rather than extracting fields from terminal text.

2c. Before writing extraction logic, inspect the actual saved scan output structure/schema and confirm the field names/nesting you will map.

2d. After the scan completes, confirm the saved structured artifact is valid, non-empty, and readable before parsing it.

2e. Before counting or reporting findings, fully enumerate the scanner results; if output is large, page through the complete vulnerability list or parse the JSON with tools such as jq or Python until no entries remain.

2f. Do not infer missing findings from truncated snippets, partial previews, or terminal summaries.

2g. Ground every CSV row in allowed offline scanner output; do not use memory, internet lookups, hand-built GHSA↔CVE mappings, or manual version-range reasoning to fill vulnerability metadata.

2h. Keep the raw structured scan artifact as the source of truth until CSV validation is complete.

  1. Filter for HIGH and CRITICAL severity only

3a. Apply the severity filter immediately after parsing the scanner results so counting, extraction, and CSV writing all operate only on in-scope HIGH/CRITICAL findings.

  1. Extract: Package, Version, CVE_ID, Severity, CVSS_Score, Fixed_Version, Title, Url

4a. If the scanner output does not already match the required schema, use a small normalization script to convert the structured report into the exact CSV columns with deterministic field ordering and N/A fallbacks instead of reshaping terminal text manually.

4b. Apply explicit metadata fallbacks when fields are incomplete: prefer NVD v3 CVSS, then GHSA v3, then Red Hat v3, then other available scanner-provided scores; prefer advisory Title then Description-like text; prefer the primary advisory URL then a reference URL.

  1. Write CSV to /root/security_audit.csv
  2. If you create intermediate artifacts, keep them in allowed task directories (prefer /root/...), not /tmp or other unapproved paths.
  3. Before parsing scan output or declaring success, confirm the scanner actually finished successfully; do not treat DB-download, progress, or initialization logs as a completed scan.

7a. Verify completion with concrete evidence such as a zero exit status and a finished, readable output artifact; if you only see startup, download, or progress logs, wait, rerun, or inspect further before continuing.

7b. If an expected scan output file is missing, empty, unreadable, or contains only startup/progress output, treat that as scan failure and fix/rerun the scan instead of inferring results.

  1. Preserve the task's requested audit scope; do not silently broaden or narrow coverage such as including or excluding dev dependencies unless the task says to.
  2. Re-open /root/security_audit.csv before finishing and verify end-to-end by parsing the full file, not just a preview: confirm the header is exactly Package,Version,CVE_ID,Severity,CVSS_Score,Fixed_Version,Title,Url, every row has all 8 fields populated with a real value or N/A, and no rows are truncated or malformed.
  3. Reconcile the number of HIGH/CRITICAL findings with the number of CSV data rows; if counts differ or any preview is partial, inspect the source scan data and regenerate/fix the CSV before reporting completion.

10a. When validating row counts, count actual CSV data rows with a parser or another structured method that accounts for the header; do not rely on terminal previews or stdout summaries.

10b. If you regenerate, overwrite, or post-process the CSV at any later step, repeat the full end-to-end validation on that final file version.

10c. In the final response, mention counts or specific vulnerabilities only if they were directly confirmed from the fully validated CSV or the fully inspected offline scan artifact used to build it.

  1. Confirm Version is the installed version from package-lock.json and CVE_ID is a real CVE-... value or N/A.

11a. Immediately before finishing, perform a final protocol check: verify both the tool-call format used during execution and the exact required final response string match the task/environment instructions.

  1. If the task specifies an exact completion marker or final response format, output it verbatim as the final response.

CSV Output Format

Columns: Package,Version,CVE_ID,Severity,CVSS_Score,Fixed_Version,Title,Url

Common Patterns

Tips

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.