security-threat-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/security-threat-review - Red Team / Blue Team 包括セキュリティ評価
/security-threat-review - Red Team / Blue Team Comprehensive Security Assessment
Goal
Goal
攻撃者(Red Team)と防御者(Blue Team)の2視点でアプリ全体を評価し、
攻撃シナリオと防御ギャップの対応表を含む統合レポートを出力する。
他のセキュリティスキルとの違い:
= grepベースの既知パターン検出(機械的・高速)/security-audit-quick = 単一脅威の深掘り(脅威モデル→緩和→テスト→ゲート)/security-hardening = PR差分のセキュリティレビュー(差分限定)/review --focus security = アプリ全体の攻撃/防御2視点評価(包括的・定期的)/security-threat-review
Evaluate the entire application from two perspectives: attackers (Red Team) and defenders (Blue Team), and output an integrated report including an Attack Scenario and Defense Gap Matrix.
Differences from other security skills:
= grep-based known pattern detection (mechanical, fast)/security-audit-quick = in-depth handling of single threats (threat model → mitigation → testing → gate)/security-hardening = security review of PR diffs (diff-limited)/review --focus security = holistic attack/defense two-perspective assessment of the entire application (comprehensive, periodic)/security-threat-review
Input
Input
| 引数 | 説明 | デフォルト |
|---|---|---|
| 評価対象を限定 | |
| Blue Team の評価レイヤーを限定(1-8) | 全レイヤー |
| Argument | Description | Default |
|---|---|---|
| Limit evaluation target | |
| Limit Blue Team evaluation layers (1-8) | All layers |
--scope オプション
--scope Option
| 値 | 対象 |
|---|---|
| アプリ全体(デフォルト) |
| |
| |
| 認証/認可関連のみ |
| Stripe/課金関連のみ |
| ファイルアップロード/処理関連のみ |
| Value | Target |
|---|---|
| Entire application (default) |
| Only |
| Only |
| Only authentication/authorization related |
| Only Stripe/billing related |
| Only file upload/processing related |
例
Examples
bash
undefinedbash
undefinedアプリ全体の包括評価(デフォルト)
Comprehensive evaluation of the entire application (default)
/security-threat-review
/security-threat-review
API Routesのみ評価
Evaluate only API Routes
/security-threat-review --scope api
/security-threat-review --scope api
認証関連のみ評価
Evaluate only authentication-related areas
/security-threat-review --scope auth
/security-threat-review --scope auth
全体評価だが Blue Team は Layer 1-3(認証/認可/入力)のみ
Full evaluation, but Blue Team only assesses Layers 1-3 (Auth/Authorization/Input)
/security-threat-review --layer 1-3
---/security-threat-review --layer 1-3
---Workflow
Workflow
Phase 0: 偵察(攻撃面の把握)
Phase 0: Reconnaissance (Understand Attack Surface)
まず以下を実行し、アプリの攻撃面を把握する:
bash
undefinedFirst, execute the following to understand the application's attack surface:
bash
undefined1. 全APIエンドポイント
1. All API endpoints
echo "=== API Routes ==="
find src/app/api -name "route.ts" | sort
echo "=== API Routes ==="
find src/app/api -name "route.ts" | sort
2. 全Server Actions
2. All Server Actions
echo "=== Server Actions ==="
find src/app/actions -name "*.ts" | sort
echo "=== Server Actions ==="
find src/app/actions -name "*.ts" | sort
3. セキュリティモジュール一覧
3. List of security modules
echo "=== Security Modules ==="
find src/lib/security -name "*.ts" | sort
echo "=== Security Modules ==="
find src/lib/security -name "*.ts" | sort
4. RLSポリシー数
4. Number of RLS policies
echo "=== RLS Policies ==="
grep -r "CREATE POLICY" supabase/migrations/ --include="*.sql" | wc -l
echo "=== RLS Policies ==="
grep -r "CREATE POLICY" supabase/migrations/ --include="*.sql" | wc -l
5. テストモード境界
5. Test mode boundaries
echo "=== Test Mode ==="
cat src/lib/test-mode.ts | head -50
この情報を**両エージェントへのコンテキストとして渡す**。echo "=== Test Mode ==="
cat src/lib/test-mode.ts | head -50
Pass this information **as context to both agents**.Phase 1: Red Team / Blue Team 並列実行
Phase 1: Red Team / Blue Team Parallel Execution
2つのエージェントを並列で起動する:
Launch two agents in parallel:
Red Team(攻撃者視点)
Red Team (Attacker Perspective)
text
Task(red-team-attacker):
このPowerPoint翻訳SaaSを攻撃者の視点で評価してください。
## アプリ概要
- Stack: Next.js 16 + React 19 + Supabase + Stripe + Claude API
- 機能: PPTXアップロード → テキスト抽出 → Claude翻訳 → ダウンロード
- 認証: Supabase Auth (Cookie-based)
- 課金: Stripe Subscriptions
## 攻撃面
[Phase 0の結果を貼る]
## スコープ
[--scope オプションの値]
出力は .claude/docs/reviewer-output-format.md に従ってください。text
Task(red-team-attacker):
Please evaluate this PowerPoint translation SaaS from an attacker's perspective.
## App Overview
- Stack: Next.js 16 + React 19 + Supabase + Stripe + Claude API
- Features: PPTX Upload → Text Extraction → Claude Translation → Download
- Authentication: Supabase Auth (Cookie-based)
- Billing: Stripe Subscriptions
## Attack Surface
[Paste Phase 0 results]
## Scope
[Value of --scope option]
Please follow the format in .claude/docs/reviewer-output-format.md for output.Blue Team(防御者視点)
Blue Team (Defender Perspective)
text
Task(blue-team-defender):
このPowerPoint翻訳SaaSの防御態勢を評価してください。
## アプリ概要
- Stack: Next.js 16 + React 19 + Supabase + Stripe + Claude API
- 機能: PPTXアップロード → テキスト抽出 → Claude翻訳 → ダウンロード
- 認証: Supabase Auth (Cookie-based)
- 課金: Stripe Subscriptions
## 防御機構
[Phase 0の結果を貼る]
## スコープ
[--scope オプションの値]
[--layer オプションの値]
出力は .claude/docs/reviewer-output-format.md に従ってください。
Defense Scorecard(Layer 1-8)を必ず含めてください。text
Task(blue-team-defender):
Please evaluate the defense posture of this PowerPoint translation SaaS.
## App Overview
- Stack: Next.js 16 + React 19 + Supabase + Stripe + Claude API
- Features: PPTX Upload → Text Extraction → Claude Translation → Download
- Authentication: Supabase Auth (Cookie-based)
- Billing: Stripe Subscriptions
## Defense Mechanisms
[Paste Phase 0 results]
## Scope
[Value of --scope option]
[Value of --layer option]
Please follow the format in .claude/docs/reviewer-output-format.md for output.
Be sure to include the Defense Scorecard (Layers 1-8).Phase 2: 結果統合
Phase 2: Result Aggregation
review-aggregator エージェントを使って両チームの出力を統合する。
ただし、通常のPRレビュー統合に加えて、以下を追加出力する:
Use the review-aggregator agent to integrate outputs from both teams.
In addition to regular PR review aggregation, output the following unique to this skill:
攻撃-防御 対応表(このスキル固有の出力)
Attack-Defense Matrix (Skill-Specific Output)
両チームの結果を突き合わせ、攻撃シナリオと防御状況の対応表を生成する:
markdown
undefinedCross-reference results from both teams to generate a matrix of attack scenarios and defense status:
markdown
undefinedAttack-Defense Matrix
Attack-Defense Matrix
| # | 攻撃シナリオ (Red) | 防御状況 (Blue) | Gap | Priority |
|---|---|---|---|---|
| 1 | IDOR: 他人のfileIdでダウンロード | RLS + user_idチェック済み | None | - |
| 2 | Rate Limit バイパス: ヘッダー偽装 | isProductionRuntime()でガード済み | None | - |
| 3 | テストモード偽装: X-E2E-Test | fail-closed だが一部チェック漏れ | Partial | High |
| 4 | Webhook偽造: 署名なしリクエスト | 署名検証あり | None | - |
| 5 | 翻訳回数制限バイパス | カウンター実装あり、ただしrace condition | Yes | Critical |
**Gap の判定基準**:
| Gap | 意味 |
|-----|------|
| **None** | Red Teamの攻撃がBlue Teamの防御で完全に阻止される |
| **Partial** | 防御は存在するが不完全。条件次第で突破可能 |
| **Yes** | 防御が欠如し、攻撃が成立する |
**Priority の判定基準**:
| Priority | 条件 |
|----------|------|
| **Critical** | Gap=Yes かつ 影響がデータ漏えい/権限昇格/課金詐欺 |
| **High** | Gap=Partial かつ 影響が深刻 |
| **Medium** | Gap=Partial かつ 影響が限定的 |
| **Low** | 理論的なリスクのみ |
| **-** | Gap=None(防御済み) || # | Attack Scenario (Red) | Defense Status (Blue) | Gap | Priority |
|---|---|---|---|---|
| 1 | IDOR: Download via others' fileId | RLS + user_id check implemented | None | - |
| 2 | Rate Limit Bypass: Header Spoofing | Guarded by isProductionRuntime() | None | - |
| 3 | Test Mode Spoofing: X-E2E-Test | Fail-closed but some checks missing | Partial | High |
| 4 | Webhook Forgery: Unsigned Requests | Signature verification implemented | None | - |
| 5 | Translation Limit Bypass | Counter implemented, but race condition exists | Yes | Critical |
**Gap Criteria**:
| Gap | Meaning |
|-----|------|
| **None** | Red Team's attack is completely blocked by Blue Team's defense |
| **Partial** | Defense exists but is incomplete; breakthrough possible under certain conditions |
| **Yes** | Defense is missing, attack is feasible |
**Priority Criteria**:
| Priority | Conditions |
|----------|------|
| **Critical** | Gap=Yes and impact includes data leakage, privilege escalation, or billing fraud |
| **High** | Gap=Partial and impact is severe |
| **Medium** | Gap=Partial and impact is limited |
| **Low** | Theoretical risk only |
| **-** | Gap=None (defended properly) |Phase 3: 最終レポート出力
Phase 3: Final Report Output
markdown
undefinedmarkdown
undefinedSecurity Threat Review Report
Security Threat Review Report
Executive Summary
Executive Summary
[3-5行: 全体評価、最も重要なGap、推奨アクション]
[3-5 lines: Overall assessment, most critical gaps, recommended actions]
Defense Scorecard (Blue Team)
Defense Scorecard (Blue Team)
[Layer 1-8 のスコアカード表]
[Scorecard table for Layers 1-8]
Attack-Defense Matrix
Attack-Defense Matrix
[Phase 2 の対応表]
[Matrix from Phase 2]
Blockers (Critical/High Gaps)
Blockers (Critical/High Gaps)
- [confidence=XX] <タイトル> (file:line) — <概要> — <推奨策>
- Red Team: [攻撃シナリオ要約]
- Blue Team: [防御ギャップ要約]
- [confidence=XX] <Title> (file:line) — <Summary> — <Recommendation>
- Red Team: [Attack Scenario Summary]
- Blue Team: [Defense Gap Summary]
Important (Medium Gaps)
Important (Medium Gaps)
- [confidence=XX] <タイトル> (file:line) — <概要> — <推奨策>
- [confidence=XX] <Title> (file:line) — <Summary> — <Recommendation>
Suggestions (Hardening Opportunities)
Suggestions (Hardening Opportunities)
- [confidence=XX] <タイトル> (file:line) — <改善案>
- [confidence=XX] <Title> (file:line) — <Improvement Proposal>
Strengths (Well-Defended Areas)
Strengths (Well-Defended Areas)
- [防御が適切に機能している領域]
- [Areas where defense is functioning properly]
Recommended Next Steps
Recommended Next Steps
- [最優先で対応すべき項目]
- [次に対応すべき項目]
- [中期的に対応すべき項目]
Reviewed by: Red Team (攻撃者視点) + Blue Team (防御者視点)
Aggregated by: review-aggregator
---- [Highest priority item to address]
- [Next priority item]
- [Mid-term item to address]
Reviewed by: Red Team (Attacker Perspective) + Blue Team (Defender Perspective)
Aggregated by: review-aggregator
---AI Assistant Instructions
AI Assistant Instructions
MUST
MUST
- Phase 0 を必ず最初に実行(攻撃面の把握なしにエージェントを起動しない)
- Red Team と Blue Team を並列で Task 起動する(直列にしない)
- Attack-Defense Matrix を必ず出力する(このスキルの核心)
- Defense Scorecard を必ず含める(Blue Teamの出力から抽出)
- Gap=Yes の項目は Blocker として扱う
- Recommended Next Steps を優先度順で出力する
- Always execute Phase 0 first (do not start agents without understanding the attack surface)
- Launch Red Team and Blue Team Tasks in parallel (do not run sequentially)
- Always output the Attack-Defense Matrix (core of this skill)
- Always include the Defense Scorecard (extracted from Blue Team output)
- Treat items with Gap=Yes as Blockers
- Output Recommended Next Steps in priority order
NEVER
NEVER
- 片方のチームだけ実行しない(Red/Blue 両方必須)
- Attack-Defense Matrix を省略しない
- 修正を自動実行しない(レポートのみ)
- 他のセキュリティスキル(等)を内部で呼ばない(スコープが異なる)
/security-audit-quick - テストファイルへの修正指示を出さない(検出・報告は行う)
- Do not run only one team (both Red/Blue are required)
- Do not omit the Attack-Defense Matrix
- Do not automatically execute fixes (report only)
- Do not internally call other security skills (e.g., ) (different scope)
/security-audit-quick - Do not issue instructions to modify test files (detection and reporting are allowed)