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視点でアプリ全体を評価し、 攻撃シナリオと防御ギャップの対応表を含む統合レポートを出力する。
他のセキュリティスキルとの違い:
  • /security-audit-quick
    = grepベースの既知パターン検出(機械的・高速)
  • /security-hardening
    = 単一脅威の深掘り(脅威モデル→緩和→テスト→ゲート)
  • /review --focus security
    = PR差分のセキュリティレビュー(差分限定)
  • /security-threat-review
    = アプリ全体の攻撃/防御2視点評価(包括的・定期的)

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:
  • /security-audit-quick
    = grep-based known pattern detection (mechanical, fast)
  • /security-hardening
    = in-depth handling of single threats (threat model → mitigation → testing → gate)
  • /review --focus security
    = security review of PR diffs (diff-limited)
  • /security-threat-review
    = holistic attack/defense two-perspective assessment of the entire application (comprehensive, periodic)

Input

Input

引数説明デフォルト
--scope
評価対象を限定
all
(アプリ全体)
--layer
Blue Team の評価レイヤーを限定(1-8)全レイヤー
ArgumentDescriptionDefault
--scope
Limit evaluation target
all
(entire application)
--layer
Limit Blue Team evaluation layers (1-8)All layers

--scope オプション

--scope Option

対象
all
アプリ全体(デフォルト)
api
src/app/api/
のみ
actions
src/app/actions/
のみ
auth
認証/認可関連のみ
payment
Stripe/課金関連のみ
upload
ファイルアップロード/処理関連のみ
ValueTarget
all
Entire application (default)
api
Only
src/app/api/
actions
Only
src/app/actions/
auth
Only authentication/authorization related
payment
Only Stripe/billing related
upload
Only file upload/processing related

Examples

bash
undefined
bash
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
undefined
First, execute the following to understand the application's attack surface:
bash
undefined

1. 全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
undefined
Cross-reference results from both teams to generate a matrix of attack scenarios and defense status:
markdown
undefined

Attack-Defense Matrix

Attack-Defense Matrix

#攻撃シナリオ (Red)防御状況 (Blue)GapPriority
1IDOR: 他人のfileIdでダウンロードRLS + user_idチェック済みNone-
2Rate Limit バイパス: ヘッダー偽装isProductionRuntime()でガード済みNone-
3テストモード偽装: X-E2E-Testfail-closed だが一部チェック漏れPartialHigh
4Webhook偽造: 署名なしリクエスト署名検証ありNone-
5翻訳回数制限バイパスカウンター実装あり、ただしrace conditionYesCritical

**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)GapPriority
1IDOR: Download via others' fileIdRLS + user_id check implementedNone-
2Rate Limit Bypass: Header SpoofingGuarded by isProductionRuntime()None-
3Test Mode Spoofing: X-E2E-TestFail-closed but some checks missingPartialHigh
4Webhook Forgery: Unsigned RequestsSignature verification implementedNone-
5Translation Limit BypassCounter implemented, but race condition existsYesCritical

**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
undefined
markdown
undefined

Security 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

  1. [最優先で対応すべき項目]
  2. [次に対応すべき項目]
  3. [中期的に対応すべき項目]

Reviewed by: Red Team (攻撃者視点) + Blue Team (防御者視点) Aggregated by: review-aggregator

---
  1. [Highest priority item to address]
  2. [Next priority item]
  3. [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

  1. Phase 0 を必ず最初に実行(攻撃面の把握なしにエージェントを起動しない)
  2. Red Team と Blue Team を並列で Task 起動する(直列にしない)
  3. Attack-Defense Matrix を必ず出力する(このスキルの核心)
  4. Defense Scorecard を必ず含める(Blue Teamの出力から抽出)
  5. Gap=Yes の項目は Blocker として扱う
  6. Recommended Next Steps を優先度順で出力する
  1. Always execute Phase 0 first (do not start agents without understanding the attack surface)
  2. Launch Red Team and Blue Team Tasks in parallel (do not run sequentially)
  3. Always output the Attack-Defense Matrix (core of this skill)
  4. Always include the Defense Scorecard (extracted from Blue Team output)
  5. Treat items with Gap=Yes as Blockers
  6. 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.,
    /security-audit-quick
    ) (different scope)
  • Do not issue instructions to modify test files (detection and reporting are allowed)