Quick Start
This guide will walk you through scanning your first project for vulnerabilities.
Installation
Section titled “Installation”First, install the tool globally:
npm install -g who-touched-my-packagesOr use it directly with npx:
npx who-touched-my-packagesBasic Usage
Section titled “Basic Usage”Scan Current Directory
Section titled “Scan Current Directory”Navigate to your project and run:
wtmpThe tool will:
- Recursively find all
package.jsonandrequirements.txtfiles - Parse the dependencies
- Query OSV
- Display a beautiful report
Example: Scanning a Node.js Project
Section titled “Example: Scanning a Node.js Project”cd ~/my-nodejs-appwtmpOutput:
┌ 🛡️ Who Touched My Packages?│ Scanning dependencies for vulnerabilities...│✔ Found 1 dependency file(s)
📄 Found 1 dependency file(s): 📦 package.json
✔ Parsed 45 package(s)
════════════════════════════════════════════════════════════🛡️ Security Audit Summary════════════════════════════════════════════════════════════
Scanned Packages: 45Total Vulnerabilities: 3
🔴 Critical: 1🟠 High: 2
════════════════════════════════════════════════════════════
📋 Vulnerability Details:
────────────────────────────────────────────────────────────
🔴 CRITICAL - CVE-2023-12345Package: lodash@4.17.20Title: Prototype Pollution in lodashCVSS Score: 9.8Affected: >=4.0.0 <4.17.21Fixed in: 4.17.21
Prototype pollution vulnerability in lodash...
References: • https://nvd.nist.gov/vuln/detail/CVE-2023-12345
Source: OSVCommand Line Options
Section titled “Command Line Options”Filter by Severity
Section titled “Filter by Severity”Only show high and critical vulnerabilities:
wtmp --severity HIGHScan Specific Directory
Section titled “Scan Specific Directory”wtmp --path /path/to/projectSave Report to File
Section titled “Save Report to File”Save JSON output to a file:
wtmp --json --output report.jsonQuiet Mode
Section titled “Quiet Mode”Suppress non-error output:
wtmp --quietDisable Colors
Section titled “Disable Colors”Disable colored terminal output:
wtmp --no-colorGit Clone Depth
Section titled “Git Clone Depth”Perform a shallow clone (useful for large repositories):
wtmp --repo https://github.com/user/repo --git-clone-depth 1Maximum Directory Depth
Section titled “Maximum Directory Depth”Limit how deep the scanner searches:
wtmp --max-depth 3HTML Report Without Opening Browser
Section titled “HTML Report Without Opening Browser”Generate HTML report but don’t auto-open:
wtmp --no-openScanning Remote Repositories
Section titled “Scanning Remote Repositories”You can scan any Git repository without cloning it manually. The tool will automatically clone it to a temporary directory, scan it, and clean up afterwards.
Scan a Repository
Section titled “Scan a Repository”wtmp --repo https://github.com/user/repositoryExample:
wtmp --repo https://github.com/expressjs/expressOutput:
✔ Repository cloned to /tmp/wtmp-abc123┌ 🛡️ Who Touched My Packages?│ Scanning dependencies for vulnerabilities...│✔ Found 1 dependency file(s)✔ Parsed 42 package(s)Scan a Specific Branch
Section titled “Scan a Specific Branch”To scan a specific branch or tag:
wtmp --repo https://github.com/user/repository --branch developExample:
wtmp --repo https://github.com/expressjs/express --branch 5.xCombine with Other Options
Section titled “Combine with Other Options”You can combine repository scanning with other options:
# Scan a repo and filter by severitywtmp --repo https://github.com/user/repo --severity HIGH
# Scan a repo with JSON outputwtmp --repo https://github.com/user/repo --json
# Scan a repo and fail on high vulnerabilitieswtmp --repo https://github.com/user/repo --fail-on HIGHUse Cases for Remote Scanning
Section titled “Use Cases for Remote Scanning”- Security audits - Quickly audit third-party dependencies before using a library
- Due diligence - Check dependencies of projects you’re considering adopting
- CI/CD - Scan repositories as part of your pipeline without checking them out
- Monitoring - Regularly scan important dependencies for new vulnerabilities
Exclude Directories
Section titled “Exclude Directories”Skip certain directories:
wtmp --exclude test fixtures examplesJSON Output
Section titled “JSON Output”Get machine-readable output:
wtmp --jsonOutput:
{ "summary": { "total": 3, "critical": 1, "high": 2, "medium": 0, "low": 0, "unknown": 0 }, "scannedPackages": 45, "timestamp": "2024-03-25T12:00:00.000Z", "vulnerabilities": [ { "id": "CVE-2023-12345", "packageName": "lodash", "packageVersion": "4.17.20", "ecosystem": "npm", "severity": "CRITICAL", "title": "Prototype Pollution in lodash", "cvss": 9.8, "affectedVersions": ">=4.0.0 <4.17.21", "fixedVersions": "4.17.21", "references": [...] } ]}Fail on Vulnerabilities (CI/CD)
Section titled “Fail on Vulnerabilities (CI/CD)”Exit with error code if vulnerabilities are found:
wtmp --fail-on HIGHThis will:
- Exit with code
0if no HIGH or CRITICAL vulnerabilities - Exit with code
1if HIGH or CRITICAL vulnerabilities found - Exit with code
2if an error occurred
Scanning Python Projects
Section titled “Scanning Python Projects”The tool automatically detects requirements.txt files:
cd ~/my-python-appwtmpOutput:
✔ Found 1 dependency file(s)
📄 Found 1 dependency file(s): 📄 requirements.txt
✔ Parsed 23 package(s)Scanning Monorepos
Section titled “Scanning Monorepos”For large monorepos, you might want to exclude certain directories:
wtmp --exclude node_modules dist build .venvYou can also scan remote monorepos:
wtmp --repo https://github.com/user/monorepo --exclude examples testThe tool automatically ignores common directories like:
node_modules.gitdistbuildvenv__pycache__
Environment Variables
Section titled “Environment Variables”GitHub Token (Optional)
Section titled “GitHub Token (Optional)”Set a GitHub personal access token for higher API rate limits:
export GITHUB_TOKEN=ghp_your_token_herewtmpWithout a token:
- 60 requests per hour
With a token:
- 5,000 requests per hour
Supply Chain Analysis API Keys (Optional)
Section titled “Supply Chain Analysis API Keys (Optional)”For supply chain security analysis, you need to set an API key for your chosen LLM provider:
# For Anthropic (default)export ANTHROPIC_API_KEY=sk-ant-your-key
# For OpenAIexport OPENAI_API_KEY=sk-your-key
# For OpenRouterexport OPENROUTER_API_KEY=sk-or-your-keyThen run with supply chain analysis:
wtmp --supply-chain