mcpField
S
supabase-evidence

supabase-evidence

github.com/yoanbernabeuセキュリティ71268 回インストール39 週間前に更新
リポジトリ

supabase-evidence について

supabase-evidence は、Supabase の監査やレポート作成で使う証拠管理スキルです。収集と同時に証拠を保存し、ディレクトリ、時系列記録、再現可能な curl コマンドを管理します。

主な機能

  1. 01監査証拠ディレクトリの初期化
  2. 02リクエストと応答の逐次記録
  3. 03監査タイムラインの管理
  4. 04再現可能な curl コマンドの整理
  5. 05規則に沿った機密データのマスキング

活用シーン

  1. 01セキュリティ監査の検証可能な証拠を保存
  2. 02後から再現できるようテストを記録
  3. 03コンプライアンスや法務レポート用資料を整理
  4. 04監査中断時に収集済み記録を保持

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/yoanbernabeu/supabase-pentest-skills --skill supabase-evidence

インストール後、Claude Code で/supabase-evidenceを入力して読み込まれたか確認します。

詳細

エビデンス収集管理

🔴 重大:エビデンスファイルの段階的な更新が必須です

エビデンスファイルは最後にまとめてではなく、作業中に随時書き込んでください。

  • エビデンスを収集したら、直ちに保存してください
  • スキルの完了まで、エビデンスの保存を待ってはいけません
  • 監査がクラッシュまたは中断された場合でも、それまでのエビデンスがすべて保存されている必要があります

これは任意ではありません。エビデンスを段階的に保存しないことは重大なエラーです。

このスキルは、専門的なセキュリティ監査のためのエビデンス収集システムを初期化し、管理します。

このスキルを使用するタイミング

  • supabase-pentest の開始時に自動的に呼び出されます
  • 専門的なレポート用にエビデンスを整理する必要がある場合
  • 文書化された証拠が必要な監査を実施する場合
  • コンプライアンスおよび法的目的の場合

エビデンス収集が重要な理由

専門的なセキュリティ監査では、次の要件を満たす必要があります。

要件目的
再現性他の人が調査結果を検証できます
法的証拠法務/コンプライアンス用の文書を提供します
修正の検証修正前に問題が存在していたことを証明します
監査証跡テストした内容を完全に記録します

エビデンスディレクトリ構造

このスキルは、次の構造で .sb-pentest-evidence/ を作成します。

.sb-pentest-evidence/
├── README.md                    # Evidence index and summary
├── curl-commands.sh             # All curl commands used (reproducible)
├── timeline.md                  # Chronological evidence timeline
│
├── 01-detection/
│   ├── initial-scan.json        # Raw detection results
│   ├── supabase-endpoints.txt   # Discovered endpoints
│   └── client-code-snippets/    # Relevant code excerpts
│       └── supabase-init.js
│
├── 02-extraction/
│   ├── extracted-url.json       # URL extraction proof
│   ├── extracted-anon-key.json  # Anon key with decoded JWT
│   ├── extracted-jwts.json      # All JWTs found
│   ├── service-key-exposure/    # If service key found (P0)
│   │   ├── location.txt
│   │   └── decoded-payload.json
│   └── db-string-exposure/      # If DB string found (P0)
│       └── connection-details.json
│
├── 03-api-audit/
│   ├── openapi-schema.json      # Raw OpenAPI/PostgREST schema
│   ├── tables/
│   │   ├── tables-list.json     # All exposed tables
│   │   └── tables-metadata.json # Column details per table
│   ├── data-samples/            # Sample data retrieved (redacted)
│   │   ├── users-sample.json
│   │   ├── orders-sample.json
│   │   └── ...
│   ├── rls-tests/               # RLS policy test results
│   │   ├── users-anon.json      # Anon access attempt
│   │   ├── users-auth.json      # Authenticated access
│   │   └── cross-user-test.json # Cross-user access attempt
│   └── rpc-tests/               # RPC function test results
│       ├── function-list.json
│       └── vulnerable-functions/
│           └── get-all-users.json
│
├── 04-storage-audit/
│   ├── buckets-config.json      # Bucket configurations
│   ├── buckets/
│   │   ├── avatars/
│   │   │   └── file-list.json
│   │   ├── backups/             # If sensitive (P0)
│   │   │   ├── file-list.json
│   │   │   └── sample-contents/ # Redacted samples
│   │   └── ...
│   └── public-url-tests/        # Direct URL access tests
│       └── backup-access.json
│
├── 05-auth-audit/
│   ├── auth-settings.json       # Auth configuration
│   ├── signup-tests/
│   │   ├── open-signup.json     # Signup availability
│   │   ├── weak-password.json   # Weak password test
│   │   └── rate-limit.json      # Rate limiting test
│   └── enumeration-tests/
│       ├── login-timing.json    # Timing attack data
│       ├── recovery-timing.json
│       └── otp-enumeration.json
│
├── 06-realtime-audit/
│   ├── websocket-connection.json
│   ├── postgres-changes/        # Table subscription tests
│   │   └── users-streaming.json
│   ├── broadcast-channels/      # Channel access tests
│   │   └── admin-channel.json
│   └── presence-data/
│       └── exposed-users.json
│
├── 07-functions-audit/
│   ├── discovered-functions.json
│   └── function-tests/
│       ├── hello-world.json
│       ├── get-user-data-idor.json
│       └── admin-panel-escalation.json
│
└── screenshots/                 # Optional: browser screenshots
    └── ...

使用方法

エビデンスディレクトリを初期化する
Initialize evidence collection for audit
エビデンスを手動で保存する
Save evidence: [description] to [category]

エビデンスファイル形式

各エビデンスファイルは、次の構造に従います。

{
  "evidence_id": "API-001",
  "timestamp": "2025-01-31T10:30:00Z",
  "category": "api-audit",
  "type": "data-sample",
  "finding_id": "P0-001",
  "description": "Users table data accessible without authentication",

  "request": {
    "method": "GET",
    "url": "https://abc123.supabase.co/rest/v1/users?select=*&limit=5",
    "headers": {
      "apikey": "[REDACTED - anon key]",
      "Authorization": "Bearer [REDACTED - anon key]"
    },
    "curl_command": "curl -X GET 'https://abc123.supabase.co/rest/v1/users?select=*&limit=5' -H 'apikey: eyJ...' -H 'Authorization: Bearer eyJ...'"
  },

  "response": {
    "status": 200,
    "headers": {
      "content-type": "application/json",
      "x-total-count": "1247"
    },
    "body": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440001",
        "email": "[REDACTED]@example.com",
        "name": "[REDACTED]",
        "created_at": "2025-01-15T10:30:00Z"
      }
    ],
    "body_redacted": true,
    "total_rows_indicated": 1247
  },

  "analysis": {
    "severity": "P0",
    "impact": "All user PII accessible without authentication",
    "affected_data": ["email", "name", "id"],
    "row_count": 1247
  }
}

Curl コマンドファイル

すべての curl コマンドは curl-commands.sh に収集されます。

#!/bin/bash
# Supabase Security Audit - Reproducible Commands
# Target: https://myapp.example.com
# Project: abc123def.supabase.co
# Date: 2025-01-31
#
# IMPORTANT: Replace [ANON_KEY] with actual key before running
# WARNING: These commands may modify data - use with caution

SUPABASE_URL="https://abc123def.supabase.co"
ANON_KEY="eyJ..."

# === DETECTION ===
# Check if Supabase is used
curl -s "$SUPABASE_URL/rest/v1/" -H "apikey: $ANON_KEY" | head -100

# === TABLE LISTING ===
# Get OpenAPI schema (list all tables)
curl -s "$SUPABASE_URL/rest/v1/" -H "apikey: $ANON_KEY"

# === DATA ACCESS TESTS ===
# Test: Users table (P0 - should be blocked)
curl -s "$SUPABASE_URL/rest/v1/users?select=*&limit=5" \
  -H "apikey: $ANON_KEY" \
  -H "Authorization: Bearer $ANON_KEY"

# Test: Orders table (should be blocked by RLS)
curl -s "$SUPABASE_URL/rest/v1/orders?select=*&limit=5" \
  -H "apikey: $ANON_KEY" \
  -H "Authorization: Bearer $ANON_KEY"

# === RLS BYPASS TESTS ===
# ... additional commands ...

タイムラインファイル

timeline.md には、時系列順のエビデンスが記録されます。

# Audit Timeline

## 2025-01-31 10:00:00 - Audit Started
- Target: https://myapp.example.com
- Authorization confirmed

## 2025-01-31 10:05:00 - Detection Phase
- Supabase detected with high confidence
- Project URL: https://abc123def.supabase.co
- Evidence: `01-detection/initial-scan.json`

## 2025-01-31 10:10:00 - P0 CRITICAL: Service Key Exposed
- Service role key found in client code
- Location: /static/js/admin.chunk.js:89
- Evidence: `02-extraction/service-key-exposure/`

## 2025-01-31 10:15:00 - API Audit Started
- 8 tables discovered
- Evidence: `03-api-audit/tables/tables-list.json`

## 2025-01-31 10:20:00 - P0 CRITICAL: Users Table Exposed
- All 1,247 user records accessible
- PII exposed: email, name
- Evidence: `03-api-audit/data-samples/users-sample.json`

...

コンテキスト出力

.sb-pentest-context.json を更新します。

{
  "evidence": {
    "directory": ".sb-pentest-evidence",
    "initialized_at": "2025-01-31T10:00:00Z",
    "files_count": 45,
    "categories": {
      "detection": 3,
      "extraction": 5,
      "api-audit": 15,
      "storage-audit": 8,
      "auth-audit": 7,
      "realtime-audit": 4,
      "functions-audit": 3
    },
    "critical_evidence": [
      "02-extraction/service-key-exposure/",
      "03-api-audit/data-samples/users-sample.json",
      "04-storage-audit/buckets/backups/"
    ]
  }
}

エビデンス収集ルール

収集するもの
カテゴリエビデンスタイプ例
常にAPI 生レスポンスJSON レスポンス
常にCurl コマンド再現可能なコマンド
常にタイムスタンプ各テストの実施時刻
P0/P1データサンプル(編集済み)PII をマスキングしたサンプル行
P0リクエスト/レスポンス全体HTTP 通信の全内容
任意スクリーンショットブラウザーのエビデンス
マスキングルール

エビデンスファイル内の機密データは、必ずマスキングしてください。

{
  "original": "[email protected]",
  "redacted": "[REDACTED]@example.com"
}

{
  "original": "John Doe",
  "redacted": "[REDACTED]"
}

{
  "original": "sk_live_xxxxxxxxxxxxxxxxxxxx",
  "redacted": "sk_live_[REDACTED]"
}

エビデンスに保存してはいけないもの:

  • 実際のパスワード
  • クレジットカード番号全体
  • API キー全体(先頭と末尾の各 4 文字のみ表示)
  • 個人データ全体(一部のマスキングが必要)
命名規則
[category]-[test-name]-[timestamp].json

例:

  • users-anon-access-20250131-103000.json
  • admin-function-no-auth-20250131-143000.json

必須:エビデンスファイルの更新

⚠️ エビデンスは実行中に段階的に保存する必要があります。

重要なルール:作業中に随時保存する

すべてのエビデンスを最後にまとめて保存してはいけません。代わりに、次の手順に従ってください。

  1. 各テストの前 → エビデンスファイルのプレースホルダーを作成する
  2. 各リクエストの後 → リクエストの詳細を直ちに保存する
  3. 各レスポンスの後 → レスポンスを直ちに保存する
  4. 分析後 → エビデンスファイルに分析を追加する
ディレクトリの初期化

監査の開始時に、次を作成します。

mkdir -p .sb-pentest-evidence/{01-detection,02-extraction,03-api-audit/tables,03-api-audit/data-samples,03-api-audit/rls-tests,03-api-audit/rpc-tests,04-storage-audit/buckets,04-storage-audit/public-url-tests,05-auth-audit/signup-tests,05-auth-audit/enumeration-tests,06-realtime-audit/postgres-changes,06-realtime-audit/broadcast-channels,07-functions-audit/function-tests,screenshots}
監査ログへの記録
[TIMESTAMP] [supabase-evidence] [START] Initializing evidence directory
[TIMESTAMP] [supabase-evidence] [CREATED] .sb-pentest-evidence/
[TIMESTAMP] [supabase-evidence] [CONTEXT_UPDATED] Evidence tracking initialized

他のスキルとの統合

このスキルは supabase-pentest によって自動的に呼び出されます。各監査スキルは、次のことを行ってください。

  1. 適切なサブディレクトリにエビデンスを保存する
  2. 一貫した命名規則を使用する
  3. curl-commands.sh にエントリを追加する
  4. 重要な調査結果について timeline.md を更新する

関連スキル

  • supabase-pentest — エビデンス収集を初期化するオーケストレーター
  • supabase-report — 包括的なレポート作成にエビデンスを使用します
  • すべての監査スキル — それぞれのディレクトリにエビデンスを提供します

コメント