关于 supabase-evidence
supabase-evidence 是用于专业安全审计的证据管理技能,面向执行 Supabase 审计并编写报告的流程。它要求在收集过程中逐步保存证据,并维护目录结构、时间线和可复现的 curl 命令。
主要功能
- 01初始化审计证据目录
- 02逐步记录请求与响应
- 03维护审计时间线
- 04整理可复现的 curl 命令
- 05按规则脱敏敏感数据
适用场景
- 01为安全审计保存可核验的证据
- 02记录测试过程以便复现
- 03为合规或法律报告整理材料
- 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 | 数据样本(已脱敏) | 已遮盖个人身份信息的样本行 |
| 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.jsonadmin-function-no-auth-20250131-143000.json
强制要求:更新证据文件
⚠️ 执行过程中必须逐步保存证据。
关键规则:边执行边保存
不要等到最后才批量处理所有证据。请按以下步骤操作:
- 每项测试之前 → 创建证据文件占位符
- 每次请求之后 → 立即保存请求详情
- 每次响应之后 → 立即保存响应
- 分析之后 → 将分析内容添加到证据文件
初始化目录
审计开始时,创建:
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 自动调用。每项审计技能都应:
- 将证据保存到相应的子目录
- 使用统一的命名约定
- 向
curl-commands.sh添加条目 - 对重要发现更新
timeline.md
相关技能
supabase-pentest— 初始化证据收集的编排器supabase-report— 使用证据生成全面报告- 所有审计技能 — 向各自的目录提供证据
评论
支持 Markdown