01 · Security · From How to Scale Your Vibe-Coded SaaS
How do I know if my vibe-coded SaaS is secure?
You know your vibe-coded SaaS is secure when you have tested that one customer cannot reach another customer's data, that authorization is enforced on the server and not just hidden in the interface, and that no privileged key ships to the browser. "The AI says it looks fine" is not evidence. A denied-access test with two accounts, a secret-rotation process, and a dated dependency scan are.
Security is not one toggle. For a SaaS, what I care most about is who can do what to which customer's data. Authentication proves identity; authorization decides access. A signed-in user should never gain access to another account by changing an ID in a request. That is the single most common bug in AI-generated apps, because generated code tends to trust whatever customer ID the browser sends.
Why AI-built apps fail this check
Tools like Lovable, Bolt, Cursor, and Claude Code generate working features fast, and the feature works for the one user who tested it. Three patterns show up again and again.
- Database tables with no row-level policies, so any authenticated user can query any row. On Supabase this is the default until someone turns row level security on and writes the policies.
- A privileged server key placed in a client-side environment variable so the browser can talk to the database directly. Anyone who opens the network tab now has it.
- Permission checks that live in the interface. The button is hidden, but the API behind it answers anyone who calls it.
Pass one: map the boundary
List user roles, customer accounts or tenants, sensitive records, privileged actions, and every entry point: pages, APIs, background jobs, file storage, and admin tools. You cannot test a boundary you have not drawn.
Pass two: inspect and test
- Confirm authorization happens on trusted server-side paths, not in the browser.
- Create two test accounts in staging and test both the allowed and the denied case for every sensitive record and privileged action.
- Check where secrets are stored, whether dependency alerts are on, how uploads are handled, and whether logs contain sensitive data.
- Use synthetic records. Never test against real customer data.
Pass three: close and recheck
Fix the smallest confirmed issue first. Add an automated regression test for the denied case so it cannot quietly come back. Have a human review any change to access-control logic. Retest the same path after deployment, not before.
Evidence to save
- A role and permission matrix.
- Test results for allowed and denied cases.
- The secret-rotation process.
- The date of the last dependency scan.
- The name of the person who owns remediation.
When to stop and get help
Escalate immediately if you find cross-customer access, public secrets, exposed backups, or signs of active misuse. Contain the issue and get qualified security help. Do not use an AI-generated patch as the sole sign-off.
How I would do it
For Launchboard, the fictional 200-user SaaS I use throughout the guide, I would start with the weekly report flow because it touches every customer's notes. I would trace one report from the browser through the API, the database, the background job, and the email provider, and inspect each place where data crosses a trust boundary. Then I would sit down with two synthetic accounts and try to read the other one's projects. Only after that would I look at the code.
Security review prompt, for a coding assistant with read-only repository access
Inspect the repository READ-ONLY. Focus on authentication, authorization, tenant isolation, secrets, uploads, and logging for [core journey]. Show exact files and lines for each finding. For every risk, state the exploit precondition, customer impact, confidence, and a safe way to verify it using synthetic accounts in staging. Do not run attacks, access real customer data, change permissions, or edit code. Separate confirmed findings from hypotheses. Prioritize the top 3 and tell me what needs human security review.
Questions founders ask
Is a vibe-coded app less secure than a hand-written one?
Not inherently. The same bugs appear in human-written software. The difference is that a generated app usually ships without anyone having checked the assumptions around the code, so the first audit tends to find more. After the audit there is no difference.
Can I just ask the AI to check my app's security?
You can ask it to inspect the repository read-only and show exact files and lines, and the prompt above is written for that. Treat the output as hypotheses to verify with two test accounts in staging, not as a sign-off. An AI cannot prove your app is secure. Evidence from your own system can.
What should I fix first?
Cross-customer access, then public secrets, then exposed backups. Anything in those three is a fix-now item that outranks every performance or feature request on the roadmap.