Skip to main content

Lovable or Supabase app hacked? What to do in the first hour, in order

Taking the site down doesn't close the database. A step-by-step incident checklist for AI-built apps: close RLS, rotate keys in the right order, read the logs, check backups, then prove it's fixed from outside.

Updated 7 min readMarkdown

It usually starts with a message you don't want to read. A user emails to say they got a strange message. Someone posts a screenshot of your users table. Rows in your database changed overnight and nobody on your side touched them. Or GitHub, OpenAI or Supabase emails you about a leaked key.

If your app was built with Lovable, Bolt, Cursor, Replit or v0 on top of Supabase, the next hour matters more than the next week. This is the order to work in. It's written for people who didn't write the code themselves.

First, understand where the attack happened

Most AI-built apps have two parts. The frontend is the website people open. The backend (usually Supabase) holds the database, the user accounts, the file storage and the server functions. The browser talks to the backend directly, using a public key that's built into your JavaScript on purpose.

That matters because taking the website down doesn't close the database. The backend has its own address, and anyone who already has it can keep calling it. Almost every incident in these apps comes through one of five doors:

  1. A table with Row Level Security (RLS) off, or a policy that lets everyone in.
  2. A secret key (Supabase service_role or secret key, Stripe, OpenAI) shipped in the public JavaScript.
  3. A secret key committed to a GitHub repo, sometimes a public one.
  4. A server or edge function that runs for anyone without checking who's calling.
  5. A stolen or weak password on your Lovable, GitHub, Supabase or hosting account.

Minutes 0 to 15: stop the bleeding

1. Decide whether to take the site offline. If data is being copied or changed right now, unpublish. In Lovable, that's Project settings → Publishing → Unpublish project, or Publish → ⋮ menu → Unpublish. Lovable's docs say the live URL becomes inaccessible and the project stays in your editor, so you can publish again later. Remember that this only stops the website. Keep going.

2. Lock your own accounts. Change the passwords on your builder account, GitHub, Supabase, your domain registrar and your email, and turn on two-factor authentication everywhere it's offered. Remove any collaborator or workspace member you don't recognize.

3. Close the database. In the Supabase SQL editor, turn on RLS for every table in public:

alter table public.profiles enable row level security;

Supabase's own warning is blunt: "A table in an exposed schema without RLS is readable and writable by any role with a grant on it." Their docs also note that on existing projects a new table in public starts with every privilege granted to anon and authenticated, and that "adding policies doesn't take those grants back." So RLS on, then policies that only let each user reach their own rows. Your app may break for signed-in users until those policies exist. That's the right trade for the next hour.

Minutes 15 to 45: replace every key the attacker could have read

4. Find the leak. Open your live site, then DevTools → Sources, and search for service_role, sb_secret_, sk_live, sk- and whsec_. Search your repo and its commit history for the same strings. Anything secret that turns up has to be treated as stolen, even if you've since deleted it.

5. Rotate in the right order. Supabase's guide to rotating a leaked key is: create a new secret key, move every component that uses it to the new one, confirm nothing uses the old one, then retire the old one. Two details from those docs catch people:

  • if the leaked key was a legacy service_role key, retiring it deactivates both legacy keys, so your frontend also needs to move to a publishable key
  • deleting a secret key can't be undone, and Supabase says if you find a client you missed, move it to a new key rather than turning the old ones back on

For keys from other services, rotate them at the provider, not just in your code:

6. Check server functions. Any edge or API function that does something sensitive (sends email, charges cards, calls an AI model, writes data) needs to check who's calling. If you or your builder turned off JWT checks to fix an error, turn them back on.

Hour 1 to 3: find out what happened

7. Read the logs before they roll off. In the Supabase dashboard, open Logs, set the time range to cover the days before you noticed, and look at the API, Postgres, Auth, Storage and Edge Function logs. You're looking for:

  • requests to tables at odd hours
  • sign-ups you don't recognize
  • bulk reads
  • updates or deletes nobody on your side made

Export what you find. You'll want it later.

8. Check your data and accounts. Look for new admin users, rows that changed, files added or replaced in Storage, and new keys or webhooks in Stripe or other services.

9. Know what backups you have. Supabase backs up Pro, Team and Enterprise projects daily. Pro keeps the last 7 days, Team 14 and Enterprise up to 30. Point-in-Time Recovery is an add-on. Supabase recommends free-plan projects export their own data with supabase db dump. Two cautions from the same docs:

  • database backups don't include files in Storage
  • restoring replaces the current database, so restore to a new project first if you need to compare

Day 1: tell the people who need to know

If personal data was exposed, you may have legal duties depending on where your users live. Under the GDPR, for example, a controller has to notify the supervisory authority "without undue delay and, where feasible, not later than 72 hours after having become aware of it," unless the breach is unlikely to result in a risk to people (Article 33). If you're not sure what applies to you, get advice. Either way, a short, honest email to affected users beats them hearing it somewhere else.

Before you republish: prove it's closed from the outside

The mistake that brings people back here a week later is republishing because the builder says "fixed." Check what a stranger sees instead:

  1. Signed out, private window: search the live JavaScript again for secret keys. You should find none.
  2. Two accounts: sign up as user B and try to open user A's records. ProofForge's free two-account test builds a read-only script for this that runs on your own machine: https://proofforge.live/two-account-test
  3. Scan the live URL. ProofForge's free scan checks the deployed app for secret keys in the bundle, readable Supabase and Firebase data, exposed .env files, source maps and missing headers, from the URL alone: https://proofforge.live

Why the $9 matters here

During an incident, every round of "fix it" → "now it's broken" → "fix that" spends builder credits and time you don't have, and none of it tells you whether the hole is actually closed. ProofForge's free scan shows your grade, every finding's severity and impact, and the top fix in full. $9 once unlocks every finding with exact code fixes and prompts written for your builder, so each issue takes one precise prompt. Fix + Guard ($29 once) adds deploy-hook rescans for 30 days, so the next prompt can't quietly reopen what you just closed. There's a 14-day refund and no subscription: https://proofforge.live/pricing

More fix guides:

Sources, checked December 1, 2026:

  • Lovable docs, "Publish your Lovable project" (Unpublish), docs.lovable.dev/features/publish
  • Supabase docs, "Row Level Security" (default grants), supabase.com/docs/guides/database/postgres/row-level-security
  • Supabase docs, "Rotate a leaked API key," supabase.com/docs/guides/security/rotate-leaked-api-keys
  • Supabase docs, "Logs in Studio," supabase.com/docs/guides/observability/logs
  • Supabase docs, "Database Backups," supabase.com/docs/guides/platform/backups
  • GDPR Article 33, gdpr-info.eu/art-33-gdpr
  • ProofForge tiers, proofforge.live/pricing.json

No comments yet. Be the first to comment.

More from this blog