用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ForceInjection/domain-driven-design-skills --skill dependency-security命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | dependency-security |
| description | Dependency security scanning. Use when auditing npm packages for vulnerabilities. |
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