# Anatomy of an exposed app Three patterns account for nearly every ProofForge finding on AI-built apps. Each one below is a composite of real scans: what the builder shipped, what an attacker sees, and the fix. No pattern here requires sophistication to exploit. That is the point. ## Pattern 1: the service key in the browser **What shipped.** The app's JavaScript bundle contains the Supabase `service_role` key. The builder's AI assistant put it there because the code needed to read and write data, and the service key always works, so every error message stopped. **What an attacker sees.** The key is in a public file. Anyone who downloads the bundle has it. The `service_role` key bypasses row-level security by design: it is the admin key. With it, the attacker reads, changes, and deletes every table through the project's public API, no login involved. **The fix.** Rotate the key first (the old one is public, treat it as burned). Then move every privileged operation behind a server-side function that holds the new key, and let the browser use the anonymous key with row-level security doing the guarding. Ten minutes of work, and the leaked bundle becomes harmless. ## Pattern 2: the table anyone can read **What shipped.** A Supabase table (users, orders, messages) with row-level security disabled, or a policy that grants public read to make the app work during development. The anonymous key, which is public by design and sits in the client code legitimately, reads the whole table. **What an attacker sees.** One request with the public key returns customer emails, order histories, private messages, whatever the table holds. This is the CVE-2025-48757 pattern: 170 of 1,645 Lovable apps examined in one study were exposed exactly this way. Nobody hacked anything. The door was never closed. **The fix.** Enable row-level security on the table and add policies that scope reads to the row's owner (`auth.uid() = user_id` is the usual shape). The app keeps working for signed-in users; the anonymous read returns nothing. ## Pattern 3: the database with public rules **What shipped.** A Firebase Realtime Database or Firestore instance with rules set to open read/write, the configuration every tutorial starts with ("for development, set rules to true") and nobody revisits at launch. **What an attacker sees.** The database URL is in the client config, as it must be. With public rules, a single request downloads the database. Open Firebase instances have been harvested at scale for years; scanners sweep for them continuously, so "nobody will find mine" has a short half-life. **The fix.** Replace the open rules with authenticated, owner-scoped rules before anything else. Then check what the data shows about the exposure window: if the database held real user data under public rules, treat it as disclosed, because you cannot prove it was not read. ## The common thread None of these is a bug in the app's code. The app works. Every pattern is a default that was never revisited, left in place by a build process that optimizes for "it runs" and has no step for "it is closed." That step is what ProofForge is: paste the URL, see which defaults are still open, fix the first one free.