Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
yoanbernabeu avatar

Supabase Extract Db String

  • 321 installs
  • 60 repo stars
  • Updated January 31, 2026
  • yoanbernabeu/supabase-pentest-skills

supabase-extract-db-string is a Claude Code pentest skill that detects exposed PostgreSQL connection strings in client-side Supabase code for developers auditing production-bound applications.

About

supabase-extract-db-string is a critical skill in the yoanbernabeu supabase-pentest-skills suite that scans client bundles for PostgreSQL connection strings such as postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres and Supavisor pooler URLs. Exposed strings allow direct database access, full RLS bypass, schema changes, and auth.users enumeration—classified as P0 severity. The skill mandates progressive writes to .sb-pentest-context.json after each discovery and logging to .sb-pentest-audit.log before and after every action so interrupted runs preserve findings. Evidence lands under .sb-pentest-evidence/02-extraction/db-string-exposure/ with connection-details.json and location.txt. Developers reach for this skill during every Supabase security audit, pre-production code review, or when suspecting DATABASE_URL leaks in NEXT_PUBLIC_* or VITE_* environment variables bundled to the browser.

  • Detects PostgreSQL connection strings exposed in client-side code
  • Progressive logging to .sb-pentest-context.json and .sb-pentest-audit.log
  • Designed for use in every Supabase security audit workflow
  • Part of the 24-skill Supabase pentest toolkit
  • 237 installs and passed multiple security audits

Supabase Extract Db String by the numbers

  • 321 all-time installs (skills.sh)
  • +13 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #610 of 2,203 Security skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yoanbernabeu/supabase-pentest-skills --skill supabase-extract-db-string

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs321
repo stars60
Last updatedJanuary 31, 2026
Repositoryyoanbernabeu/supabase-pentest-skills

How do you detect exposed Supabase database URLs?

Detect accidentally exposed PostgreSQL database connection strings in client-side Supabase code during security audits, saving findings to pentest context files.

Who is it for?

Developers or security reviewers auditing Supabase apps for client-side PostgreSQL connection string exposure before production deployment.

Skip if: Developers who need RLS policy testing, server-side migration authoring, or audits unrelated to credential leakage in frontend bundles.

When should I use this skill?

A Supabase security audit runs, production code is reviewed, or client-side database credential exposure is suspected.

What you get

P0 pentest findings, .sb-pentest-context.json updates, audit log entries, and redacted evidence files under .sb-pentest-evidence/02-extraction/db-string-exposure/.

  • P0 pentest finding records
  • Pentest context JSON updates
  • Redacted connection-string evidence files

By the numbers

  • Classifies exposed database connection strings as P0 critical severity
  • Writes evidence to .sb-pentest-evidence/02-extraction/db-string-exposure/ directory
  • Mandates progressive updates to .sb-pentest-context.json and .sb-pentest-audit.log

Files

SKILL.mdMarkdownGitHub ↗

Database Connection String Detection

🔴 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 detects if PostgreSQL database connection strings are accidentally exposed in client-side code.

When to Use This Skill

  • As part of every security audit
  • When reviewing code before production
  • When Supabase database access is suspected

Prerequisites

  • Target application accessible
  • Supabase detection completed (auto-invokes if needed)

Why This Is Critical

Exposed database connection strings allow:

ImpactDescription
🔴 Direct DB AccessBypass API, connect directly to PostgreSQL
🔴 Full Data AccessRead/write all data without RLS
🔴 Schema AccessView and modify database structure
🔴 User EnumerationAccess auth.users table directly

This is a P0 (Critical) finding requiring immediate action.

Connection String Patterns

Supabase Database URL

postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres

Connection String Components

ComponentExampleSensitivity
Hostdb.abc123.supabase.coMedium
Port5432Low
DatabasepostgresLow
UsernamepostgresMedium
Password[your-password]🔴 Critical

Pooler Connection (Supavisor)

postgresql://postgres.[project-ref]:[password]@aws-0-us-east-1.pooler.supabase.com:6543/postgres

Detection Patterns

1. Full Connection Strings

// ❌ CRITICAL - Full connection string
const dbUrl = 'postgresql://postgres:MySecretPass123@db.abc123.supabase.co:5432/postgres'

2. Environment Variable Leaks

// ❌ Exposed in client bundle
process.env.DATABASE_URL
process.env.POSTGRES_URL
process.env.SUPABASE_DB_URL

3. Partial Exposure

// ⚠️ Password exposed separately
const DB_PASSWORD = 'MySecretPass123'
const DB_HOST = 'db.abc123.supabase.co'

4. ORM Configuration

// ❌ Database config in client code
const prisma = new PrismaClient({
  datasources: {
    db: {
      url: 'postgresql://postgres:pass@db.abc123.supabase.co:5432/postgres'
    }
  }
})

Usage

Basic Check

Check for database connection strings on https://myapp.example.com

Deep Scan

Deep scan for DB credentials on https://myapp.example.com

Output Format

No Connection String Found (Good)

═══════════════════════════════════════════════════════════
 DATABASE CONNECTION STRING CHECK
═══════════════════════════════════════════════════════════

 Status: ✅ No database connection strings detected

 Scanned:
 ├── JavaScript bundles: 5 files analyzed
 ├── PostgreSQL patterns: None found
 ├── Connection strings: None found
 └── Password patterns: None found

 Result: PASS - No direct database credentials exposed
═══════════════════════════════════════════════════════════

Connection String FOUND (Critical)

═══════════════════════════════════════════════════════════
 🔴 CRITICAL: DATABASE CONNECTION STRING EXPOSED
═══════════════════════════════════════════════════════════

 Severity: P0 - CRITICAL
 Status: ❌ PostgreSQL connection string found in client code!

 ⚠️  IMMEDIATE ACTION REQUIRED ⚠️

 Connection String:
 postgresql://postgres:MySecr***@db.abc123def.supabase.co:5432/postgres
 (Password partially redacted in display, full value in context file)

 Parsed Components:
 ├── Host: db.abc123def.supabase.co
 ├── Port: 5432
 ├── Database: postgres
 ├── Username: postgres
 └── Password: [EXPOSED] ← CRITICAL

 Location:
 └── /static/js/api.chunk.js (line 234)
     const DATABASE_URL = 'postgresql://postgres:...'

 Impact Assessment:
 ├── 🔴 Direct PostgreSQL access possible
 ├── 🔴 All RLS policies bypassed
 ├── 🔴 Can access auth.users table
 ├── 🔴 Can modify database schema
 └── 🔴 Full data exfiltration possible

 ═══════════════════════════════════════════════════════════
 IMMEDIATE REMEDIATION STEPS
 ═══════════════════════════════════════════════════════════

 1. CHANGE DATABASE PASSWORD NOW
    → Supabase Dashboard > Settings > Database > Reset database password

 2. REMOVE FROM CLIENT CODE
    → Delete connection string from source code
    → Ensure DATABASE_URL is not in NEXT_PUBLIC_* or VITE_* env vars
    → Redeploy application

 3. AUDIT FOR ABUSE
    → Check Supabase logs for direct PostgreSQL connections
    → Review for unauthorized data access or modifications

 4. USE PROPER ARCHITECTURE
    → Client should ONLY use Supabase client library (REST API)
    → Direct DB access should ONLY be from:
      - Edge Functions
      - Server-side code
      - Migration tools

 Documentation:
 → https://supabase.com/docs/guides/database/connecting-to-postgres
 → https://supabase.com/docs/guides/functions

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

Context Output

{
  "findings": [
    {
      "id": "DB_CONNECTION_STRING_EXPOSED",
      "severity": "P0",
      "title": "PostgreSQL Connection String Exposed",
      "description": "Database connection string with password found in client-side code",
      "location": {
        "file": "/static/js/api.chunk.js",
        "line": 234
      },
      "evidence": {
        "host": "db.abc123def.supabase.co",
        "port": 5432,
        "database": "postgres",
        "username": "postgres",
        "password_exposed": true
      },
      "remediation": {
        "immediate": "Reset database password in Supabase Dashboard",
        "long_term": "Move DB operations to Edge Functions",
        "docs": "https://supabase.com/docs/guides/database/connecting-to-postgres"
      }
    }
  ],
  "supabase": {
    "db_string_exposed": true,
    "db_host": "db.abc123def.supabase.co"
  }
}

Partial Exposure

Even partial exposure is concerning:

═══════════════════════════════════════════════════════════
 ⚠️ PARTIAL DATABASE CREDENTIALS FOUND
═══════════════════════════════════════════════════════════

 Severity: P1 - High

 Found:
 ├── Database host: db.abc123def.supabase.co (line 45)
 ├── Database password: [16 char string] (line 89)
 └── Could potentially be combined for access

 Recommendation:
 → Rotate database password as precaution
 → Remove all DB-related values from client code
═══════════════════════════════════════════════════════════

Common Causes

CauseSolution
Wrong env prefixNever use NEXT_PUBLIC_DATABASE_URL
SSR code in clientEnsure server-only code stays server-side
Bundler misconfigurationReview webpack/vite config for env exposure
Copy-paste errorDouble-check what you're committing

Architecture Guidance

Wrong (Direct DB in Client)

// ❌ NEVER in client code
import { Pool } from 'pg'
const pool = new Pool({
  connectionString: process.env.DATABASE_URL  // ❌
})

Correct (API or Edge Function)

// ✅ Client uses Supabase client
const { data } = await supabase
  .from('products')
  .select('*')

// OR call an Edge Function for complex queries
const { data } = await supabase.functions.invoke('complex-query')

Edge Function (Server-Side)

// supabase/functions/complex-query/index.ts
import { createClient } from '@supabase/supabase-js'

Deno.serve(async (req) => {
  // ✅ Direct DB access only on server
  const supabase = createClient(
    Deno.env.get('SUPABASE_URL'),
    Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')
  )

  // Complex query that can't be done via REST
  const { data } = await supabase.rpc('complex_function')
  return new Response(JSON.stringify(data))
})

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 discovery → 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 findings:

   {
     "supabase": {
       "db_string_exposed": true/false,
       "db_host": "db.[ref].supabase.co"
     },
     "findings": [
       {
         "id": "DB_CONNECTION_STRING_EXPOSED",
         "severity": "P0",
         ...
       }
     ]
   }

2. Log to `.sb-pentest-audit.log`:

   [TIMESTAMP] [supabase-extract-db-string] [START] Checking for DB connection strings
   [TIMESTAMP] [supabase-extract-db-string] [CRITICAL] Connection string EXPOSED
   [TIMESTAMP] [supabase-extract-db-string] [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/02-extraction/db-string-exposure/

Evidence Files to Create (if DB string found)

FileContent
db-string-exposure/connection-details.jsonParsed connection string (password redacted)
db-string-exposure/location.txtFile path and line number

Evidence Format (P0 Finding)

{
  "evidence_id": "EXT-DB-001",
  "timestamp": "2025-01-31T10:12:00Z",
  "category": "extraction",
  "type": "db_connection_string",
  "severity": "P0",
  "finding_id": "P0-002",

  "connection_string": {
    "pattern": "postgresql://postgres:[REDACTED]@db.abc123def.supabase.co:5432/postgres",
    "host": "db.abc123def.supabase.co",
    "port": 5432,
    "database": "postgres",
    "username": "postgres",
    "password_exposed": true,
    "password_length": 24
  },

  "location": {
    "file": "/static/js/api.chunk.js",
    "line": 234,
    "context": "const DATABASE_URL = 'postgresql://postgres:...' // [REDACTED]"
  },

  "impact": {
    "direct_db_access": true,
    "rls_bypass": true,
    "schema_access": true,
    "auth_users_access": true
  },

  "remediation": {
    "immediate": "Reset database password in Supabase Dashboard",
    "remove_from_code": "Delete DATABASE_URL from client code",
    "verify_env_vars": "Ensure not using NEXT_PUBLIC_DATABASE_URL or similar"
  }
}

Add to timeline.md (P0)

## [TIMESTAMP] - 🔴 P0 CRITICAL: Database Connection String Exposed
- PostgreSQL connection string with password found in client code
- Location: [file]:[line]
- Impact: Direct database access, full RLS bypass
- Evidence: `02-extraction/db-string-exposure/`
- **IMMEDIATE PASSWORD ROTATION REQUIRED**

Related Skills

  • supabase-extract-service-key — Check for service key exposure
  • supabase-audit-tables-read — Test data access via API
  • supabase-report — Generate comprehensive report

Related skills

How it compares

Pick supabase-extract-db-string when auditing client bundles for raw PostgreSQL URLs rather than anon-key or service-key extraction skills in the same suite.

FAQ

Why is an exposed Supabase DB string P0?

The supabase-extract-db-string skill rates exposed PostgreSQL connection strings as P0 because attackers gain direct database access, bypass all RLS policies, read auth.users, and can modify schema without the REST API.

Which files does supabase-extract-db-string update?

The supabase-extract-db-string skill progressively updates .sb-pentest-context.json after each discovery and logs actions to .sb-pentest-audit.log, storing evidence under .sb-pentest-evidence/02-extraction/db-string-exposure/.

What connection patterns does the skill detect?

The supabase-extract-db-string skill matches full postgresql:// URLs, Supavisor pooler strings, separate password and host leaks, and ORM configs like PrismaClient datasources embedded in client bundles.

Securityauditappsecsecrets

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.