Loading...
Loading...
Compare original and translation side by side
🔴 CRITICAL: PROGRESSIVE FILE UPDATES REQUIREDYou MUST write to context files AS YOU GO, not just at the end.
- Write to
IMMEDIATELY after each discovery.sb-pentest-context.json- Log to
BEFORE and AFTER each action.sb-pentest-audit.log- DO NOT wait until the skill completes to update files
- If the skill crashes or is interrupted, all prior findings must already be saved
This is not optional. Failure to write progressively is a critical error.
🔴 关键:需逐步更新文件你必须逐步写入上下文文件,而不是只在最后写入。
- 每次发现后立即写入
.sb-pentest-context.json- 每次操作前后都要记录到
.sb-pentest-audit.log- 不要等到技能完成后再更新文件
- 如果技能崩溃或被中断,所有已有的发现必须已保存
这不是可选要求。不逐步写入属于严重错误。
| Type | Purpose | Client Exposure |
|---|---|---|
| Anon Key | API authentication | ✅ Expected |
| Service Role Key | Admin access | ❌ Never |
| Access Token | User session | ⚠️ Dynamic only |
| Refresh Token | Token renewal | ⚠️ Dynamic only |
| 类型 | 用途 | 客户端暴露情况 |
|---|---|---|
| Anon Key | API认证 | ✅ 正常情况 |
| Service Role Key | 管理员权限 | ❌ 绝不允许 |
| Access Token | 用户会话 | ⚠️ 仅动态生成 |
| Refresh Token | 令牌续期 | ⚠️ 仅动态生成 |
// Supabase API keys are JWTs
const SUPABASE_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'// Supabase API密钥属于JWT
const SUPABASE_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'// ❌ Should never be hardcoded
const userToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiZW1haWwiOiJ1c2VyQGV4YW1wbGUuY29tIn0...'// ❌ 绝不应该硬编码
const userToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiZW1haWwiOiJ1c2VyQGV4YW1wbGUuY29tIn0...'// Code referencing where JWTs are stored
localStorage.getItem('supabase.auth.token')
localStorage.getItem('sb-abc123-auth-token')
sessionStorage.getItem('supabase_session')// 引用JWT存储位置的代码
localStorage.getItem('supabase.auth.token')
localStorage.getItem('sb-abc123-auth-token')
sessionStorage.getItem('supabase_session')Extract JWTs from https://myapp.example.com从 https://myapp.example.com 提取JWTExtract and analyze all JWTs from https://myapp.example.com从 https://myapp.example.com 提取并分析所有JWT═══════════════════════════════════════════════════════════
JWT EXTRACTION RESULTS
═══════════════════════════════════════════════════════════
Found: 3 JWTs
─────────────────────────────────────────────────────────
JWT #1: Supabase Anon Key
─────────────────────────────────────────────────────────
Type: API Key (anon)
Status: ✅ Expected in client code
Header:
├── alg: HS256
└── typ: JWT
Payload:
├── iss: supabase
├── ref: abc123def
├── role: anon
├── iat: 2021-12-20T00:00:00Z
└── exp: 2031-12-20T00:00:00Z
Location: /static/js/main.js:1247
─────────────────────────────────────────────────────────
JWT #2: Hardcoded User Token ⚠️
─────────────────────────────────────────────────────────
Type: User Access Token
Status: ⚠️ P1 - Should not be hardcoded
Header:
├── alg: HS256
└── typ: JWT
Payload:
├── sub: 12345678-1234-1234-1234-123456789012
├── email: developer@company.com
├── role: authenticated
├── iat: 2025-01-15T10:00:00Z
└── exp: 2025-01-15T11:00:00Z (EXPIRED)
Location: /static/js/debug.js:45
Risk: This token may belong to a real user account.
Even if expired, it reveals user information.
─────────────────────────────────────────────────────────
JWT #3: Storage Reference
─────────────────────────────────────────────────────────
Type: Storage Key Pattern
Status: ℹ️ Informational
Pattern: localStorage.getItem('sb-abc123def-auth-token')
Location: /static/js/auth.js:89
Note: This is the expected storage key for user sessions.
Actual token value is set at runtime.
══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
JWT 提取结果
═══════════════════════════════════════════════════════════
找到:3个JWT
─────────────────────────────────────────────────────────
JWT #1: Supabase Anon Key
─────────────────────────────────────────────────────────
类型:API密钥(anon)
状态:✅ 客户端代码中正常存在
头部:
├── alg: HS256
└── typ: JWT
负载:
├── iss: supabase
├── ref: abc123def
├── role: anon
├── iat: 2021-12-20T00:00:00Z
└── exp: 2031-12-20T00:00:00Z
位置:/static/js/main.js:1247
─────────────────────────────────────────────────────────
JWT #2: 硬编码用户令牌 ⚠️
─────────────────────────────────────────────────────────
类型:用户访问令牌
状态:⚠️ P1 - 不应硬编码
头部:
├── alg: HS256
└── typ: JWT
负载:
├── sub: 12345678-1234-1234-1234-123456789012
├── email: developer@company.com
├── role: authenticated
├── iat: 2025-01-15T10:00:00Z
└── exp: 2025-01-15T11:00:00Z(已过期)
位置:/static/js/debug.js:45
风险:该令牌可能属于真实用户账户。
即使已过期,仍会泄露用户信息。
─────────────────────────────────────────────────────────
JWT #3: 存储引用
─────────────────────────────────────────────────────────
类型:存储键模式
状态:ℹ️ 信息性
模式:localStorage.getItem('sb-abc123def-auth-token')
位置:/static/js/auth.js:89
说明:这是用户会话的预期存储键。
实际令牌值在运行时设置。
═══════════════════════════════════════════════════════════| Claim | Description | Security Impact |
|---|---|---|
| User ID | Identifies specific user |
| User email | PII exposure if hardcoded |
| Permission level | |
| Expiration | Expired tokens less risky |
| Issued at | Indicates when created |
| 声明 | 描述 | 安全影响 |
|---|---|---|
| 用户ID | 识别特定用户 |
| 用户邮箱 | 硬编码时会泄露个人身份信息(PII) |
| 权限级别 | |
| 过期时间 | 过期令牌风险较低 |
| 签发时间 | 指示令牌创建时间 |
| Claim | Description |
|---|---|
| Project reference |
| Should be "supabase" |
| Authenticator assurance level |
| Authentication methods used |
| 声明 | 描述 |
|---|---|
| 项目引用 |
| 应为 "supabase" |
| 认证器保障级别 |
| 使用的认证方法 |
🔴 Service role key exposed (role: service_role)
→ Immediate key rotation required🔴 暴露服务角色密钥(role: service_role)
→ 需立即轮换密钥🟠 User token hardcoded with PII (email, sub visible)
→ Remove from code, may need to notify user🟠 硬编码包含个人身份信息的用户令牌(可见email、sub)
→ 从代码中移除,可能需要通知用户🟡 Expired test token in code
→ Clean up, potential information disclosure🟡 代码中存在过期测试令牌
→ 清理代码,存在潜在信息泄露风险.sb-pentest-context.json{
"jwts": {
"found": 3,
"api_keys": [
{
"type": "anon",
"project_ref": "abc123def",
"location": "/static/js/main.js:1247"
}
],
"user_tokens": [
{
"type": "access_token",
"hardcoded": true,
"severity": "P1",
"claims": {
"sub": "12345678-1234-1234-1234-123456789012",
"email": "developer@company.com",
"expired": true
},
"location": "/static/js/debug.js:45"
}
],
"storage_patterns": [
{
"pattern": "sb-abc123def-auth-token",
"storage": "localStorage",
"location": "/static/js/auth.js:89"
}
]
}
}.sb-pentest-context.json{
"jwts": {
"found": 3,
"api_keys": [
{
"type": "anon",
"project_ref": "abc123def",
"location": "/static/js/main.js:1247"
}
],
"user_tokens": [
{
"type": "access_token",
"hardcoded": true,
"severity": "P1",
"claims": {
"sub": "12345678-1234-1234-1234-123456789012",
"email": "developer@company.com",
"expired": true
},
"location": "/static/js/debug.js:45"
}
],
"storage_patterns": [
{
"pattern": "sb-abc123def-auth-token",
"storage": "localStorage",
"location": "/static/js/auth.js:89"
}
]
}
}// ❌ Never hardcode user tokens
const adminToken = 'eyJhbGciOiJIUzI1NiI...'
fetch('/api/admin', {
headers: { Authorization: `Bearer ${adminToken}` }
})// ❌ 绝不硬编码用户令牌
const adminToken = 'eyJhbGciOiJIUzI1NiI...'
fetch('/api/admin', {
headers: { Authorization: `Bearer ${adminToken}` }
})// ✅ Get token from Supabase session
const { data: { session } } = await supabase.auth.getSession()
fetch('/api/admin', {
headers: { Authorization: `Bearer ${session.access_token}` }
})// ✅ 从Supabase会话获取令牌
const { data: { session } } = await supabase.auth.getSession()
fetch('/api/admin', {
headers: { Authorization: `Bearer ${session.access_token}` }
}).sb-pentest-audit.log.sb-pentest-context.json.sb-pentest-audit.log.sb-pentest-audit.log.sb-pentest-context.json.sb-pentest-audit.log.sb-pentest-context.json{
"jwts": {
"found": 3,
"api_keys": [ ... ],
"user_tokens": [ ... ],
"storage_patterns": [ ... ]
}
}.sb-pentest-audit.log[TIMESTAMP] [supabase-extract-jwt] [START] Beginning JWT extraction
[TIMESTAMP] [supabase-extract-jwt] [SUCCESS] Found 3 JWTs
[TIMESTAMP] [supabase-extract-jwt] [CONTEXT_UPDATED] .sb-pentest-context.json updated.sb-pentest-context.json{
"jwts": {
"found": 3,
"api_keys": [ ... ],
"user_tokens": [ ... ],
"storage_patterns": [ ... ]
}
}.sb-pentest-audit.log[时间戳] [supabase-extract-jwt] [开始] 开始JWT提取
[时间戳] [supabase-extract-jwt] [成功] 找到3个JWT
[时间戳] [supabase-extract-jwt] [上下文已更新] .sb-pentest-context.json已更新.sb-pentest-evidence/02-extraction/.sb-pentest-evidence/02-extraction/| File | Content |
|---|---|
| All JWTs found with analysis |
| 文件 | 内容 |
|---|---|
| 所有找到的JWT及分析结果 |
{
"evidence_id": "EXT-JWT-001",
"timestamp": "2025-01-31T10:08:00Z",
"category": "extraction",
"type": "jwt_extraction",
"jwts_found": [
{
"type": "anon_key",
"severity": "info",
"location": "/static/js/main.js:1247",
"decoded_payload": {
"iss": "supabase",
"ref": "abc123def",
"role": "anon"
}
},
{
"type": "hardcoded_user_token",
"severity": "P1",
"location": "/static/js/debug.js:45",
"decoded_payload": {
"sub": "[REDACTED]",
"email": "[REDACTED]@example.com",
"role": "authenticated",
"exp": "2025-01-15T11:00:00Z"
},
"expired": true,
"issue": "Hardcoded user token with PII"
}
],
"storage_patterns_found": [
{
"pattern": "localStorage.getItem('sb-abc123def-auth-token')",
"location": "/static/js/auth.js:89"
}
]
}{
"evidence_id": "EXT-JWT-001",
"timestamp": "2025-01-31T10:08:00Z",
"category": "extraction",
"type": "jwt_extraction",
"jwts_found": [
{
"type": "anon_key",
"severity": "info",
"location": "/static/js/main.js:1247",
"decoded_payload": {
"iss": "supabase",
"ref": "abc123def",
"role": "anon"
}
},
{
"type": "hardcoded_user_token",
"severity": "P1",
"location": "/static/js/debug.js:45",
"decoded_payload": {
"sub": "[已脱敏]",
"email": "[已脱敏]@example.com",
"role": "authenticated",
"exp": "2025-01-15T11:00:00Z"
},
"expired": true,
"issue": "硬编码包含个人身份信息的用户令牌"
}
],
"storage_patterns_found": [
{
"pattern": "localStorage.getItem('sb-abc123def-auth-token')",
"location": "/static/js/auth.js:89"
}
]
}supabase-extract-anon-keysupabase-extract-service-keysupabase-audit-auth-configsupabase-extract-anon-keysupabase-extract-service-keysupabase-audit-auth-config