supabase-audit-tables-list

List all tables exposed via the Supabase PostgREST API to identify the attack surface.

yoanbernabeu/supabase-pentest-skills363 installsMITSynced Aug 26

Works with

Claude CodeCursorCodex CLIGitHub CopilotGemini CLI
---
name: supabase-audit-tables-list
description: List all tables exposed via the Supabase PostgREST API to identify the attack surface.
license: MIT
---

# List Exposed Tables

> ๐Ÿ”ด **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 discovery**
> - Log to `.sb-pentest-audit.log` **BEFORE and AFTER each action**
> - **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 all database tables exposed through the Supabase PostgREST API.

## When to Use This Skill

- To understand the API attack surface
- Before testing RLS policies
- To inventory exposed data models
- As part of a comprehensive security audit

## Prerequisites

- Supabase URL extracted (auto-invokes if needed)
- Anon key extracted (auto-invokes if needed)

## How It Works

Supabase exposes tables via PostgREST at:
```
https://[project-ref].supabase.co/rest/v1/
```

The skill uses the OpenAPI schema endpoint to enumerate tables:
```
https://[project-ref].supabase.co/rest/v1/?apikey=[anon-key]
```

## What Gets Exposed

By default, Supabase exposes tables in the `public` schema. Tables are exposed when:

1. They exist in an exposed schema (default: `public`)
2. No explicit `REVOKE` has been done
3. PostgREST can see them

## Usage

### Basic Table List

```
List tables exposed on my Supabase project
```

### With Schema Information

```
List all exposed tables with column details
```

## Output Format

```
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
 EXPOSED TABLES
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

 Project: abc123def.supabase.co
 Schema: public
 Tables Found: 8

 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 Table Inventory
 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

 1. users
    โ”œโ”€โ”€ Columns: id, email, name, avatar_url, created_at
    โ”œโ”€โ”€ Primary Key: id (uuid)
    โ”œโ”€โ”€ RLS Status: Unknown (test with supabase-audit-rls)
    โ””โ”€โ”€ Risk: โš ๏ธ Contains user PII

 2. profiles
    โ”œโ”€โ”€ Columns: id, user_id, bio, website, social_links
    โ”œโ”€โ”€ Primary Key: id (uuid)
    โ”œโ”€โ”€ Foreign Key: user_id โ†’ auth.users
    โ””โ”€โ”€ Risk: โš ๏ธ Contains user PII

 3. posts
    โ”œโ”€โ”€ Columns: id, author_id, title, content, published, created_at
    โ”œโ”€โ”€ Primary Key: id (uuid)
    โ””โ”€โ”€ Risk: โ„น๏ธ Content data

 4. comments
    โ”œโ”€โ”€ Columns: id, post_id, user_id, content, created_at
    โ”œโ”€โ”€ Primary Key: id (uuid)
    โ””โ”€โ”€ Risk: โ„น๏ธ Content data

 5. orders
    โ”œโ”€โ”€ Columns: id, user_id, total, status, items, created_at
    โ”œโ”€โ”€ Primary Key: id (uuid)
    โ””โ”€โ”€ Risk: ๐Ÿ”ด Contains financial/transaction data

 6. products
    โ”œโ”€โ”€ Columns: id, name, description, price, stock, image_url
    โ”œโ”€โ”€ Primary Key: id (uuid)
    โ””โ”€โ”€ Risk: โ„น๏ธ Public catalog data

 7. settings
    โ”œโ”€โ”€ Columns: id, key, value, updated_at
    โ”œโ”€โ”€ Primary Key: id (uuid)
    โ””โ”€โ”€ Risk: โš ๏ธ May contain sensitive configuration

 8. api_keys
    โ”œโ”€โ”€ Columns: id, user_id, key_hash, name, last_used
    โ”œโ”€โ”€ Primary Key: id (uuid)
    โ””โ”€โ”€ Risk: ๐Ÿ”ด Contains secrets

 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 Summary
 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

 Total Tables: 8
 High Risk: 2 (orders, api_keys)
 Medium Risk: 3 (users, profiles, settings)
 Low Risk: 3 (posts, comments, products)

 Next Steps:
 โ”œโ”€โ”€ Run supabase-audit-tables-read to test actual data access
 โ”œโ”€โ”€ Run supabase-audit-rls to verify RLS policies
 โ””โ”€โ”€ Review high-risk tables first

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
```

## Risk Classification

Tables are classified by likely content:

| Risk | Table Patterns | Examples |
|------|---------------|----------|
| ๐Ÿ”ด High | Financial, secrets, auth | orders, payments, api_keys, secrets |
| โš ๏ธ Medium | User PII, config | users, profiles, settings, preferences |
| โ„น๏ธ Low | Public content | posts, products, categories, tags |

## Context Output

```json
{
  "tables": {
    "count": 8,
    "list": [
      {
        "name": "users",
        "schema": "public",
        "columns": ["id", "email", "name", "avatar_url", "created_at"],
        "primary_key": "id",
        "risk_level": "medium",
        "risk_reason": "Contains user PII"
      },
      {
        "name": "orders",
        "schema": "public",
        "columns": ["id", "user_id", "total", "status", "items", "created_at"],
        "primary_key": "id",
        "risk_level": "high",
        "risk_reason": "Contains financial data"
      }
    ],
    "by_risk": {
      "high": ["orders", "api_keys"],
      "medium": ["users", "profiles", "settings"],
      "low": ["posts", "comments", "products"]
    }
  }
}
```

## Hidden Tables

Some tables may not appear in the OpenAPI schema:

```
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
 ADDITIONAL DISCOVERY
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

 Common Tables Not in Schema (testing existence):
 โ”œโ”€โ”€ _prisma_migrations: โŒ Not found
 โ”œโ”€โ”€ schema_migrations: โŒ Not found
 โ”œโ”€โ”€ audit_log: โœ… EXISTS but not in OpenAPI
 โ””โ”€โ”€ internal_config: โŒ Not found

 Note: 'audit_log' exists but may have restricted access.
       Test with supabase-audit-tables-read.
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
```

## Schema Analysis

The skill also checks for non-public schemas:

```
Schema Exposure Check:
โ”œโ”€โ”€ public: โœ… Exposed (8 tables)
โ”œโ”€โ”€ auth: โŒ Not directly exposed (expected)
โ”œโ”€โ”€ storage: โŒ Not directly exposed (expected)
โ”œโ”€โ”€ extensions: โŒ Not exposed (good)
โ””โ”€โ”€ custom_schema: โš ๏ธ Exposed (3 tables) - Review if intentional
```

## Common Issues

โŒ **Problem:** No tables found
โœ… **Solution:**
- Check if anon key is valid
- Verify project URL is correct
- The API may be disabled in project settings

โŒ **Problem:** Too many tables listed
โœ… **Solution:** This may indicate overly permissive schema exposure. Consider:
```sql
-- Restrict exposed schemas
ALTER ROLE anon SET search_path TO public;
```

โŒ **Problem:** Sensitive tables exposed
โœ… **Solution:** Either remove from public schema or implement strict RLS.

## Recommendations by Table Type

### User Tables

```sql
-- Ensure RLS is enabled
ALTER TABLE users ENABLE ROW LEVEL SECURITY;

-- Users can only see their own data
CREATE POLICY "Users see own data" ON users
  FOR SELECT USING (auth.uid() = id);
```

### Order/Payment Tables

```sql
-- Strict RLS for financial data
ALTER TABLE orders ENABLE ROW LEVEL SECURITY;

CREATE POLICY "Users see own orders" ON orders
  FOR SELECT USING (auth.uid() = user_id);

-- No public access even for admins via API
-- Use Edge Functions for admin operations
```

### Secret Tables

```sql
-- Consider not exposing at all
REVOKE ALL ON TABLE api_keys FROM anon, authenticated;

-- Or use views that hide sensitive columns
CREATE VIEW public.api_keys_safe AS
  SELECT id, name, last_used FROM api_keys;
```

## MANDATORY: Progressive Context File Updates

โš ๏ธ **This skill MUST update tracking files PROGRESSIVELY during execution, NOT just at the end.**

### Critical Rule: Write As You Go

**DO NOT** batch all writes at the end. Instead:

1. **Before starting any action** โ†’ Log the action to `.sb-pentest-audit.log`
2. **After each table discovered** โ†’ Immediately update `.sb-pentest-context.json`
3. **After each significant step** โ†’ Log completion to `.sb-pentest-audit.log`

This ensures that if the skill is interrupted, crashes, or times out, all findings up to that point are preserved.

### Required Actions (Progressive)

1. **Update `.sb-pentest-context.json`** with results:
   ```json
   {
     "tables": {
       "count": 8,
       "list": [ ... ],
       "by_risk": { "high": [], "medium": [], "low": [] }
     }
   }
   ```

2. **Log to `.sb-pentest-audit.log`**:
   ```
   [TIMESTAMP] [supabase-audit-tables-list] [START] Listing exposed tables
   [TIMESTAMP] [supabase-audit-tables-list] [SUCCESS] Found 8 tables
   [TIMESTAMP] [supabase-audit-tables-list] [CONTEXT_UPDATED] .sb-pentest-context.json updated
   ```

3. **If files don't exist**, create them before writing.

**FAILURE TO UPDATE CONTEXT FILES IS NOT ACCEPTABLE.**

## MANDATORY: Evidence Collection

๐Ÿ“ **Evidence Directory:** `.sb-pentest-evidence/03-api-audit/tables/`

### Evidence Files to Create

| File | Content |
|------|---------|
| `tables-list.json` | Complete list of exposed tables |
| `tables-metadata.json` | Column details and types per table |
| `openapi-schema.json` | Raw OpenAPI/PostgREST schema |

### Evidence Format

```json
{
  "evidence_id": "API-TBL-001",
  "timestamp": "2025-01-31T10:15:00Z",
  "category": "api-audit",
  "type": "table_enumeration",

  "request": {
    "method": "GET",
    "url": "https://abc123def.supabase.co/rest/v1/",
    "headers": {
      "apikey": "[REDACTED]"
    },
    "curl_command": "curl -s 'https://abc123def.supabase.co/rest/v1/' -H 'apikey: $ANON_KEY'"
  },

  "tables_found": [
    {
      "name": "users",
      "schema": "public",
      "columns": ["id", "email", "name", "created_at"],
      "primary_key": "id",
      "risk_level": "high",
      "risk_reason": "Contains PII"
    },
    {
      "name": "orders",
      "schema": "public",
      "columns": ["id", "user_id", "total", "status"],
      "primary_key": "id",
      "risk_level": "high",
      "risk_reason": "Financial data"
    }
  ],

  "summary": {
    "total_tables": 8,
    "high_risk": 2,
    "medium_risk": 3,
    "low_risk": 3
  }
}
```

### Add to curl-commands.sh

```bash
# === TABLE ENUMERATION ===
# List all exposed tables via OpenAPI schema
curl -s "$SUPABASE_URL/rest/v1/" -H "apikey: $ANON_KEY"
```

## Related Skills

- `supabase-audit-tables-read` โ€” Test actual data access
- `supabase-audit-rls` โ€” Verify RLS policies
- `supabase-audit-rpc` โ€” Check exposed functions

More API Design skills

lark-event

larksuite/cli

Lark/Feishu real-time event listening / subscribing / consuming: stream events as NDJSON via `lark-cli event consume <EventKey>` (covers IM messages/reactions/chat changes, Approval status changes, Task updates, VC meeting started/joined/ended, Minutes generated, Whiteboard updated, etc.). Use for Lark bots, real-time message processing, long-running subscribers, streaming webhook/push handlers. Supports `--max-events` / `--timeout` bounded runs and a stderr ready-marker contract โ€” designed for AI agents running as subprocesses.

417.8k

lark-contact

larksuite/cli

้ฃžไนฆ / Lark ้€š่ฎฏๅฝ•:ๆŒ‰ๅง“ๅ / ้‚ฎ็ฎฑ่งฃๆžๆˆ open_id,ๆˆ–ๆŒ‰ open_id ๅๆŸฅๅง“ๅ / ้ƒจ้—จ / ้‚ฎ็ฎฑ / ่”็ณปๆ–นๅผ / ไธชไบบ็Šถๆ€ / ็ญพๅ,ไปฅๅŠๆŒ‰ๅ…ณ้”ฎ่ฏๆœ็ดขๅฝ“ๅ‰็”จๆˆทๅฏ่ง็š„ๆœบๅ™จไบบ / ๆ™บ่ƒฝไฝ“(agent)ใ€‚ๅฝ“็”จๆˆทๆๅˆฐไธ€ไธชๅๅญ—่ฆไธ‹ไธ€ๆญฅๅ‘ๆถˆๆฏ / ๆŽ’ๆ—ฅ็จ‹,ๆˆ–ๆ‹ฟๅˆฐ open_id ๆƒณๆŸฅๅ…ทไฝ“ไฟกๆฏๆ—ถไฝฟ็”จใ€‚ไธ่ดŸ่ดฃ้ƒจ้—จๆ ‘้ๅކใ€ๆŒ‰้ƒจ้—จๅˆ—ๅ‘˜ๅทฅใ€็ป„็ป‡ๆžถๆž„ๅ›พ,่ฟ™็ฑป้œ€ๆฑ‚่ตฐๅŽŸ็”Ÿ OpenAPIใ€‚

417.5k

lark-openapi-explorer

larksuite/cli

้ฃžไนฆ/Lark ๅŽŸ็”Ÿ OpenAPI ๆŽข็ดข๏ผšไปŽๅฎ˜ๆ–นๆ–‡ๆกฃๅบ“ไธญๆŒ–ๆŽ˜ๆœช็ป CLI ๅฐ่ฃ…็š„ๅŽŸ็”Ÿ OpenAPI ๆŽฅๅฃใ€‚ๅฝ“็”จๆˆท็š„้œ€ๆฑ‚ๆ— ๆณ•่ขซ็Žฐๆœ‰ lark-* skill ๆˆ– lark-cli ๅทฒๆณจๅ†Œๅ‘ฝไปคๆปก่ถณ๏ผŒ้œ€่ฆๆŸฅๆ‰พๅนถ่ฐƒ็”จๅŽŸ็”Ÿ้ฃžไนฆ OpenAPI ๆ—ถไฝฟ็”จใ€‚

415.8k

โ† All API Design skills

Check your AI visibility

One URL in, a 0โ€“100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free ยท No signup ยท No trial clock

SEE THE DIRECTORY