依赖安全审计

CVE严重性级别(CVSS v3)

严重程度CVSS Score处理方式
Critical9.0 – 10.0立即修补(当天)
High7.0 – 8.91周内修补
Medium4.0 – 6.91个月内修补
Low0.1 – 3.9下次发布时修补

npm / Node.js

# Run security audit
npm audit

# Auto-fix safe updates
npm audit fix

# Fix including breaking changes (test first!)
npm audit fix --force

# JSON output for CI integration
npm audit --json | jq '.vulnerabilities'

# Check specific package
npm audit --package-lock-only

Go / Python / Java

# Go: check for known vulnerable modules
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...

# Python: safety check
pip install safety
safety check --full-report

# Java: OWASP Dependency Check
mvn org.owasp:dependency-check-maven:check

# GitHub Dependabot (all languages)
# Add .github/dependabot.yml:
version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule: { interval: "weekly" }

Snyk集成

# Install Snyk CLI
npm install -g snyk

# Authenticate
snyk auth

# Test for vulnerabilities
snyk test

# Monitor continuously
snyk monitor

# Fix automatically
snyk fix

# CI/CD (fail build on high severity)
snyk test --severity-threshold=high

依赖审计策略