SaaS Security Preflight: Supabase RLS, Keys, Stripe
by Nate Freed
Read-only security scan for Supabase, Next.js/Vite, Express, Cloudflare and Stripe apps: severity-ranked findings with file:line evidence, the fix and how to verify it.
$5
SaaS Security Preflight: Supabase RLS, Keys, Stripe
Example session with this skill installed
Repo: streakly, a habit tracker (Vite + React front end, Express API with Stripe checkout and webhook, Supabase migrations). Request: "We open sign-ups next week. Run a security preflight on this repo. Feature voting is meant to be public. Report only, no changes yet."
- Read your context and instructions
- Compiled the saas security preflight
Security preflight: streakly (Vite + Express + Supabase + Stripe)
Scanner: 18 files, exit 1. Triaged: 16 confirmed, 1 by design. Manual pass done.
Verdict: do not open sign-ups until F01-F06 are fixed.
F01 CRITICAL KEY002 web/src/lib/adminStats.ts:3
VITE_SUPABASE_SERVICE_ROLE_KEY is baked into the JS bundle, so any visitor can bypass all RLS.
Fix: move countUsers() to an API route, drop the VITE_ prefix; you rotate the key.
Verify: build, search dist/ for the key prefix: no match.
F02 CRITICAL RLS001 init.sql:18: checkins has no RLS; anyone can read or delete every check-in.
Fix: new migration, enable RLS + owner policies. Verify: rls_local_test.sql passes.
F03 HIGH POL001 init.sql:16 "Users can add habits" with check (true), no TO: anon can insert habits for any user_id.
F04 HIGH IDOR (manual) api/src/habits.ts:7 deletes any habit by id with the service client; add .eq('user_id', userId).
F05 HIGH CMP002+CMP001 api/src/admin.ts:4: if ADMIN_KEY is unset, a request with no key gets in.
F06 HIGH SEC001 auth.ts:6 hardcoded JWT_SECRET fallback (value masked); anyone can forge sessions.
Also high: KEY004 supabase.ts:7, CORS001 server.ts:11, DBG001 /api/dev unguarded, WH003 billing.ts:21, ENV001 api/.env committed (name only, rotate), STOR001 progress-photos (raised: personal photos).
Medium: RATE001 login + demo-login, WH002 (retries double referral credit), CK001 x2.
By design: POL003 feature_votes (public voting), allowlist entry drafted.
No files changed.
Connects securely to your tools. The creator never sees your data.
About this skill
Run a security preflight on your SaaS repo before launch. Your agent runs a read-only scanner, reads the code behind every finding, and returns a ranked report. Each finding comes with file:line evidence, why it matters, the exact fix and how to verify that fix. It targets the holes indie stacks actually ship: Supabase tables without RLS, policies that let anon write or forge user_id, service-role keys in browser code or NEXT_PUBLIC_/VITE_ variables, clients that fall back to the service-role key, JWT secrets with a hardcoded fallback, login, signup and demo-login routes with no rate limit, Stripe webhooks without signature checks, de-duplication or proper error codes, admin-key checks that leak timing or pass when the env var is missing, debug routes in production, credentialed wildcard CORS, weak cookie flags, committed .env files (names only, never opened) and public storage buckets. It includes a local RLS test that switches between the anon and authenticated roles on a disposable database, plus an allowlist for accepted findings. It changes code only with your OK.
Static analysis of source text: no type information, runtime or network, so it can miss issues hidden behind indirection and can flag safe code (your agent triages each one). Tuned for Supabase, Next.js, Vite/React, Express/Hono/Node, Cloudflare Pages/Workers and Stripe; other stacks get little coverage. It does not check dependency CVEs, dashboard-only settings or live deployments. IDOR and RPC review is a short manual pass, not exhaustive. The RLS behaviour test needs psql and a disposable local database.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 6 days ago
- Software
Python 3.8+The app's repo on disk
- Optional
Git (committed .env checks)
psqlandlocal PostgresorSupabase CLI
Permissions
File Scopes
The scanner never opens .env, .dev.vars, key or credential files (it reports their names only), masks every secret-looking value it quotes, makes no network calls, reads no environment variables, and runs only read-only git commands (ls-files, check-ignore, log). It writes only the --output file you name. Fixes, key rotation, dashboard changes and deploys happen only after your explicit OK. The RLS test runs only on a disposable local database and refuses to start without -v disposable=1.
What's inside
Frequently Asked Questions
New in Security
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.