Guides

How to Secure a Vibe-Coded App Before Launch

By ExcenityAI · Published · Updated

To secure an app built with AI tools, check five things: no secret keys in the frontend, a login and permission check on every route, database rules (Supabase RLS or Firebase rules) on every table, private storage buckets, and rate limits on anything abusable. These are the holes that show up most in published incidents, and you can test each of them yourself in an afternoon.

Why are vibe-coded apps often insecure?

AI builders optimize for an app that works. Security is mostly invisible when things work, so nothing prompts the tool, or you, to check it. The result is an app that looks finished while a secret key is readable in the browser or a database table is open to anyone.

This is not unique to one tool, and it is not a reason to avoid AI-assisted development. It is a reason to review what was generated before real users arrive.

How do you find secret keys in the frontend?

Anything the browser downloads is public. That includes JavaScript bundles, source maps and any variable your framework exposes to the client, such as those prefixed NEXT_PUBLIC_ or VITE_.

  1. Open your live site, then the browser developer tools, then search the Sources and Network tabs for key prefixes such as sk-, sk_live, service_role and AIza.
  2. Search your repository and its git history for the same strings.
  3. Check your .env files are not committed.
  4. If you find a secret, rotate it with the provider first, then move the call to a server route.

Some keys are meant to be public, such as a Supabase publishable (anon) key or a Firebase web config. They are only safe if your database and storage rules are correct. Secret and service-role keys are never safe in the browser.

How do you check authentication and authorization?

Authentication proves who a user is. Authorization decides what they may do. AI-generated code often has the first and skips the second.

  • Create two test accounts. Log in as A, copy a request that loads A's data, then replay it with B's session or B's record ID. If A's data loads, you have a broken permission check.
  • Call your API routes while logged out. Each should return 401 or 403, not data.
  • Do the check on the server or in the database. Hiding a button in the interface does not protect anything.
  • Never decide admin rights from a value the user can edit.

Are your Supabase or Firebase rules open?

With Supabase, Supabase's documentation says to enable Row Level Security on every table in an exposed schema and write explicit policies. Without a policy, a table with RLS enabled returns no rows through the public API, which is safe but broken, so write the policies you need. Our Supabase RLS guide walks through this.

With Firebase, Firestore, Realtime Database and Cloud Storage are accessed directly by clients, so Security Rules are the main safeguard. Firebase warns that test mode allows anyone to access your data and that you must update rules before production. A rule that only checks request.auth != null lets any signed-in user in; prefer rules that match request.auth.uid to the owner.

Is your file storage open to the public?

Check each bucket in Supabase Storage, Firebase Storage and S3 for public read, public list and public write.

  • Make buckets private by default and serve files through short-lived signed URLs.
  • Restrict uploads by file type, size and owner.
  • Do not store IDs, documents or private photos in a public bucket.

A well-reported case: in July 2025 about 72,000 images were exposed from an unauthenticated Firebase storage bucket belonging to the Tea app, per Fox News and Sentra. We use it only as an example of what an open bucket can lead to.

What stops abuse and runaway costs?

  • Rate-limit sign-up, login, password reset, email and SMS sending, and every AI endpoint.
  • Require login before calling a paid API, and cap tokens per request.
  • Add CAPTCHA or bot protection to public forms.
  • Set hard spend limits with each provider. See how to cap OpenAI, Claude and cloud bills.

What should you do after fixing these?

Re-test each item, turn on logging and error alerts, and keep a short written plan for rotating keys. Then work through the full production checklist. If you want an outside check, the free 30-minute audit call reviews exactly these areas and ends with a prioritized fix plan.

Frequently asked questions

Is it safe to expose my Supabase anon key in the frontend?

The anon (publishable) key is designed to be public, but it is only safe if Row Level Security is enabled with correct policies on every exposed table. Without that, anyone with the key can reach your data through the API. The service-role or secret key must never be in the browser.

How do I know if my API keys are exposed?

Search your live site's JavaScript, your repository and its git history for key prefixes such as sk- or service_role. If you find a secret, rotate it with the provider before anything else.

Can I rely on the AI tool to secure my app?

Not on its own. AI builders can add security features when asked, but they do not reliably find what they missed. Test with two accounts and review your rules yourself, or get an independent review.

Do I need a penetration test?

For an early-stage app, a focused review of keys, access rules, storage and abuse controls catches the most common issues. A formal penetration test is worth considering if you handle sensitive data or must meet a compliance requirement.

Is ExcenityAI's audit free?

The first review is a free 30-minute call where we look at your app together. Afterwards we send findings, a fix plan and a quote.

Sources

Checked 27 Oct 2026. Provider settings and limits change, so confirm against the linked documentation.

Keep going

Want a second pair of eyes? Book the free audit call.

A free 30-minute review of your AI-built app, then a written fix plan and a quote.