supabase-audit-functions
Discover and test Supabase Edge Functions for security vulnerabilities and misconfigurations.
What this skill does
# Edge Functions Audit
> ๐ด **CRITICAL: PROGRESSIVE FILE UPDATES REQUIRED**
>
> You MUST write to context files **AS YOU GO**, not just at the end.
> - Write to `.sb-pentest-context.json` **IMMEDIATELY after each function tested**
> - Log to `.sb-pentest-audit.log` **BEFORE and AFTER each function test**
> - **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.**
This skill discovers and tests Supabase Edge Functions for security issues.
## When to Use This Skill
- To discover exposed Edge Functions
- To test function authentication requirements
- To check for input validation issues
- As part of comprehensive security audit
## Prerequisites
- Supabase URL available
- Detection completed
## Understanding Edge Functions
Supabase Edge Functions are Deno-based serverless functions:
```
https://[project].supabase.co/functions/v1/[function-name]
```
| Security Aspect | Consideration |
|-----------------|---------------|
| Authentication | Functions can require JWT or be public |
| CORS | Cross-origin access control |
| Input Validation | User input handling |
| Secrets | Environment variable exposure |
## Tests Performed
| Test | Purpose |
|------|---------|
| Function discovery | Find exposed functions |
| Auth requirements | Check if JWT required |
| Input validation | Test for injection |
| Error handling | Check for information disclosure |
## Usage
### Basic Function Audit
```
Audit Edge Functions on my Supabase project
```
### Test Specific Function
```
Test the process-payment Edge Function for security issues
```
## Output Format
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
EDGE FUNCTIONS AUDIT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Project: abc123def.supabase.co
Endpoint: https://abc123def.supabase.co/functions/v1/
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Function Discovery
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Discovery Method: Common name enumeration + client code analysis
Functions Found: 5
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. hello-world
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Endpoint: /functions/v1/hello-world
Method: GET, POST
Authentication Test:
โโโ Without JWT: โ
200 OK
โโโ Status: โน๏ธ Public function (no auth required)
Response:
```json
{"message": "Hello, World!"}
```
Assessment: โ
APPROPRIATE
Simple public endpoint, no sensitive operations.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2. process-payment
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Endpoint: /functions/v1/process-payment
Method: POST
Authentication Test:
โโโ Without JWT: โ 401 Unauthorized
โโโ With valid JWT: โ
200 OK
โโโ Status: โ
Authentication required
Input Validation Test:
โโโ Missing amount: โ 400 Bad Request (good)
โโโ Negative amount: โ 400 Bad Request (good)
โโโ String amount: โ 400 Bad Request (good)
โโโ Valid input: โ
200 OK
Error Response Test:
โโโ Error format: Generic message (good)
โโโ Stack trace: โ Not exposed (good)
Assessment: โ
PROPERLY SECURED
Requires auth, validates input, safe error handling.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3. get-user-data
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Endpoint: /functions/v1/get-user-data
Method: GET
Authentication Test:
โโโ Without JWT: โ 401 Unauthorized
โโโ Status: โ
Authentication required
Authorization Test:
โโโ Request own data: โ
200 OK
โโโ Request other user's data: โ
200 OK โ ๐ด P0!
โโโ Status: ๐ด BROKEN ACCESS CONTROL
Test:
```bash
# As user A, request user B's data
curl https://abc123def.supabase.co/functions/v1/get-user-data?user_id=user-b-id \
-H "Authorization: Bearer [user-a-token]"
# Returns user B's data!
```
Finding: ๐ด P0 - IDOR VULNERABILITY
Function accepts user_id parameter without verifying
that the authenticated user is requesting their own data.
Fix:
```typescript
// In Edge Function
const { user_id } = await req.json();
const jwt_user = getUser(req); // From JWT
// Verify ownership
if (user_id !== jwt_user.id) {
return new Response('Forbidden', { status: 403 });
}
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
4. admin-panel
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Endpoint: /functions/v1/admin-panel
Method: GET, POST
Authentication Test:
โโโ Without JWT: โ 401 Unauthorized
โโโ With regular user JWT: โ
200 OK โ ๐ด P0!
โโโ Status: ๐ด MISSING ROLE CHECK
Finding: ๐ด P0 - PRIVILEGE ESCALATION
Admin function accessible to any authenticated user.
No role verification in function code.
Fix:
```typescript
// Verify admin role
const user = getUser(req);
const { data: profile } = await supabase
.from('profiles')
.select('is_admin')
.eq('id', user.id)
.single();
if (!profile?.is_admin) {
return new Response('Forbidden', { status: 403 });
}
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
5. webhook-handler
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Endpoint: /functions/v1/webhook-handler
Method: POST
Authentication Test:
โโโ Without JWT: โ
200 OK (expected for webhooks)
โโโ Status: โน๏ธ Public (webhook endpoints are typically public)
Webhook Security Test:
โโโ Signature validation: โ ๏ธ Unable to test (need valid signature)
โโโ Rate limiting: Unknown
Error Response Test:
```json
{
"error": "Invalid signature",
"expected": "sha256=abc123...",
"received": "sha256=xyz789..."
}
```
Finding: ๐ P1 - INFORMATION DISCLOSURE
Error response reveals expected signature format.
Could help attacker understand validation mechanism.
Fix:
```typescript
// Generic error, log details server-side
if (!validSignature) {
console.error(`Invalid signature: expected ${expected}, got ${received}`);
return new Response('Unauthorized', { status: 401 });
}
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Functions Found: 5
Security Assessment:
โโโ โ
Secure: 2 (hello-world, process-payment)
โโโ ๐ด P0: 2 (get-user-data IDOR, admin-panel privilege escalation)
โโโ ๐ P1: 1 (webhook-handler info disclosure)
Critical Findings:
1. IDOR in get-user-data - any user can access any user's data
2. Missing role check in admin-panel - any user is admin
Priority Actions:
1. Fix get-user-data to verify user owns requested data
2. Add admin role verification to admin-panel
3. Fix webhook-handler error messages
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
## Common Function Vulnerabilities
| Vulnerability | Description | Severity |
|---------------|-------------|----------|
| No auth | Function accessible without JWT | P0-P2 |
| IDOR | User can access other users' data | P0 |
| Missing role check | Regular user accesses admin functions | P0 |
| Input injection | User input not validated | P0-P1 |
| Info disclosure | Errors reveal internal details | P1-P2 |
| CORS misconfigured | Accessible from unintended origins | P1-P2 |
## Function Discovery Methods
### 1. Client Code Analysis
```javascript
// Look for function invocations in client code
supabase.functions.invoke('function-name', {...})
fetch('/functions/v1/function-name', {...})
```
### 2. Common Name Enumeration
Tested function names:
- hello-world, hello, test
- process-payment, payment, checkout
- get-user-data, user, profile
- admin, admin-panel, dashboard
- webhook, webhook-handler, stripe-webhook
- send-email, notify, notification
### 3. Error Response Analysis
```
404 Not Found โ Function doesn't exist
401 Unauthorized โ Function exists, needs auth
200 OK โ Function exists, accessible
```
## Context Output
```json
{
"functions_audit": {
"tiRelated in Security
mac-ops
IncludedComprehensive macOS workstation operations โ diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.