Vibecoding · Security
Security essentials
Protect API keys, login, permissions and your database, fix insecure defaults, and run ten checks on your live app with two test accounts.
-
How Do You Add Login and Permissions Without Holes? Use a managed login service such as Supabase Auth or Firebase Authentication instead of writing your own. Level 3: WorkflowsAuthenticationwho are you?
- Handled by a managed provider
- Login, sessions, password resets
- Proved by a signed token
Authorizationmay you touch this record?- Written for your own app
- Checked on every read and write
- Tested with two accounts
-
Which Insecure Defaults Should You Fix Before Launch? These are settings that make building easier and leave a live app open: debug mode, detailed error messages, wide-open CORS, test-mode database rules, leftover admin accounts and test routes, and no rate limits. Level 2: Context
- Debug mode and detailed errorsSend bad JSON. Expect no stack trace.
- Wide-open CORSSend a foreign origin. It must not be echoed.
- Test-mode database rulesFirebase test mode grants access to everyone
- Leftover routesProbe /.env and /api/debug, then read the body
- Leftover admin accountsRemove them and change default passwords
- No rate limitsRequest 20 quick resets. Expect refusals.
-
How Do You Keep API Keys Out of the Browser? Any key your page's JavaScript can use, every visitor can read. Level 2: ContextPublic by designyour access rules protect the data
- Supabase publishable keys (sb_publishable_)
- Stripe publishable keys (pk_)
- Firebase API keys
Server onlynever in browser code- Supabase secret keys (sb_secret_)
- Stripe sk_ and rk_ keys
- Gemini Developer API keys
- Any AI, email or SMS credential
-
How Do You Lock Down Your Database and Validate Input? Give every table access rules so each user reaches only their own rows, even if someone bypasses your app. Level 3: Workflows
- RLS offAnyone with your project URL can access it
- A using (true) policyAny stranger who signs up can read everything
- RLS on, no policiesClosed, but the API returns no data
- Owner policies, testedEach user reaches only their own rows
-
What Should You Check Before a Vibe-Coded App Goes Public? Run ten checks against your live app, in order, using two test accounts. Level 3: Workflows
- 1Browser: no secrets, nothing trustedchecks 1, 5, 6
- 2Your server: checks identity and limitschecks 4, 7, 8
- 3Database: rules hold if the app failschecks 2, 3
- 4Your accounts: keys, spending, backupschecks 9, 10