SCA 軟體組成分析
Vibe Prompt
「幫我在 GitHub Actions 中加入 Snyk 掃描,檢查 npm 套件的已知漏洞。」
Snyk 掃描
- name: Snyk Scan
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
Dependabot(GitHub 內建)
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
labels:
- "security"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
漏洞嚴重性
| 等級 | CVSS 分數 | 行動 | |------|----------|------| | Critical | 9.0-10.0 | 立即更新 | | High | 7.0-8.9 | 24 小時內更新 | | Medium | 4.0-6.9 | 7 天內更新 | | Low | 0.1-3.9 | 下次更新 |
npm audit
npm audit # 檢查漏洞
npm audit fix # 自動修復
npm audit fix --force # 強制修復(可能破壞相容性)