Supabase RLS & Key Exposure Checker
Verify that your production frontend only ships a public anon key, never leaks a service_role JWT, and does not expose sensitive tables through open PostgREST metadata.
01 · Exact Passive Checks
What LeakRay inspects on your live URL
| Rule ID & Check | What It Inspects | Why It's Passive & Safe |
|---|---|---|
supabase-context-checkSupabase JWT Role & PostgREST Schema | Decodes JWT payloads in HTML and first-party JS bundles to distinguish public anon keys from privileged service_role keys, and inspects public PostgREST OpenAPI metadata for sensitive table names. | Read-only GET inspection only. Never writes rows, mutates policies, or enumerates private user records. |
secret-private-keysService Role & Third-Party Private Keys | Scans rendered HTML and up to 10 first-party JavaScript bundles for high-entropy private keys (Stripe, OpenAI, Anthropic, AWS, GitHub, PEM blocks) shipped alongside Supabase clients. | Matched tokens are automatically redacted before storage and never replayed against upstream APIs. |
exposed-env-fileExposed .env & Secret Config Files | Checks whether `.env` or environment backup files containing `SUPABASE_SERVICE_ROLE_KEY` or `DATABASE_URL` are publicly served over HTTP. | Single bounded GET request under a 2 MB cap with strict SSRF and redirect protections. |
cors-misconfigurationPermissive CORS & Credential Reflection | Detects reflected `Access-Control-Allow-Origin` headers paired with `Access-Control-Allow-Credentials: true` on authenticated app routes. | Inspects HTTP response headers passively without sending authenticated cookies or exploit payloads. |
02 · Vulnerable vs. Fixed
Common production leak pattern and the exact fix
-- Vulnerable: RLS disabled on public schema table
-- Anyone with the public anon key can read or modify every row
create table public.profiles (
id uuid primary key references auth.users(id),
email text not null,
stripe_customer_id text
);
-- Client code accidentally using service_role key
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY! // CRITICAL LEAK
);-- Fixed: Enable Row Level Security & scope policies to auth.uid()
alter table public.profiles enable row level security;
create policy "Users can read own profile"
on public.profiles for select
using (auth.uid() = id);
create policy "Users can update own profile"
on public.profiles for update
using (auth.uid() = id)
with check (auth.uid() = id);
-- Client code only uses the public anon key; service_role stays server-only
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
);03 · AI Fix Prompt
Paste into Cursor, Claude Code, Lovable, or Bolt
Audit my Supabase integration and database migrations for security leaks:
1. Search the codebase for any `service_role` JWT or `NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY` / `VITE_SUPABASE_SERVICE_ROLE_KEY` reference and move all privileged Supabase calls to server-only routes or Edge Functions using a non-public `SUPABASE_SERVICE_ROLE_KEY` env var.
2. Verify that every table in the `public` schema has `ALTER TABLE ... ENABLE ROW LEVEL SECURITY;` enabled and explicit `SELECT`, `INSERT`, `UPDATE`, and `DELETE` policies scoped to `auth.uid()`.
3. Restrict PostgREST exposed schemas in Supabase settings if internal tables should not appear in `/rest/v1/` OpenAPI metadata.
4. Provide a SQL migration and diff of any client code changes.04 · Developer FAQ
Frequently asked questions
- Is it safe for my Supabase anon key to appear in client-side JavaScript?
- Yes. Supabase anon keys are designed to be public in browsers as long as Row Level Security (RLS) is enabled on every exposed table. LeakRay treats anon keys as informational context and only raises critical alerts for privileged service_role keys or exposed sensitive schemas.
- Why is leaking a Supabase service_role key critical?
- The service_role key bypasses all Row Level Security policies and grants full read/write access to your entire Postgres database and Auth admin endpoints. If it ever reaches a browser bundle, rotate it immediately in your Supabase project settings.
- How does LeakRay inspect Supabase PostgREST exposure without modifying data?
- LeakRay performs a passive, read-only GET check on the public PostgREST OpenAPI metadata when a Supabase project URL is detected in your frontend. It never writes records, runs mutations, or attempts brute-force table enumeration.
- What if my tables have RLS enabled but still show up in PostgREST metadata?
- PostgREST exposes schema metadata for tables in your configured public schemas by default. Seeing a sensitive table name (like users, billing, or orders) is a prompt to verify RLS policies are strict or move internal-only tables to a non-exposed Postgres schema.
More Passive Scanners
Explore related LeakRay checks
Next.js Production Security Scanner
Audit live Next.js apps for __NEXT_DATA__ secret leaks, debug stack traces, exposed source maps, .env files, and missing security headers.
Open scanner JS Bundles · Entropy + Context Validation · Passive AuditLeaked API Key & Frontend Secret Scanner
Scan your live HTML and JavaScript bundles for leaked Stripe, OpenAI, Anthropic, Gemini, AWS, and GitHub keys—without false-positive noise.
Open scanner Server Config · Dotfiles · Passive AuditExposed .env & .git File Checker
Check if your live website publicly exposes /.env, /.git/HEAD, or backup config files. Passive read-only URL scan with instant fixes. Zero signup.
Open scanner Firebase · Firestore · Passive AuditFirebase & Firestore Security Scanner
Passively audit live Firebase apps for leaked Admin SDK keys, exposed .env files, public source maps, and weak security headers without public apiKey noise.
Open scanner Cursor · Lovable · Bolt · v0 · Passive AuditSecurity Scanner for Vibe-Coded Apps
Free pre-launch security check for AI-built apps from Cursor, Claude Code, Lovable, Bolt, and v0. Catch leaked keys, open files, and missing headers.
Open scanner JavaScript Bundles · .js.map · Passive AuditProduction Source Map Exposure Checker
Check if your live Next.js, Vite, or React app publicly exposes .js.map source maps. Passive URL scan with framework-specific fixes and AI prompts.
Open scanner Headers · CORS · Cookies · Passive AuditHTTP Security Headers & CORS Checker
Check HSTS, CSP, SRI, COOP, CORS credential reflection, and cookie flags — plus JS secret & file checks that header-only scanners miss. Zero signup.
Open scanner