| name | Security Audit and Vulnerability Scanning |
| description | Comprehensive security audit workflow including dependency scanning, unsafe code detection, and secret management. Use when scanning for vulnerabilities or before production deployment. |
| allowed-tools | Bash, Read, Grep, Glob |
🔐 Security Audit and Vulnerability Scanning
Version: 2.0.0
Last Updated: 2025-11-22
Priority: ⭐⭐⭐⭐ (P1 Level)
Purpose: 包括的セキュリティ監査と脆弱性スキャン
📋 概要
依存関係の脆弱性スキャン、unsafeコード検出、シークレット管理を含む
包括的なセキュリティ監査ワークフローを提供します。
🎯 P0: 呼び出しトリガー
| トリガー | 例 |
|---|
| 脆弱性スキャン | "scan for security vulnerabilities" |
| CVE確認 | "are there any CVEs?" |
| コード監査 | "audit the codebase" |
| デプロイ前 | "before production deployment" |
| 定期監査 | "weekly security check" |
🔧 P1: セキュリティツール一覧
ツール優先順位
| ツール | 用途 | 頻度 | コマンド |
|---|
cargo-audit | 依存関係CVE | 高 | cargo audit |
cargo-deny | ポリシー強制 | 高 | cargo deny check |
cargo-geiger | unsafe検出 | 中 | cargo geiger |
gitleaks | シークレット検出 | 高 | gitleaks detect |
cargo-supply-chain | サプライチェーン | 低 | cargo supply-chain |
🚀 P2: 監査パターン
Pattern 1: フルセキュリティ監査
cargo audit
cargo deny check
cargo geiger --output-format Json
gitleaks detect --source . --verbose
cargo supply-chain crates
Pattern 2: クイック監査(CI用)
cargo audit && cargo deny check advisories
Pattern 3: Clippy セキュリティリント
cargo clippy -- \
-D warnings \
-W clippy::all \
-W clippy::pedantic \
-A clippy::missing_errors_doc
⚡ P3: 脆弱性対応
重大度別対応
| 重大度 | 対応期限 | アクション |
|---|
| Critical | 即時 | デプロイ停止、即時修正 |
| High | 24時間 | 優先修正、回避策検討 |
| Medium | 1週間 | 計画的修正 |
| Low | 1ヶ月 | 次回アップデート時 |
依存関係更新
cargo update -p vulnerable-crate
[dependencies]
vulnerable-crate = ">=1.2.3"
📊 deny.toml設定例
[advisories]
db-path = "~/.cargo/advisory-db"
vulnerability = "deny"
unmaintained = "warn"
[licenses]
allow = ["MIT", "Apache-2.0", "BSD-3-Clause"]
copyleft = "deny"
[bans]
multiple-versions = "warn"
wildcards = "deny"
[sources]
allow-git = []
🛡️ シークレット管理
検出パターン
| パターン | 例 | アクション |
|---|
| AWS Key | AKIA... | 即時無効化 |
| GitHub Token | ghp_... | 即時無効化 |
| API Key | sk-... | 即時無効化 |
| Private Key | -----BEGIN | リポジトリからパージ |
誤コミット対応
git rm --cached secrets.json
git commit --amend --no-edit
git filter-repo --invert-paths --path secrets.json
✅ 成功基準
| チェック項目 | 基準 |
|---|
cargo audit | 0 vulnerabilities |
cargo deny | 0 denied |
cargo geiger | unsafe最小化 |
gitleaks | 0 secrets |
出力フォーマット
🔐 Security Audit Results
✅ Dependencies: 0 vulnerabilities
✅ Policy: All checks passed
⚠️ Unsafe: 5 blocks (3rd party only)
✅ Secrets: No leaks detected
Ready for production ✓
🔗 関連Skills
- Rust Development: ビルド品質
- Dependency Management: 依存関係更新
- Debugging: セキュリティ問題調査