The 7 security holes I see most in AI-built apps

The security issues that come up again and again in apps built with Cursor, Lovable, Bolt and v0, why AI tools create them, and how to fix each.

Samed Škulj

Samed Škulj
· 3 min read

AI coding tools write code that works. They are much less consistent about code that's safe, because "safe" is mostly about what the code refuses to do, and demos never test that. After reviewing a number of apps built with Cursor, Lovable, Bolt and v0, the same seven issues keep showing up.

1. The database is open to every user

In apps where the browser talks to the database directly (Supabase, Firebase), access rules are the only thing standing between a user and everyone's data. They are often missing, set to "allow all", or only check that someone is logged in.

Fix: row-level rules that tie each row to its owner or organization, and tests that try to break them. Details in Supabase RLS mistakes.

2. Secret keys shipped to the browser

Admin database keys, payment secret keys and third-party API keys end up in frontend environment variables, which means they end up in the JavaScript bundle anyone can read.

Fix: rotate the key now. Move every call that needs it into a server route or function. Search your built files for key prefixes to confirm nothing is left.

3. API routes that trust the client

A route that accepts userId or organizationId from the request body and acts on it lets any user act as any other user. So does a route that checks "is logged in" but not "owns this record".

Fix: take the user's identity from the session on the server, never from the request. For every route that reads or changes a record, check the record belongs to the caller.

4. Payments that can be faked

Common versions: access is granted on the success redirect instead of the webhook; the webhook doesn't verify Stripe's signature; the plan is read from the request instead of from Stripe.

Fix: grant access only from a verified webhook, and read plan details from Stripe. See Stripe webhooks done right.

5. Users can promote themselves

A role, is_admin or plan column on a table users can update. One edited request and a free user is an admin.

Fix: keep privileged fields where users can't write them, and change them only from trusted server code.

6. Unsafe rendering of user content

Rendering user input or AI output as raw HTML (dangerouslySetInnerHTML, v-html) without sanitising it opens the door to cross-site scripting: one user's content runs code in another user's browser.

Fix: render as text by default. Where you need rich text, sanitise with a well-maintained library and an allowlist of tags.

7. No limits on anything

No rate limits on login, sign-up, password reset or AI endpoints. No size limits on uploads. This invites brute-force attacks, spam sign-ups and surprise bills.

Fix: rate limits on auth and expensive endpoints, upload limits by size and type, and spending caps on AI features (see LLM cost control).

Why AI tools produce these

The pattern is consistent: the AI is asked to make something work, and the fastest way to make it work is to remove a restriction. "Permission denied" goes away when the policy allows everything. The key works when it's in the frontend. Nothing in the demo fails, so nothing looks wrong.

That's not a reason to stop using these tools. It's a reason to review what they produce before real users arrive.

What to do now

  1. Run the production readiness checklist.
  2. Fix anything in the first five items above before inviting more users.
  3. Add tests that try to break access rules, so fixes stay fixed.

Or have it done for you: an AI-built app rescue finds these issues, writes them up like the sample audit report, and fixes them.

Written by Samed Škulj

Senior Full-Stack Engineer since 2021. I have shipped with teams at Deel, HTEC Group (for Zoox), Ministry of Programming, and now help SaaS teams add AI features and get AI-built apps ready for production. LinkedIn