Dependency Audit
You are a senior security and platform engineer performing a thorough audit of project dependencies. Identify risks, vulnerabilities, licensing issues, and maintenance concerns, then provide prioritized upgrade recommendations.
Process
Step 1: Identify the Ecosystem and Manifest
Determine:
- What language/ecosystem? (Node.js, Python, Go, Rust, Java, Ruby, .NET)
- Where is the dependency manifest? (package.json, requirements.txt, go.mod, Cargo.toml, pom.xml, Gemfile)
- Is there a lockfile? (package-lock.json, yarn.lock, poetry.lock, Cargo.lock, go.sum)
- Are there multiple dependency manifests (monorepo)?
- What is the deployment target? (serverless, containers, edge — affects size sensitivity)
Manifest file reference:
| Ecosystem |
Manifest |
Lockfile |
Audit Tool |
| Node.js (npm) |
package.json |
package-lock.json |
npm audit |
| Node.js (yarn) |
package.json |
yarn.lock |
yarn audit |
| Node.js (pnpm) |
package.json |
pnpm-lock.yaml |
pnpm audit |
| Python (pip) |
requirements.txt |
N/A |
pip-audit, safety |
| Python (poetry) |
pyproject.toml |
poetry.lock |
pip-audit, safety |
| Go |
go.mod |
go.sum |
govulncheck |
| Rust |
Cargo.toml |
Cargo.lock |
cargo audit |
| Java (Maven) |
pom.xml |
N/A |
mvn dependency-check:check |
| Java (Gradle) |
build.gradle |
N/A |
OWASP dependency-check plugin |
| Ruby |
Gemfile |
Gemfile.lock |
bundle audit |
| .NET |
*.csproj |
packages.lock.json |
dotnet list package --vulnerable |
Step 2: Version Currency Assessment
For each dependency, evaluate how current it is:
Currency classification:
| Status |
Definition |
Risk |
Action |
| Current |
On latest stable version |
None |
No action needed |
| Minor behind |
1-2 minor versions behind latest |
Low |
Upgrade at convenience |
| Major behind |
1+ major versions behind latest |
Medium |
Plan upgrade, check breaking changes |
| Severely outdated |
2+ major versions behind or >2 years stale |
High |
Prioritize upgrade, check for EOL |
| End of Life (EOL) |
No longer maintained or receiving security patches |
Critical |
Upgrade or replace immediately |
Generate a currency report table:
| Package |
Current Version |
Latest Version |
Versions Behind |
Last Published |
Status |
| package-name |
installed |
latest |
count |
date |
Current / Minor behind / Major behind / EOL |
Step 3: Vulnerability Scan (CVEs)
Check all dependencies against known vulnerability databases:
Vulnerability databases to check:
- National Vulnerability Database (NVD)
- GitHub Advisory Database (GHSA)
- OSV (Open Source Vulnerability database)
- Snyk Vulnerability DB
- RustSec Advisory Database (Rust)
- PyPI Advisory Database (Python)
Severity classification (CVSS):
| Severity |
CVSS Score |
SLA to Patch |
Example |
| Critical |
9.0 - 10.0 |
24-48 hours |
Remote code execution, auth bypass |
| High |
7.0 - 8.9 |
1 week |
Privilege escalation, data exposure |
| Medium |
4.0 - 6.9 |
1 month |
Denial of service, information disclosure |
| Low |
0.1 - 3.9 |
Next release cycle |
Minor information leak, theoretical attack |
Generate a vulnerability report table:
| Package |
Version |
CVE ID |
Severity |
CVSS |
Description |
Fixed In |
Exploitable |
| name |
ver |
CVE-XXXX-XXXXX |
Critical/High/Medium/Low |
score |
brief description |
version |
Yes / No / Unknown |
Step 4: License Compliance
Audit every dependency's license for compatibility with your project:
License risk classification:
| Risk Level |
Licenses |
Concern |
| Permissive (safe) |
MIT, BSD-2, BSD-3, ISC, Apache-2.0, Unlicense |
No restrictions on commercial use |
| Weak copyleft (caution) |
LGPL-2.1, LGPL-3.0, MPL-2.0, EPL-2.0 |
Modifications to the library must be open-sourced; your code is safe if dynamically linked |
| Strong copyleft (risk) |
GPL-2.0, GPL-3.0, AGPL-3.0 |
Your entire project may need to be open-sourced if you distribute it |
| No license |
N/A |
Legally ambiguous; all rights reserved by default. Avoid or seek explicit permission |
| Custom / Unknown |
Various |
Requires legal review before use |
License audit checklist:
Generate a license report table:
| Package |
Version |
License |
Risk Level |
Compatible |
Notes |
| name |
ver |
SPDX ID |
Permissive / Weak copyleft / Strong copyleft / None |
Yes / No / Review |
any notes |
Step 5: Unused and Redundant Dependencies
Identify dependencies that can be removed:
Detection methods:
| Method |
Tool |
Ecosystem |
| Static analysis |
depcheck |
Node.js |
| Static analysis |
deptry |
Python |
| Import scanning |
unused |
Go |
| Dead code analysis |
cargo-udeps |
Rust |
| Manual review |
grep for import/require statements |
Any |
Categories of removable dependencies:
Step 6: Size Impact Analysis
Evaluate the bundle and install size impact of dependencies:
Size metrics to evaluate:
| Metric |
Description |
Tool |
| Install size |
Total disk space after install |
npm pack --dry-run, du -sh node_modules/pkg |
| Bundle size (minified) |
Size after bundling and minification |
bundlephobia.com, size-limit |
| Bundle size (gzipped) |
Size after compression (actual transfer size) |
bundlephobia.com, size-limit |
| Tree-shakeable |
Can unused exports be eliminated |
Check for ESM support, sideEffects: false |
| Dependency count |
Number of transitive dependencies pulled in |
npm ls --all, pipdeptree |
Size concern thresholds (frontend/browser context):
| Concern Level |
Single Package (gzip) |
Total Bundle (gzip) |
| Acceptable |
< 10 KB |
< 200 KB |
| Review |
10-50 KB |
200-500 KB |
| Concerning |
50-100 KB |
500 KB - 1 MB |
| Excessive |
> 100 KB |
> 1 MB |
Generate a size impact table (for top offenders):
| Package |
Install Size |
Bundle Size (gzip) |
Transitive Deps |
Tree-Shakeable |
Lighter Alternative |
| name |
size |
size |
count |
Yes / No |
alternative or N/A |
Output Format
Present the audit as:
## Dependency Audit: {Project Name}
### Summary
- Total dependencies: [count] (production: [N], development: [N])
- Vulnerabilities: [N critical, N high, N medium, N low]
- Outdated packages: [N severely outdated, N major behind, N minor behind]
- License issues: [N packages require review]
- Unused dependencies: [N packages can be removed]
- Estimated removable size: [size]
### Critical Actions (do immediately)
1. [Vulnerability fix or EOL replacement]
2. ...
### High Priority (this sprint)
1. [Major version upgrades, license issues]
2. ...
### Medium Priority (this quarter)
1. [Minor upgrades, unused dependency removal]
2. ...
### Low Priority (backlog)
1. [Nice-to-have optimizations]
2. ...
### Detailed Reports
- Version currency table
- Vulnerability table
- License compliance table
- Unused dependencies list
- Size impact analysis
Quality Checklist
Before delivering the audit report, verify:
Edge Cases
Consider and address these scenarios:
- Monorepos — Audit each workspace/package independently. Shared dependencies may have version conflicts across workspaces. Use tools that support workspace-aware scanning.
- Private/internal packages — Internal packages won't appear in public vulnerability databases. Flag them separately and recommend internal security review.
- Pinned versions — If the project pins exact versions (no ranges), check whether the pin is intentional (stability) or accidental (stale lockfile).
- Forked dependencies — If the project uses a fork, the fork may not receive upstream security patches. Track the upstream version and compare.
- Optional/peer dependencies — These may not be installed in all environments. Audit them based on which optional features are actually used.
- Build-time only dependencies — Webpack plugins, Babel presets, and similar build tools still pose supply chain risk even though they don't ship to production. Include them in vulnerability scans.
- Transitive vulnerability with no direct upgrade path — When a vulnerability exists in a transitive dependency and the direct dependency hasn't released a fix, document the workaround (override/resolution, fork, or replace the parent package).
- License changes between versions — A package may change its license in a new version. Verify the license of the specific installed version, not just the latest.
- Typosquatting and supply chain attacks — Check for packages with suspicious names similar to popular packages. Verify package provenance and publisher reputation.
- Native/binary dependencies — Packages with native bindings (node-gyp, Cython extensions) introduce platform-specific risks and may require separate security review.
1---2name: dependency-audit3description: Audit project dependencies — version currency, known vulnerabilities (CVEs), license compliance, unused dependencies, size impact, and upgrade recommendations. TRIGGER when: user says /dependency-audit, asks to audit dependencies, check for vulnerabilities, review package health, or assess dependency risk.4---56# Dependency Audit78You are a senior security and platform engineer performing a thorough audit of project dependencies. Identify risks, vulnerabilities, licensing issues, and maintenance concerns, then provide prioritized upgrade recommendations.910## Process1112### Step 1: Identify the Ecosystem and Manifest1314Determine:15- What language/ecosystem? (Node.js, Python, Go, Rust, Java, Ruby, .NET)16- Where is the dependency manifest? (package.json, requirements.txt, go.mod, Cargo.toml, pom.xml, Gemfile)17- Is there a lockfile? (package-lock.json, yarn.lock, poetry.lock, Cargo.lock, go.sum)18- Are there multiple dependency manifests (monorepo)?19- What is the deployment target? (serverless, containers, edge — affects size sensitivity)2021**Manifest file reference:**2223| Ecosystem | Manifest | Lockfile | Audit Tool |24|-----------|----------|----------|------------|25| Node.js (npm) | package.json | package-lock.json | `npm audit` |26| Node.js (yarn) | package.json | yarn.lock | `yarn audit` |27| Node.js (pnpm) | package.json | pnpm-lock.yaml | `pnpm audit` |28| Python (pip) | requirements.txt | N/A | `pip-audit`, `safety` |29| Python (poetry) | pyproject.toml | poetry.lock | `pip-audit`, `safety` |30| Go | go.mod | go.sum | `govulncheck` |31| Rust | Cargo.toml | Cargo.lock | `cargo audit` |32| Java (Maven) | pom.xml | N/A | `mvn dependency-check:check` |33| Java (Gradle) | build.gradle | N/A | OWASP dependency-check plugin |34| Ruby | Gemfile | Gemfile.lock | `bundle audit` |35| .NET | *.csproj | packages.lock.json | `dotnet list package --vulnerable` |3637### Step 2: Version Currency Assessment3839For each dependency, evaluate how current it is:4041**Currency classification:**4243| Status | Definition | Risk | Action |44|--------|-----------|------|--------|45| Current | On latest stable version | None | No action needed |46| Minor behind | 1-2 minor versions behind latest | Low | Upgrade at convenience |47| Major behind | 1+ major versions behind latest | Medium | Plan upgrade, check breaking changes |48| Severely outdated | 2+ major versions behind or >2 years stale | High | Prioritize upgrade, check for EOL |49| End of Life (EOL) | No longer maintained or receiving security patches | Critical | Upgrade or replace immediately |5051**Generate a currency report table:**5253| Package | Current Version | Latest Version | Versions Behind | Last Published | Status |54|---------|----------------|----------------|----------------|----------------|--------|55| *package-name* | *installed* | *latest* | *count* | *date* | Current / Minor behind / Major behind / EOL |5657### Step 3: Vulnerability Scan (CVEs)5859Check all dependencies against known vulnerability databases:6061**Vulnerability databases to check:**62- National Vulnerability Database (NVD)63- GitHub Advisory Database (GHSA)64- OSV (Open Source Vulnerability database)65- Snyk Vulnerability DB66- RustSec Advisory Database (Rust)67- PyPI Advisory Database (Python)6869**Severity classification (CVSS):**7071| Severity | CVSS Score | SLA to Patch | Example |72|----------|-----------|-------------|---------|73| Critical | 9.0 - 10.0 | 24-48 hours | Remote code execution, auth bypass |74| High | 7.0 - 8.9 | 1 week | Privilege escalation, data exposure |75| Medium | 4.0 - 6.9 | 1 month | Denial of service, information disclosure |76| Low | 0.1 - 3.9 | Next release cycle | Minor information leak, theoretical attack |7778**Generate a vulnerability report table:**7980| Package | Version | CVE ID | Severity | CVSS | Description | Fixed In | Exploitable |81|---------|---------|--------|----------|------|-------------|----------|-------------|82| *name* | *ver* | *CVE-XXXX-XXXXX* | Critical/High/Medium/Low | *score* | *brief description* | *version* | Yes / No / Unknown |8384### Step 4: License Compliance8586Audit every dependency's license for compatibility with your project:8788**License risk classification:**8990| Risk Level | Licenses | Concern |91|------------|----------|---------|92| Permissive (safe) | MIT, BSD-2, BSD-3, ISC, Apache-2.0, Unlicense | No restrictions on commercial use |93| Weak copyleft (caution) | LGPL-2.1, LGPL-3.0, MPL-2.0, EPL-2.0 | Modifications to the library must be open-sourced; your code is safe if dynamically linked |94| Strong copyleft (risk) | GPL-2.0, GPL-3.0, AGPL-3.0 | Your entire project may need to be open-sourced if you distribute it |95| No license | N/A | Legally ambiguous; all rights reserved by default. Avoid or seek explicit permission |96| Custom / Unknown | Various | Requires legal review before use |9798**License audit checklist:**99- [ ] Every dependency has a declared license100- [ ] No GPL/AGPL dependencies in proprietary/closed-source projects101- [ ] LGPL dependencies are dynamically linked (not statically bundled)102- [ ] License obligations (attribution, notice files) are met in distribution103- [ ] Transitive dependencies (dependencies of dependencies) are also checked104- [ ] Company-specific banned license list has been consulted105106**Generate a license report table:**107108| Package | Version | License | Risk Level | Compatible | Notes |109|---------|---------|---------|------------|------------|-------|110| *name* | *ver* | *SPDX ID* | Permissive / Weak copyleft / Strong copyleft / None | Yes / No / Review | *any notes* |111112### Step 5: Unused and Redundant Dependencies113114Identify dependencies that can be removed:115116**Detection methods:**117118| Method | Tool | Ecosystem |119|--------|------|-----------|120| Static analysis | `depcheck` | Node.js |121| Static analysis | `deptry` | Python |122| Import scanning | `unused` | Go |123| Dead code analysis | `cargo-udeps` | Rust |124| Manual review | grep for import/require statements | Any |125126**Categories of removable dependencies:**127- [ ] **Unused** — Declared but never imported or referenced in code128- [ ] **Redundant** — Multiple packages providing the same functionality (e.g., `lodash` + `underscore`)129- [ ] **Built-in replacements** — Packages that duplicate standard library functionality (e.g., `is-even`, `left-pad`, `path-is-absolute`)130- [ ] **Dev-in-prod** — Development-only dependencies incorrectly listed as production dependencies131- [ ] **Transitive duplicates** — Multiple versions of the same package in the dependency tree132133### Step 6: Size Impact Analysis134135Evaluate the bundle and install size impact of dependencies:136137**Size metrics to evaluate:**138139| Metric | Description | Tool |140|--------|-------------|------|141| Install size | Total disk space after install | `npm pack --dry-run`, `du -sh node_modules/pkg` |142| Bundle size (minified) | Size after bundling and minification | bundlephobia.com, `size-limit` |143| Bundle size (gzipped) | Size after compression (actual transfer size) | bundlephobia.com, `size-limit` |144| Tree-shakeable | Can unused exports be eliminated | Check for ESM support, `sideEffects: false` |145| Dependency count | Number of transitive dependencies pulled in | `npm ls --all`, `pipdeptree` |146147**Size concern thresholds (frontend/browser context):**148149| Concern Level | Single Package (gzip) | Total Bundle (gzip) |150|---------------|----------------------|---------------------|151| Acceptable | < 10 KB | < 200 KB |152| Review | 10-50 KB | 200-500 KB |153| Concerning | 50-100 KB | 500 KB - 1 MB |154| Excessive | > 100 KB | > 1 MB |155156**Generate a size impact table (for top offenders):**157158| Package | Install Size | Bundle Size (gzip) | Transitive Deps | Tree-Shakeable | Lighter Alternative |159|---------|-------------|-------------------|-----------------|----------------|-------------------|160| *name* | *size* | *size* | *count* | Yes / No | *alternative or N/A* |161162## Output Format163164Present the audit as:165166```167## Dependency Audit: {Project Name}168169### Summary170- Total dependencies: [count] (production: [N], development: [N])171- Vulnerabilities: [N critical, N high, N medium, N low]172- Outdated packages: [N severely outdated, N major behind, N minor behind]173- License issues: [N packages require review]174- Unused dependencies: [N packages can be removed]175- Estimated removable size: [size]176177### Critical Actions (do immediately)1781. [Vulnerability fix or EOL replacement]1792. ...180181### High Priority (this sprint)1821. [Major version upgrades, license issues]1832. ...184185### Medium Priority (this quarter)1861. [Minor upgrades, unused dependency removal]1872. ...188189### Low Priority (backlog)1901. [Nice-to-have optimizations]1912. ...192193### Detailed Reports194- Version currency table195- Vulnerability table196- License compliance table197- Unused dependencies list198- Size impact analysis199```200201## Quality Checklist202203Before delivering the audit report, verify:204205- [ ] Every production dependency has been checked for vulnerabilities206- [ ] Transitive dependencies are included in the vulnerability scan (not just direct)207- [ ] Version currency is assessed against the latest stable release (not pre-release)208- [ ] License check covers transitive dependencies, not just direct209- [ ] Unused dependency analysis has been validated (no false positives that would break the build)210- [ ] Size analysis is relevant to the deployment context (skip for backend-only projects)211- [ ] Upgrade recommendations include specific target versions212- [ ] Breaking changes in recommended upgrades are documented213- [ ] Critical vulnerabilities have clear, actionable remediation steps214- [ ] The report distinguishes between production and development dependencies215216## Edge Cases217218Consider and address these scenarios:219220- **Monorepos** — Audit each workspace/package independently. Shared dependencies may have version conflicts across workspaces. Use tools that support workspace-aware scanning.221- **Private/internal packages** — Internal packages won't appear in public vulnerability databases. Flag them separately and recommend internal security review.222- **Pinned versions** — If the project pins exact versions (no ranges), check whether the pin is intentional (stability) or accidental (stale lockfile).223- **Forked dependencies** — If the project uses a fork, the fork may not receive upstream security patches. Track the upstream version and compare.224- **Optional/peer dependencies** — These may not be installed in all environments. Audit them based on which optional features are actually used.225- **Build-time only dependencies** — Webpack plugins, Babel presets, and similar build tools still pose supply chain risk even though they don't ship to production. Include them in vulnerability scans.226- **Transitive vulnerability with no direct upgrade path** — When a vulnerability exists in a transitive dependency and the direct dependency hasn't released a fix, document the workaround (override/resolution, fork, or replace the parent package).227- **License changes between versions** — A package may change its license in a new version. Verify the license of the specific installed version, not just the latest.228- **Typosquatting and supply chain attacks** — Check for packages with suspicious names similar to popular packages. Verify package provenance and publisher reputation.229- **Native/binary dependencies** — Packages with native bindings (node-gyp, Cython extensions) introduce platform-specific risks and may require separate security review.