security について
securityは、セキュリティ上重要なコードの監査と修正確認を行うワークフロースキルです。aegisが脆弱性を分析し、arbiterが修正を検証します。対象は単一ファイルからコードベースや依存関係まで指定できます。
主な機能
- 01一般的な脆弱性パターンの検査
- 02依存関係とシークレットの確認
- 03OWASP Top 10リスクの点検
- 04セキュリティテストによる修正検証
- 05ファイル、領域、コードベースの監査
活用シーン
- 01認証や決済コードの監査
- 02指定ファイルの脆弱性確認
- 03依存関係のみをスキャン
- 04セキュリティ修正後の再検査
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ parcadei/ continuous-claude-v3 --skill securityインストール後、Claude Code で/securityを入力して読み込まれたか確認します。
詳細
/security - セキュリティ監査ワークフロー
機密性の高いコードを対象とした、専用のセキュリティ分析です。
使用するタイミング
- 「セキュリティ監査」
- 「脆弱性をチェック」
- 「これは安全ですか?」
- 「認証コードをレビュー」
- 「インジェクション攻撃をチェック」
- 認証、決済、ユーザーデータを扱う前
- セキュリティに関わる機能を追加した後
ワークフローの概要
┌─────────┐ ┌───────────┐
│ aegis │───▶│ arbiter │
│ │ │ │
└─────────┘ └───────────┘
Security Verify
audit fixes
エージェントの実行順序
| # | エージェント | 役割 | 出力 |
|---|---|---|---|
| 1 | aegis | 包括的なセキュリティスキャン | 脆弱性レポート |
| 2 | arbiter | 修正の検証、セキュリティテストの実行 | 検証レポート |
セキュリティ専用のワークフローが必要な理由
/review ワークフローはコード品質に重点を置いています。セキュリティには、次の対応が必要です。
- 専門的な脆弱性パターンの検出
- 依存関係のスキャン
- シークレットの検出
- OWASP Top 10 のチェック
- 認証/認可のレビュー
実行方法
フェーズ 1:セキュリティ監査
Task(
subagent_type="aegis",
prompt="""
Security audit: [SCOPE]
Scan for:
**Injection Attacks:**
- SQL injection
- Command injection
- XSS (Cross-Site Scripting)
- LDAP injection
**Authentication/Authorization:**
- Broken authentication
- Session management issues
- Privilege escalation
- Insecure direct object references
**Data Protection:**
- Sensitive data exposure
- Hardcoded secrets/credentials
- Insecure cryptography
- Missing encryption
**Configuration:**
- Security misconfigurations
- Default credentials
- Verbose error messages
- Missing security headers
**Dependencies:**
- Known vulnerable packages
- Outdated dependencies
- Supply chain risks
Output: Detailed report with:
- Severity (CRITICAL/HIGH/MEDIUM/LOW)
- Location (file:line)
- Description
- Remediation steps
"""
)
フェーズ 2:検証(修正後)
Task(
subagent_type="arbiter",
prompt="""
Verify security fixes: [SCOPE]
Run:
- Security-focused tests
- Dependency audit (npm audit, pip audit)
- Re-check reported vulnerabilities
- Verify fixes don't introduce regressions
Output: Verification report
"""
)
セキュリティ監査の範囲
コードベース全体
User: /security
→ Scan entire codebase
特定の領域
User: /security authentication
→ Focus on auth-related code
単一ファイル
User: /security src/api/auth.py
→ Deep dive on one file
依存関係のみ
User: /security --deps
→ Only dependency vulnerabilities
例
User: /security the payment processing code
Claude: Starting /security audit for payment code...
Phase 1: Security audit...
[Spawns aegis]
┌─────────────────────────────────────────────────────────────┐
│ Security Audit Report │
├─────────────────────────────────────────────────────────────┤
│ Scope: src/services/payment/ │
│ Files scanned: 12 │
│ Lines analyzed: 2,847 │
├─────────────────────────────────────────────────────────────┤
│ CRITICAL (1) │
│ ────────── │
│ [C1] SQL Injection in payment.py:89 │
│ query = f"SELECT * FROM orders WHERE id = {order_id}" │
│ Fix: Use parameterized queries │
│ │
│ HIGH (2) │
│ ──────── │
│ [H1] Hardcoded API key in stripe_client.py:12 │
│ STRIPE_KEY = "sk_live_..." │
│ Fix: Move to environment variable │
│ │
│ [H2] Missing input validation in refund.py:45 │
│ amount = request.json['amount'] # No validation │
│ Fix: Validate amount is positive number │
│ │
│ MEDIUM (1) │
│ ────────── │
│ [M1] Verbose error messages in error_handler.py:23 │
│ return {"error": str(e)} # Leaks internal details │
│ Fix: Return generic message, log details internally │
│ │
│ LOW (0) │
│ ─────── │
│ None │
├─────────────────────────────────────────────────────────────┤
│ Summary: 1 critical, 2 high, 1 medium, 0 low │
│ Status: BLOCKING - Fix critical issues before release │
└─────────────────────────────────────────────────────────────┘
Fix the critical and high issues, then run:
/security --verify
修正後
User: /security --verify
Claude: Phase 2: Verifying fixes...
[Spawns arbiter]
✅ C1: SQL injection fixed - using parameterized queries
✅ H1: API key moved to environment variable
✅ H2: Input validation added
✅ M1: Error messages sanitized
All security tests passing.
Security audit: PASSED
OWASP Top 10 の対応状況
| リスク | チェック済み |
|---|---|
| A01 アクセス制御の不備 | ✅ |
| A02 暗号化の不備 | ✅ |
| A03 インジェクション | ✅ |
| A04 安全でない設計 | ✅ |
| A05 セキュリティ設定の不備 | ✅ |
| A06 脆弱なコンポーネント | ✅ |
| A07 認証の不備 | ✅ |
| A08 データ整合性の不備 | ✅ |
| A09 ログ記録の不備 | ✅ |
| A10 SSRF | ✅ |
フラグ
--deps:依存関係のみ--verify:修正後に再実行--owasp:OWASP Top 10 の詳細レポート--secrets:シークレットの検出に重点を置く
コメント
Markdown 対応