mcpField
S
supabase-audit-auth-config

supabase-audit-auth-config

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

supabase-audit-auth-config について

Supabaseプロジェクトの認証設定を分析するスキルです。本番リリース前の確認や認証セキュリティレビュー向けに、公開APIからメール・電話認証、OAuthプロバイダー、登録状態、メール確認、パスワード要件を調べ、リスク項目と修正案を示します。

主な機能

  1. 01メール・電話認証設定の確認
  2. 02有効なOAuthプロバイダーの特定
  3. 03登録可否とメール確認の確認
  4. 04パスワード要件と認証リスクの分析
  5. 05発見事項の逐次記録と設定証拠の保存

活用シーン

  1. 01リリース前の認証設定レビュー
  2. 02登録可否とプロバイダー設定の確認
  3. 03メール確認とパスワードポリシーの点検
  4. 04修正に向けた認証設定問題の記録

インストール

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

$npx skills add https://github.com/yoanbernabeu/supabase-pentest-skills --skill supabase-audit-auth-config

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

詳細

認証設定の監査

🔴 重大:進行中のファイル更新が必須です

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

  • 設定を分析するたびに、直ちに .sb-pentest-context.json に書き込んでください
  • 各テストの前後に .sb-pentest-audit.log に記録してください
  • スキルの完了までファイルの更新を待たないでください
  • スキルがクラッシュまたは中断された場合でも、それまでのすべての調査結果がすでに保存されている必要があります

これは任意ではありません。進行中に書き込まないことは重大なエラーです。

このスキルは、Supabase プロジェクトの認証設定を分析します。

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

  • 認証セキュリティ設定を確認するとき
  • 本番環境へのデプロイ前
  • 認証関連の脆弱性を監査するとき
  • 包括的なセキュリティレビューの一環として

前提条件

  • Supabase の URL と anon key が利用可能であること
  • 検出が完了していること

認証エンドポイント

Supabase Auth(GoTrue)が公開するエンドポイント:

https://[project].supabase.co/auth/v1/
エンドポイント用途
/auth/v1/settings公開設定(一部のみ)
/auth/v1/signupユーザー登録
/auth/v1/token認証
/auth/v1/user現在のユーザー情報
/auth/v1/recoverパスワードの再設定

検出可能な項目

公開 API から検出できる項目:

設定検出方法
メール認証の有効化サインアップを試行
電話認証の有効化設定を確認
OAuth プロバイダー設定を確認
サインアップの無効化サインアップを試行
メール確認サインアップの応答
パスワード要件エラーメッセージ

使用方法

基本的な認証監査
Audit authentication configuration
特定の機能を確認
Check if signup is open and what providers are enabled

出力形式

═══════════════════════════════════════════════════════════
 AUTHENTICATION CONFIGURATION AUDIT
═══════════════════════════════════════════════════════════

 Project: abc123def.supabase.co
 Auth Endpoint: https://abc123def.supabase.co/auth/v1/

 ─────────────────────────────────────────────────────────
 Authentication Methods
 ─────────────────────────────────────────────────────────

 Email/Password: ✅ Enabled
 ├── Signup: ✅ Open (anyone can register)
 ├── Email Confirmation: ❌ NOT REQUIRED ← P1 Issue
 ├── Password Min Length: 6 characters ← P2 Consider longer
 └── Secure Password Check: Unknown

 Phone/SMS: ✅ Enabled
 └── Provider: Twilio

 Magic Link: ✅ Enabled
 └── OTP Expiry: 300 seconds (5 min)

 OAuth Providers Detected: 3
 ├── Google: ✅ Enabled
 ├── GitHub: ✅ Enabled
 └── Discord: ✅ Enabled

 Anonymous Auth: ✅ Enabled ← Review if intended

 ─────────────────────────────────────────────────────────
 Security Settings
 ─────────────────────────────────────────────────────────

 Rate Limiting:
 ├── Signup: 3/hour per IP (good)
 ├── Token: 30/hour per IP (good)
 └── Recovery: 3/hour per IP (good)

 Session Configuration:
 ├── JWT Expiry: 3600 seconds (1 hour)
 ├── Refresh Token Rotation: Unknown
 └── Inactivity Timeout: Unknown

 Security Headers:
 ├── CORS: Configured
 ├── Allowed Origins: * (wildcard) ← P2 Consider restricting
 └── Credentials: Allowed

 ─────────────────────────────────────────────────────────
 Findings
 ─────────────────────────────────────────────────────────

 🟠 P1: Email Confirmation Disabled

 Issue: Users can signup and immediately access the app
        without verifying their email address.

 Risks:
 ├── Fake accounts with invalid emails
 ├── Typosquatting ([email protected])
 ├── No verified communication channel
 └── Potential for abuse

 Recommendation:
 Supabase Dashboard → Authentication → Email Templates
 → Enable "Confirm email"

 ─────────────────────────────────────────────────────────

 🟡 P2: Short Minimum Password Length

 Issue: Minimum password length is 6 characters.

 Recommendation: Increase to 8-12 characters minimum.
 Supabase Dashboard → Authentication → Settings
 → Minimum password length

 ─────────────────────────────────────────────────────────

 🟡 P2: Wildcard CORS Origin

 Issue: CORS allows requests from any origin (*).

 Recommendation: Restrict to your domains only.
 Supabase Dashboard → Authentication → URL Configuration
 → Site URL and Redirect URLs

 ─────────────────────────────────────────────────────────

 ℹ️ INFO: Anonymous Auth Enabled

 Note: Anonymous authentication is enabled.

 This is fine if intentional (guest access).
 Review if you expect all users to be authenticated.

 ─────────────────────────────────────────────────────────
 Summary
 ─────────────────────────────────────────────────────────

 Auth Methods: 5 enabled
 OAuth Providers: 3

 Findings:
 ├── P1 (High): 1 - Email confirmation disabled
 ├── P2 (Medium): 2 - Password length, CORS
 └── Info: 1 - Anonymous auth enabled

 Recommended Actions:
 1. Enable email confirmation
 2. Increase minimum password length
 3. Restrict CORS to specific domains
 4. Review if anonymous auth is needed

═══════════════════════════════════════════════════════════

セキュリティチェックリスト

メール認証
設定推奨事項設定が不適切な場合のリスク
メール確認✅ 必須偽アカウント
パスワードの長さ8 文字以上脆弱なパスワード
パスワードの複雑さ有効化推測されやすい
レート制限有効化ブルートフォース攻撃
OAuth の設定
設定推奨事項設定が不適切な場合のリスク
検証済みプロバイダーのみはいアカウントの乗っ取り
適切なリダイレクト URL特定の URLOAuth リダイレクト攻撃
state パラメーター有効CSRF 攻撃
セッションのセキュリティ
設定推奨事項設定が不適切な場合のリスク
JWT の有効期限を短くする1 時間以内トークンの窃取
リフレッシュトークンのローテーション有効トークンの再利用
セキュア Cookie フラグHttpOnly、Secure、SameSiteXSS、CSRF

コンテキスト出力

{
  "auth_config": {
    "timestamp": "2025-01-31T12:30:00Z",
    "methods": {
      "email": {
        "enabled": true,
        "signup_open": true,
        "email_confirmation": false,
        "min_password_length": 6
      },
      "phone": {
        "enabled": true,
        "provider": "twilio"
      },
      "magic_link": {
        "enabled": true,
        "otp_expiry": 300
      },
      "oauth": {
        "enabled": true,
        "providers": ["google", "github", "discord"]
      },
      "anonymous": {
        "enabled": true
      }
    },
    "findings": [
      {
        "severity": "P1",
        "issue": "Email confirmation disabled",
        "recommendation": "Enable email confirmation in dashboard"
      }
    ]
  }
}

よくある認証の脆弱性

1. メール確認が無効
// User can signup with any email
const { data, error } = await supabase.auth.signUp({
  email: '[email protected]',  // No verification needed
  password: 'password123'
})
// User is immediately authenticated
2. 脆弱なパスワードポリシー
// Weak password accepted
await supabase.auth.signUp({
  email: '[email protected]',
  password: '123456'  // Accepted with min length 6
})
3. 不要なオープンサインアップ

アプリで管理者が作成したユーザーのみを受け入れる場合:

-- Disable public signup via dashboard
-- Or use invite-only flow

修正例

メール確認を有効にする
  1. Supabase Dashboard → Authentication → Email Templates
  2. 「Confirm email」を有効にする
  3. 確認メールのテンプレートをカスタマイズする
  4. アプリで未確認ユーザーを処理する
パスワード要件を強化する
  1. Dashboard → Authentication → Settings
  2. 最小文字数を 8 以上に設定する
  3. パスワード強度チェックの有効化を検討する
CORS を制限する
  1. Dashboard → Authentication → URL Configuration
  2. Site URL を指定する
  3. Redirect URLs には自分のドメインのみを追加する
  4. ワイルドカードの項目を削除する

必須:コンテキストファイルを段階的に更新する

⚠️ このスキルは、最後にまとめてではなく、実行中に追跡ファイルを段階的に更新する必要があります。

重要なルール:作業しながら書き込む

すべての書き込みを最後にまとめて行わないでください。代わりに、次の手順に従ってください。

  1. 各認証方式を確認する前に → 操作を .sb-pentest-audit.log に記録する
  2. 設定を分析するたびに → .sb-pentest-context.json を直ちに更新する
  3. 調査結果が見つかるたびに → 重大度を直ちに記録する

これにより、スキルが中断、クラッシュ、またはタイムアウトした場合でも、その時点までのすべての調査結果が保持されます。

必須アクション(段階的)
  1. 結果を .sb-pentest-context.json に更新します:

    {
      "auth_config": {
        "timestamp": "...",
        "methods": { ... },
        "findings": [ ... ]
      }
    }
    
  2. .sb-pentest-audit.log に記録します:

    [TIMESTAMP] [supabase-audit-auth-config] [START] Auditing auth configuration
    [TIMESTAMP] [supabase-audit-auth-config] [FINDING] P1: Email confirmation disabled
    [TIMESTAMP] [supabase-audit-auth-config] [CONTEXT_UPDATED] .sb-pentest-context.json updated
    
  3. ファイルが存在しない場合は、書き込み前に作成します。

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

必須:証拠の収集

📁 証拠ディレクトリ: .sb-pentest-evidence/05-auth-audit/

作成する証拠ファイル
ファイル内容
auth-settings.json認証設定一式
証拠の形式
{
  "evidence_id": "AUTH-CFG-001",
  "timestamp": "2025-01-31T10:50:00Z",
  "category": "auth-audit",
  "type": "auth_configuration",

  "endpoint": "https://abc123def.supabase.co/auth/v1/",

  "configuration": {
    "email_auth": {
      "enabled": true,
      "signup_open": true,
      "email_confirmation_required": false,
      "min_password_length": 6
    },
    "phone_auth": {
      "enabled": true,
      "provider": "twilio"
    },
    "oauth_providers": ["google", "github", "discord"],
    "anonymous_auth": true
  },

  "security_settings": {
    "rate_limiting": {
      "signup": "3/hour",
      "token": "30/hour",
      "recovery": "3/hour"
    },
    "jwt_expiry": 3600,
    "cors_origins": "*"
  },

  "findings": [
    {
      "severity": "P1",
      "issue": "Email confirmation disabled",
      "impact": "Users can signup without verifying email",
      "recommendation": "Enable email confirmation"
    },
    {
      "severity": "P2",
      "issue": "Weak password policy",
      "impact": "Minimum 6 characters allows weak passwords",
      "recommendation": "Increase to 8+ characters"
    }
  ]
}
curl-commands.sh に追加
# === AUTH CONFIGURATION TESTS ===
# Test signup availability
curl -X POST "$SUPABASE_URL/auth/v1/signup" \
  -H "apikey: $ANON_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "test123456"}'

# Test password policy (weak password)
curl -X POST "$SUPABASE_URL/auth/v1/signup" \
  -H "apikey: $ANON_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "123456"}'

関連スキル

  • supabase-audit-auth-signup — サインアップフローをテストします
  • supabase-audit-auth-users — ユーザー列挙をテストします
  • supabase-audit-rls — 認証ユーザーには RLS による保護が必要です

コメント