Dependency security scanning. Use when auditing npm packages for vulnerabilities.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill covers security scanning for npm dependencies.
Use this skill when:
DEFENSE IN DEPTH - Use multiple tools for security scanning. No single tool catches everything.
# Run audit
npm audit
# JSON output for parsing
npm audit --json
# Only high/critical
npm audit --audit-level=high
# Production dependencies only
npm audit --omit=dev
# Safe fixes (semver-compatible)
npm audit fix
# Force fixes (may have breaking changes)
npm audit fix --force
# Dry run
npm audit fix --dry-run
# vulnerabilities found
Severity: high
Package: example-package
Dependency of: my-dep
Path: my-dep > sub-dep > example-package
More info: https://npmjs.com/advisories/XXXXX
npm install -g snyk
snyk auth
# Test for vulnerabilities
snyk test
# Monitor project (continuous)
snyk monitor
# High severity only
snyk test --severity-threshold=high
# Specific package
snyk test --package-manager=npm
- name: Snyk Security Scan
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
npm install -g @socketsecurity/cli
# Scan for supply chain issues
npx @socketsecurity/cli scan
# Detailed report
npx @socketsecurity/cli report
| Level | Description | Action |
|---|---|---|
| Critical | RCE, data breach | Fix immediately |
| High | Privilege escalation | Fix within 24 hours |
| Moderate | DoS, info disclosure | Fix within 1 week |
| Low | Minor issues | Fix when convenient |
# Full audit
npm audit
# Check for outdated packages
npm outdated
For each vulnerability:
# Update specific package
npm update package-name
# Update to latest
npm install package-name@latest
# Replace package
npm uninstall vulnerable-package
npm install alternative-package
# Re-run audit
npm audit
# Run tests
npm test
# Verify package-lock.json
npm ci # Clean install from lock file
# Check for lock file modifications
git diff package-lock.json
npm ci in CI/CD# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
dev-dependencies:
dependency-type: "development"
{
"extends": ["config:base"],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch"],
"automerge": true
}
]
}
name: Security
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 0 * * *' # Daily
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: npm audit
run: npm audit --audit-level=high
- name: Snyk scan
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
npm audit fix
# or
npm update vulnerable-package
{
"overrides": {
"vulnerable-package": "2.0.0"
}
}
## Security Exceptions
### vulnerable-package@1.0.0
- **Vulnerability**: CVE-2024-XXXXX
- **Reason Accepted**: Only used in tests, not production
- **Review Date**: 2024-12-01
- **Assignee**: @developer