---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://segmentstream.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Why vibe-coded apps leak, and what to check before yours does

The public incidents of the last two years follow the same four patterns. What each looks like, what to check this week, and what a platform should take off your hands.

AI coding agents made it possible to ship an app in an afternoon, and the apps work. What breaks is everything a demo never tests: who can read which records, where the keys live, and what the agent is allowed to touch.

The public record of the last two years is unusually consistent. Four patterns account for nearly every incident.

## 1. Tables anyone can read

Most AI-built apps keep their data in a hosted database that the browser queries directly with a public key. That design is safe only when every table has rules saying who may read and change which rows. The rules are opt-in, the app works without them, and nothing tells you they are missing.

- UpGuard found [16,326 Supabase databases exposing readable tables](https://www.upguard.com/labs/research/everything-everywhere-systemic-data-exposure-in-supabase-apps). 55.8% of them held personal data: names, emails, phone numbers, and in some cases passwords and payment details.
- Crissy Field scanned [159,041 projects built with Lovable](https://www.crissyfield.de/research/lovable-en/) and, without signing in, read email addresses on 7,403 of the sites.
- Wiz found that Moltbook, a social network for AI agents, [served its database key in the page's JavaScript with no access rules behind it](https://www.wiz.io/blog/exposed-moltbook-database-reveals-millions-of-api-keys). Anyone could read 1.5 million API keys and 35,000 email addresses.

None of these needed an exploit. The data was one request away.

## 2. Keys that end up where anyone can find them

An agent puts a key wherever the code that needs it runs. If that code runs in the browser, or the key lands in a commit, it is public, and a usage-based API bills whoever holds it.

- A three-developer company's stolen Google Cloud key [ran up more than 450 times its usual monthly Gemini bill in 48 hours](https://www.theregister.com/security/2026/03/03/dev-stunned-by-82k-gemini-api-key-bill-after-theft/4925029).

A leaked key is a security problem and a billing problem at once. With no spending limit, the bill is the first alert.

## 3. Agents holding the keys to production

A coding agent can run any command you can. When development and production share credentials, "clean up the old resources" can mean the database your customers use.

- In July 2025 Replit's agent [deleted SaaStr's production database](https://www.theregister.com/software/2025/07/21/vibe-coding-service-replit-deleted-production-database/719783), during what was meant to be a code freeze.
- In March 2026 Claude Code [ran `terraform destroy` against DataTalksClub's production infrastructure](https://aishippinglabs.com/blog/how-i-dropped-our-production-database-and-now-pay-10-more-for-aws). The course platform's database went, and its snapshots with it. Restoring it took a day.

The lesson from both: an agent should never hold credentials that can destroy production, and backups should live where those credentials can't reach.

## 4. Nobody owns what happens next

The fourth pattern doesn't make headlines. The first version works, the person who prompted it moves on, and nobody can say who may see which records, what changed last week, or who answers when it breaks at 11pm. It is the most common objection to building your own software instead of renting it, and a fair one.

## What to check this week

If you run an app an agent built, an afternoon covers the worst of it:

1. **Read your own data while signed out.** Open the app in a private window, watch its network requests, and try the same requests against each table. Anything you can read that isn't meant to be public already is. On Supabase, check that row-level security is on for every table and that each policy limits rows to the people who should see them.
2. **Search for keys.** Look through the built JavaScript and the git history for API keys and service credentials. Rotate anything you find, then set a spending limit with every provider that offers one.
3. **Take production away from the agent.** Give it development credentials only. Turn on deletion protection, and keep backups somewhere its credentials can't reach.
4. **Write down who owns it.** Who may change it, how you'll know it broke, and where the history of changes is kept.

Our [production checklist for AI-built apps](https://segmentstream.com/guides/ai-built-app-production-checklist) walks through the rest.

## The fix belongs in the platform, not the prompt

Every incident above is a default left to the builder: access rules that are opt-in, keys that live in the code, an agent holding production credentials. Prompts and checklists help, but they depend on someone remembering every time. The durable fix is a platform where the safe path is the only one.

```figure
Compare
left: Assembled by hand
left-steps: ! A database the browser queries with a public key | ! Access rules you remember to write | ! API keys in the code and its history | ! One set of credentials for development, production and the agent
right: On SegmentStream
right-steps: + Apps reach records only through the platform's permission check | + Roles down to the row, for people, apps, agents and API keys | + Connections and AI models with no key in the code | + Deploys change code, never the infrastructure under it
caption: The same app, two places for the parts that leak.
```

On SegmentStream:

- **One permission check on every read and write**, for people, apps, agents and API keys alike, with roles down to the row: finance sees invoices, and a client's customers see only their own records. Apps never receive a database key.
- **No keys in the code.** Connections to a CRM, an ad platform or a bank authorize through the platform, so the credential never reaches the code, its logs or the agent. AI models are called through AI Gateway, with no key to leak, and model spend stops when prepaid AI credit runs out.
- **Deploys can't take production down.** A deploy changes code, never the infrastructure under it. A migration that would drop data is refused, the app's database role can't change the schema, and the main branch can't be force-pushed or deleted.
- **A history of every change**, with the action, who made it, when, and each field before and after.

The agent still writes the code. The parts that leak are the platform's job.

If you build software for other companies, this is the part you shouldn't have to get right again for every client. [Builder Partners](https://segmentstream.com/builders) build on SegmentStream, and their clients own the result.
