mcpField
S
supabase-report

supabase-report

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

supabase-report について

Supabase の監査結果を Markdown のセキュリティレポートにまとめるスキルです。リスクの記録や修正計画の策定を行うチーム向けで、監査コンテキストを読み込み、セクションや出力形式を指定できます。

主な機能

  1. 01エグゼクティブサマリーとセキュリティスコアの生成
  2. 02重大度別の監査結果整理
  3. 03コンポーネント分析と修正計画の提示
  4. 04レポートセクションと出力形式の指定
  5. 05監査ログとコンテキストファイルの逐次更新

活用シーン

  1. 01完了した Supabase セキュリティ監査の集約
  2. 02関係者へのリスクと修正優先度の提示
  3. 03コンプライアンスや監査記録用レポートの作成

インストール

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

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

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

詳細

セキュリティレポートジェネレーター

🔴 重大:ファイルを段階的に更新する必要があります

最後にまとめて書き込むのではなく、作業を進めながらコンテキストファイルに必ず書き込んでください。

  • 各セクションの処理時に、直ちに .sb-pentest-audit.log に書き込んでください
  • .sb-pentest-context.json のレポートメタデータを段階的に更新してください
  • レポート全体の生成が完了するまでファイルの更新を待たないでください
  • スキルがクラッシュまたは中断された場合でも、途中までの作業内容がすでに保存されている必要があります

これは必須です。段階的に書き込まないことは重大なエラーです。

このスキルは、収集したすべての調査結果から包括的な Markdown セキュリティ監査レポートを生成します。

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

  • セキュリティ監査フェーズの完了後
  • ステークホルダー向けに調査結果を文書化するとき
  • 実行可能な修正計画を作成するとき
  • コンプライアンスおよび監査証跡のため

前提条件

  • 監査フェーズが完了していること(コンテキストファイルに情報が入力済み)
  • .sb-pentest-context.json に調査結果が収集されていること

レポートの構成

生成されるレポートには、次の項目が含まれます。

  1. エグゼクティブサマリー — 経営陣向けの概要
  2. セキュリティスコア — 定量的なリスク評価
  3. 重大な調査結果(P0) — 直ちに対応が必要
  4. 高リスクの調査結果(P1) — 早急に対応
  5. 中リスクの調査結果(P2) — 対応を計画
  6. 詳細分析 — コンポーネントごとの内訳
  7. 修正計画 — 優先順位付けされた対応項目
  8. 付録 — 技術的な詳細、手法

使用方法

レポートを生成する
Generate security report from audit findings
レポート名を指定する
Generate report as security-audit-2025-01.md
セクションを指定する
Generate executive summary only

出力形式

このスキルは supabase-audit-report.md を生成します。

# Supabase Security Audit Report

**Target:** https://myapp.example.com
**Project:** abc123def.supabase.co
**Date:** January 31, 2025
**Auditor:** Internal Security Team

---

## Executive Summary

### Overview

This security audit identified **12 vulnerabilities** across the Supabase implementation, including **3 critical (P0)** issues requiring immediate attention.

### Key Findings

| Severity | Count | Status |
|----------|-------|--------|
| 🔴 P0 (Critical) | 3 | Immediate action required |
| 🟠 P1 (High) | 4 | Address within 7 days |
| 🟡 P2 (Medium) | 5 | Address within 30 days |

### Security Score

**Score: 35/100 (Grade: D)**

The application has significant security gaps that expose user data and allow privilege escalation. Critical issues must be addressed before the application can be considered secure.

### Most Critical Issues

1. **Service Role Key Exposed** — Full database access possible
2. **Database Backups Public** — All data downloadable
3. **Admin Function No Auth** — Any user can access admin features

### Recommended Actions

1. ⚡ **Immediate (Today):**
   - Rotate service role key
   - Make backup bucket private
   - Add admin role verification

2. 🔜 **This Week:**
   - Enable RLS on all tables
   - Enable email confirmation
   - Fix IDOR in Edge Functions

3. 📅 **This Month:**
   - Strengthen password policy
   - Restrict CORS origins
   - Add rate limiting to functions

---

## Critical Findings (P0)

### P0-001: Service Role Key Exposed in Client Code

**Severity:** 🔴 Critical
**Component:** Key Management
**CVSS:** 9.8 (Critical)

#### Description

The Supabase service_role key was found in client-side JavaScript code. This key bypasses all Row Level Security policies and provides full database access.

#### Location

ファイル:/static/js/admin.chunk.js 行:89 コード:const SUPABASE_KEY = 'eyJhbGciOiJIUzI1NiI...'


#### Impact

- Full read/write access to all database tables
- Bypass of all RLS policies
- Access to auth.users table (all user data)
- Ability to delete or modify any data

#### Proof of Concept

```bash
curl 'https://abc123def.supabase.co/rest/v1/users' \
  -H 'apikey: [service_role_key]' \
  -H 'Authorization: Bearer [service_role_key]'

# Returns ALL users with full data
修正

直ちに実施:

  1. Supabase Dashboard でサービスロールキーをローテーションします
    • Settings → API → service_role キーを再生成
  2. クライアントコードからキーを削除します
  3. アプリケーションを再デプロイします

長期的な対応:

// Move privileged operations to Edge Functions
// supabase/functions/admin-action/index.ts

import { createClient } from '@supabase/supabase-js'

Deno.serve(async (req) => {
  // Service key only on server
  const supabase = createClient(
    Deno.env.get('SUPABASE_URL')!,
    Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')!
  )

  // Verify caller is admin before proceeding
  // ...
})

ドキュメント:


P0-002:データベースのバックアップが一般公開されている

深刻度: 🔴 重大 コンポーネント: Storage CVSS: 9.1(重大)

説明

「backups」という名前のストレージバケットが公開設定になっており、データベースダンプ、ユーザーのエクスポートデータ、環境シークレットが公開されています。

公開されているファイル
ファイルサイズ内容
db-backup-2025-01-30.sql125MBデータベース全体のダンプ
users-export.csv2.3MBPIIを含む全ユーザーデータ
secrets.env1KBAPIキーとパスワード
影響
  • データベースの全コンテンツが漏えい
  • サードパーティサービスの認証情報が公開
  • ユーザーのPII(メールアドレス、氏名など)が公開
修正

直ちに実施:

-- Make bucket private
UPDATE storage.buckets
SET public = false
WHERE name = 'backups';

-- Delete or move files
-- Consider incident response procedures

認証情報のローテーション:

  • Stripe API キー
  • データベースのパスワード
  • JWT シークレット
  • secrets.env 内のその他すべてのキー

P0-003:管理者用 Edge Function の権限昇格

深刻度: 🔴 重大 コンポーネント: Edge Functions CVSS: 8.8(高)

説明

/functions/v1/admin-panel Edge Function は、ロールの確認なしで、認証済みのすべてのユーザーがアクセスできます。

[... 追加のP0調査結果 ...]


高リスクの調査結果(P1)

P1-001:メール確認が無効

深刻度: 🟠 高 コンポーネント: 認証

[... P1調査結果 ...]


中リスクの調査結果(P2)

P2-001:パスワードポリシーが弱い

深刻度: 🟡 中 コンポーネント: 認証

[... P2調査結果 ...]


コンポーネント別の詳細分析

API セキュリティ
テーブルRLSアクセスレベルステータス
users❌全件読み取り🔴 P0
orders✅なし✅
posts✅公開済みのみ✅
Storage セキュリティ
バケット公開機密ファイルステータス
avatarsはいいいえ✅
backupsはいはい(45ファイル)🔴 P0
認証
設定現在推奨ステータス
メール確認無効有効🟠 P1
パスワードの最小文字数68+🟡 P2

修正計画

フェーズ 1:重大(直ちに)
ID対応担当期限
P0-001サービスキーをローテーションするDevOps今日
P0-002バックアップを非公開にするDevOps今日
P0-003管理者ロールのチェックを追加するBackend今日
フェーズ 2:優先度高(今週)
ID対応担当期限
P1-001メール確認を有効にするBackend3 日
P1-002get-user-data の IDOR を修正するBackend3 日
フェーズ 3:優先度中(今月)
ID対応担当期限
P2-001パスワードポリシーを強化するBackend14 日
P2-002CORS オリジンを制限するDevOps14 日

付録

A. 方法論

この監査は、以下を含む Supabase Pentest Skills ツールキットを使用して実施しました。

  • クライアント側コードの受動的な偵察
  • anon キーおよび service キーを使用した API エンドポイントのテスト
  • ストレージバケットの列挙とアクセスのテスト
  • 認証フローの分析
  • リアルタイムチャネルのサブスクリプションテスト
B. 使用したツール
  • supabase-pentest-skills v1.0.0
  • API テスト用の curl
  • クライアントコード分析用のブラウザ DevTools
C. 監査範囲
  • 対象 URL: https://myapp.example.com
  • Supabase プロジェクト:abc123def
  • テスト対象コンポーネント:API、Storage、Auth、Realtime、Edge Functions
  • 除外項目:なし
D. 監査ログ

完全な監査ログは .sb-pentest-audit.log で確認できます。


supabase-pentest-skills によって生成されたレポート 監査完了: 2025 年 1 月 31 日 15:00 UTC


## Score Calculation

The security score is calculated based on:

| Factor | Weight | Calculation |
|--------|--------|-------------|
| P0 findings | -25 per issue | Critical vulnerabilities |
| P1 findings | -10 per issue | High severity issues |
| P2 findings | -5 per issue | Medium severity issues |
| RLS coverage | +10 if 100% | All tables have RLS |
| Auth hardening | +10 | Email confirm, strong passwords |
| Base score | 100 | Starting point |

### Grade Scale

| Score | Grade | Description |
|-------|-------|-------------|
| 90-100 | A | Excellent security posture |
| 80-89 | B | Good, minor improvements needed |
| 70-79 | C | Acceptable, address issues |
| 60-69 | D | Poor, significant issues |
| 0-59 | F | Critical, immediate action needed |

## Context Input

The report generator reads from `.sb-pentest-context.json`:

```json
{
  "target_url": "https://myapp.example.com",
  "supabase": {
    "project_url": "https://abc123def.supabase.co",
    "project_ref": "abc123def"
  },
  "findings": [
    {
      "id": "P0-001",
      "severity": "P0",
      "component": "keys",
      "title": "Service Role Key Exposed",
      "description": "...",
      "location": "...",
      "remediation": "..."
    }
  ],
  "audit_completed": "2025-01-31T15:00:00Z"
}

レポートのカスタマイズ

セクションの追加/除外
Generate report without appendix
Generate report with executive summary only
別の形式
Generate report in JSON format
Generate report summary as HTML

必須:コンテキストファイルへの依存

⚠️ このスキルには、適切に入力されたトラッキングファイルが必要です。

前提条件

レポートを生成する前に、次の点を確認してください。

  1. .sb-pentest-context.json が存在し、監査スキルの検出結果が含まれていること
  2. .sb-pentest-audit.log が存在し、タイムスタンプ付きの操作が記録されていること
  3. 関連するすべての監査スキルがこれらのファイルを更新済みであること
コンテキストファイルがない場合

コンテキストファイルがない、または空の場合:

  1. 空のレポートを生成しないでください
  2. まず監査スキルを実行する必要があることをユーザーに伝えてください
  3. 完全な監査を行うため、supabase-pentest の実行を推奨してください
レポート生成の出力

レポートの生成後、このスキルは必ず次の処理を行う必要があります。

  1. .sb-pentest-audit.log に記録する:

    [TIMESTAMP] [supabase-report] [START] Generating security report
    [TIMESTAMP] [supabase-report] [SUCCESS] Report generated: supabase-audit-report.md
    [TIMESTAMP] [supabase-report] [CONTEXT_UPDATED] Report generation logged
    
  2. レポートのメタデータを .sb-pentest-context.json に更新する:

    {
      "report": {
        "generated_at": "...",
        "filename": "supabase-audit-report.md",
        "findings_count": { "p0": 3, "p1": 4, "p2": 5 }
      }
    }
    

コンテキストファイルを更新しないことは許容されません。

関連スキル

  • supabase-report-compare — 以前のレポートと比較する
  • supabase-pentest — 先に完全な監査を実行する
  • supabase-help — 利用可能なすべてのスキルを一覧表示する

コメント