| name | dependency-security |
| description | Enforce dependency security scanning and SBOM generation. Use when adding dependencies, reviewing package.json, or during security audits. Covers OWASP dependency check, npm audit, and supply chain security. |
| allowed-tools | Read, Glob, Grep, Edit, Write, Bash |
| license | MIT |
| metadata | {"author":"antigravity-team","version":"1.0"} |
Dependency Security
의존성 보안 스캔 및 SBOM(Software Bill of Materials) 생성을 강제하는 스킬입니다.
2025 Context
OWASP Top 10 2025에서 "Vulnerable and Outdated Components"가 A03으로 상승
EU Cyber Resilience Act: 2024년부터 SBOM 의무화 시작
Supply Chain 공격 급증: 2024년 대비 300% 증가
Core Rules
| 규칙 | 상태 | 설명 |
|---|
| npm audit 통과 | 🔴 필수 | high/critical 취약점 0개 |
| 의존성 최신화 | 🟡 권장 | 주요 보안 패치 적용 |
| SBOM 생성 | 🟡 권장 | 의존성 목록 문서화 |
| lockfile 커밋 | 🔴 필수 | 재현 가능한 빌드 |
Security Audit
npm audit
npm audit
npm audit fix
npm audit fix --force
npm audit --json
결과 해석
Severity levels:
- critical: 🔴 즉시 수정 필수
- high: 🔴 즉시 수정 필수
- moderate: 🟡 조속히 수정
- low: 🟢 다음 업데이트 시 수정
CI 통합 예시
- name: Security Audit
run: |
npm audit --audit-level=high
if [ $? -ne 0 ]; then
echo "Security vulnerabilities found!"
exit 1
fi
Dependency Management
의존성 업데이트 확인
npm outdated
npx npm-check-updates
npx npm-check-updates -i
안전한 업데이트 전략
npm outdated > outdated-$(date +%Y%m%d).txt
npx npm-check-updates -u --target patch
npx npm-check-updates -u --target minor
npm test
git add package-lock.json
git commit -m "chore: update dependencies (security patch)"
SBOM (Software Bill of Materials)
SBOM 생성
npx @cyclonedx/cyclonedx-npm --output-file sbom.json
npx spdx-sbom-generator
SBOM 포함 정보
{
"bomFormat": "CycloneDX",
"specVersion": "1.4",
"components": [
{
"name": "react",
"version": "18.2.0",
"purl": "pkg:npm/react@18.2.0",
"licenses": [{ "license": { "id": "MIT" } }]
}
]
}
CI에서 SBOM 자동 생성
- name: Generate SBOM
run: npx @cyclonedx/cyclonedx-npm --output-file sbom.json
- name: Upload SBOM
uses: actions/upload-artifact@v3
with:
name: sbom
path: sbom.json
Supply Chain Security
Lockfile 보안
git add package-lock.json
npm ci
.npmrc 보안 설정
ignore-scripts=true
strict-ssl=true
registry=https://registry.npmjs.org/
의심스러운 패키지 확인
npm info <package-name>
npx npm-check <package-name>
npx license-checker
Detection Patterns
위험 신호
🔴 위험:
- critical/high 취약점 존재
- 1년 이상 업데이트 없는 의존성
- deprecated 패키지 사용
- 알 수 없는 출처의 패키지
🟡 주의:
- moderate 취약점
- 6개월 이상 업데이트 없음
- 낮은 다운로드 수
검사 명령어
npm ls 2>&1 | grep -i deprecated
npx license-checker --failOn "GPL;AGPL"
npm ls --depth=0
Workflow
1. 새 의존성 추가 시
추가 전 체크:
1. npm info로 패키지 정보 확인
2. 다운로드 수 및 유지보수 상태 확인
3. 라이선스 호환성 확인
4. 대안 패키지 검토
추가 후:
1. npm audit 실행
2. lockfile 커밋
2. 정기 보안 점검 (주간/월간)
npm audit
npm outdated
npx @cyclonedx/cyclonedx-npm --output-file sbom.json
3. CI/CD 파이프라인
name: Security Check
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Security audit
run: npm audit --audit-level=high
- name: Check outdated
run: npm outdated || true
- name: Generate SBOM
run: npx @cyclonedx/cyclonedx-npm --output-file sbom.json
도구 추천
| 도구 | 용도 | 명령어 |
|---|
| npm audit | 취약점 스캔 | npm audit |
| Snyk | 고급 취약점 분석 | npx snyk test |
| OWASP Dependency-Check | OWASP 표준 스캔 | CLI 도구 |
| CycloneDX | SBOM 생성 | npx @cyclonedx/cyclonedx-npm |
| npm-check-updates | 의존성 업데이트 | npx ncu |
Checklist
새 프로젝트
의존성 추가 시
정기 점검
References