Nobody attacks your login screen. They press F12, open the Network tab, copy the Supabase URL and key your app sends with every request, and query your database directly with curl. If your tables aren't protected at the database level, the login screen was decoration.
Vibe coding security breaks in the same few places again and again. Apps built with Lovable, Bolt, Cursor and similar tools tend to share the same handful of gaps, usually because the tool built exactly what it was asked for and nobody asked about access rules. That's actually useful: predictable mistakes are quick to find.
Below are the patterns we turn up most often when reviewing AI-built apps, and the order we fix them in.
Why vibe-coded apps keep leaking data
The public evidence keeps pointing the same way. A Cloud Security Alliance research note published on 2 June 2026 pulled together scans of vibe-coded apps that found missing security headers, missing CSRF protection and poorly scoped access policies, along with incidents involving exposed Supabase and Firebase backends.
The most detailed primary study is Escape's analysis of more than 5,600 public apps built on vibe coding platforms. It reported more than 2,000 vulnerabilities, over 400 exposed secrets and 175 instances of exposed personal data. The methodology calls out Supabase tokens in frontend JavaScript bundles (in some cases service keys) and missing Row Level Security.
Then came a well-publicised case. On 2 February 2026, Wiz described how it got into the production database of Moltbook, a social network its founder said was vibe-coded, using a Supabase key found in client-side JavaScript. With no RLS policies in place, that key allowed reads and writes, exposing 1.5 million API authentication tokens and 35,000 email addresses.
The vibe coding security mistakes we see most
Six patterns account for most of the serious findings in our reviews. They sit squarely in the top two categories of the OWASP Top 10:2025: A01 Broken Access Control and A02 Security Misconfiguration.
- RLS switched off. The frontend filters to "my orders", but the database will hand over every row to anyone who asks.
- RLS on, policy wide open. A policy like
using (true)for theauthenticatedrole means any user who signs up can read every other customer's data. - Secret keys in the bundle. Service role keys, Stripe
sk_live_keys or AI provider keys end up in frontend code, often through aVITE_orNEXT_PUBLIC_variable that the build inlines into public JavaScript. - Admin checks that live only in the UI. The admin button is hidden for normal users, but the endpoint behind it accepts the request from anyone with a session.
- Open storage and unchecked functions. Upload buckets are public, or an edge function updates a record without checking the caller owns it.
- No headers, no rate limits. No Content Security Policy, no HSTS, no clickjacking protection, and sign-in or AI endpoints that take unlimited requests.
Supabase row level security, done properly
Supabase is the backend we see most in AI-built apps, and its model is sound once it's configured. The Supabase Row Level Security guide says a table in an exposed schema without RLS is readable and writable by any role with a grant on it. So: RLS on every table in every exposed schema, no exceptions.
Three details catch people out. Once RLS is on with no policies, the API returns nothing, and an AI tool asked to "fix the empty screen" will often add a policy that allows everything. Policies don't take away grants either: Supabase notes that on existing projects a new table in public starts with every privilege already granted to the API roles. And the secret key runs as service_role, which bypasses RLS when the request doesn't carry a user's token, so it belongs on the server only.
| Check | What good looks like |
|---|---|
| RLS status | Enabled on every table in every exposed schema |
| Read policies | Scoped to the owner or the owner's organisation, using auth.uid(), never using (true) |
| Write policies | Separate insert, update and delete policies, each with an ownership check |
| Grants | anon access revoked on anything the public doesn't need |
| Secret key use | Server side only, never in frontend code or public variables |
| Testing | Two test accounts that try to read and change each other's rows |
Wiz summed up the principle in its Moltbook write-up: "When properly configured with Row Level Security (RLS), the public API key is safe to expose." Flip that around and you have the problem.
Exposed API keys: find, move, rotate
Search what you've deployed, not just the repo. Open the built JavaScript in the browser, search for sk_, secret, service_role and your AI provider's key prefix. Anything more powerful than the public, RLS-protected key needs to move behind a server function.
The OWASP Secrets Management Cheat Sheet recommends keeping secrets out of code, having services fetch them at runtime from a secrets manager, catching them with secrets detection before commit, and rotating them regularly. For a small app, your host's encrypted environment variables plus a pre-commit scanner such as gitleaks covers most of that.
Moving a key doesn't help if it's already shipped. Treat anything that appeared in a public bundle or commit as compromised: rotate it with the provider, then check the provider's usage logs. AI provider keys deserve extra care, since somebody else's usage lands on your card.
Authorisation and browser headers
Authentication tells you who someone is. Authorisation decides what they're allowed to touch, and it has to be enforced on the server or in database policies. For every endpoint that changes data, ask one thing: what stops a signed-in user changing someone else's record by swapping the ID in the request?
Then set the browser protections. The OWASP HTTP Headers Cheat Sheet recommends a Content Security Policy, Strict-Transport-Security, CSP frame-ancestors (or X-Frame-Options: DENY) against clickjacking, X-Content-Type-Options: nosniff and Referrer-Policy: strict-origin-when-cross-origin. On Vercel or Netlify these go in one config file. Start CSP in report-only mode, because a strict policy will break third-party scripts you forgot you had.
Rate limit sign-in, password reset, sign-up and anything that calls a paid model. Bots find those first.
How JRC Software secures AI-built apps
Our AI-Built App to Production service starts outside in. In the first week we pull the keys from your live bundle and try them against your database, call your endpoints as a second user, read your RLS policies and storage rules, and check headers and rate limits. You get a short, ranked list of findings, each with the request that proves it.
Then we fix them in your existing code: RLS policies with tests, server functions for privileged calls, key rotation, server-side authorisation and header config. Don't treat the AI tool's own "security scan" as your sign-off, and we document every change so you can keep building with AI without reopening the same holes. Security is one of the nine items in our vibe coding production checklist, which is worth reading alongside this.
If there's a specific concern you want to talk through, book a discovery call.
Worried one of these is sitting in your app right now? Get your free app launch-readiness check and we'll tell you what we find before someone else does.
Frequently asked questions
Is my vibe-coded app secure if it has a login page?
No, not on its own. A login page confirms who a user is but doesn't control what data they can reach. Many AI-built apps filter data in the interface while the database will return every row to anyone holding the public key. Real protection comes from database policies, server-side authorisation and keeping secret keys out of the browser, all tested from outside the app.
What is Supabase row level security and do I need it?
Row Level Security is a Postgres feature Supabase uses to decide which rows each user can read or change. If your frontend talks to Supabase directly, you need it on every table in an exposed schema. Without it, the public key in your app gives anyone read and write access. Each table also needs policies scoped to the owner, tested with at least two accounts.
What should I do if my API key was exposed?
Treat it as compromised and rotate it with the provider straight away. Then check the provider's usage and access logs for activity you don't recognise. Put the replacement key in a server function or your host's encrypted environment variables so it never reaches the browser, and add a secrets scanner to your repository so the same mistake gets caught before it ships again.
Can AI coding tools fix their own security mistakes?
Partly. They're useful for applying a fix once a problem is clearly described, but unreliable at finding the problem in the first place. Asked to "make the app secure", a tool may add a login screen or an over-broad policy that hides the symptom. Use AI to implement fixes, and use an independent review and tests to confirm the result.
Vibe Coding
Get your free app launch-readiness check
Answer a short checklist and we'll tell you what to fix before launch.
Start the free checkSources
- Cloud Security Alliance: The Vibe Coding Governance Gap
- Escape: Methodology: How we discovered over 2k high-impact vulnerabilities in apps built with vibe coding platforms
- Wiz: Hacking Moltbook: The AI Social Network Any Human Can Control
- OWASP: Top 10:2025
- Supabase: Row Level Security
- OWASP: Secrets Management Cheat Sheet
- OWASP: HTTP Headers Cheat Sheet