All posts

AI-built app? 5 database checks for Supabase, Firebase, Neon

You built your app with Lovable, Bolt, Cursor or v0, and people use it. Whether your database turns away requests from the wrong person is a separate question. An app can look finished while the answer is no.

In March 2025 a security researcher scanned 1,645 projects built with Lovable and found 303 endpoints across 170 projects (about 10.3%) with inadequate Row Level Security, exposing data such as names, phone numbers, payment details and API keys. It is filed as CVE-2025-48757. Lovable disputes it: it says each customer is responsible for their own app's data. Either way, the fix is in the app owner's hands.

Below are five checks you can do yourself. I use them on my own apps on Supabase, Firebase and Neon.

1. Supabase: Row Level Security on every table, with policies that filter

Supabase's docs say a table in an exposed schema without RLS is readable and writable by any role with a grant on it. Tables created in the dashboard have RLS on by default, but tables created in the SQL Editor or through another tool need it switched on.

How to check: open the Security Advisor in your Supabase dashboard. It flags tables in the public schema without RLS and policies that exist while RLS is off.

Then read each policy. For private data, the condition should compare the row's owner column with auth.uid(), which returns the ID of the user making the request. A policy of using (true) lets everyone through.

2. Secret keys never in the browser or the repo

The Supabase publishable key (or older anon key) is safe to expose in a web page or source code, because RLS decides what it can reach. Firebase web API keys only identify your project; Security Rules control access.

A Supabase secret key (sb_secret_...) or older service_role key bypasses every Row Level Security policy and must never be in a browser, a shipped app or source control. Firebase's server libraries bypass all Cloud Firestore Security Rules, so their service account key belongs on the server only.

How to check: variables starting with VITE_ (Vite) or NEXT_PUBLIC_ (Next.js) end up in the JavaScript sent to the browser. Search your code and live site's JavaScript (DevTools, Sources) for service_role, sb_secret_ and private_key. Found one? Move it to the server and rotate the key: Supabase blocks secret keys in browsers, but a leaked key still works from other tools.

In LaunchPilot, my Supabase app, the browser only gets the project URL and public key; the secret key stays in serverless functions. Moving an app off Lovable or Bolt is a good moment to sort public from secret keys; see moving your app to your own GitHub and hosting.

3. Firebase: rules not left in test mode

Firebase's test mode allows anyone to read and overwrite your data. Firebase says never to use allow read, write: if true in production: anyone who guesses your project ID can steal, modify or delete the data. A rule that only checks request.auth != null opens the data to every logged-in user.

How to check: in the Firebase console, open the Rules tab for Firestore, Realtime Database and Storage. Look for if true, or a date check without a user check. For private data, a good rule compares request.auth.uid with the owner's ID. Then use the Rules Playground to simulate a logged-out user and a different user ID; both should be denied.

4. Storage buckets: public only on purpose

In Supabase, a public bucket means anyone who has a file's URL can read it. In a private bucket, every operation, downloads included, goes through RLS policies. Firebase Cloud Storage has its own Security Rules, so check 3 applies there too.

How to check: list your buckets. Logos can be public. Invoices, ID scans and private uploads belong in a private bucket, with policies that limit each user to their own folder (example).

5. Neon or Postgres: connection string on the server, a user check in every endpoint

Neon's docs say the connection string contains sensitive credentials and must never be exposed in client-side JavaScript. Queries belong in a backend or serverless function.

Your API code is then the gate. Every endpoint must verify the user's sign-in token on the server, then filter by the user ID from that token, never by an ID sent in the request. Skipping that is Broken Object Level Authorization, number one on OWASP's 2023 API Security Top 10.

In Foreground, my Neon app, every function checks the sign-in token, then checks that the requested record belongs to that user. TestSwap uses Firebase sign-in with Postgres: the server verifies the token itself and keeps private fields out of public queries.

How to test: log in as user A, ask for user B's data

  1. Create two test accounts, A and B. As B, create something private, like an order.
  2. Log in as A. In DevTools, Network tab, find a request that loads A's own data.
  3. Copy it (right-click, Copy as fetch), swap in the ID of B's record, and send it.
  4. Send it again without A's sign-in token.

Every try should return an error or nothing. Seeing B's data means a gap. Only test your own app.

If your app has teams or company accounts, the same test applies per company: see adding teams without one company seeing another's data.

If you're not sure

If a result confuses you, or you have too many endpoints to test by hand, ask someone who does this often. For an experienced developer, a check like this takes an hour or two. Most fixes are small: a missing policy, a rule that is too wide, or an API function that skips the user check. Related: checking for exposed API keys, admin pages and "only my own data" rules, who can open uploaded files, stopping fake sign-ups and checking your backups.

Get a database safety check for your AI-built app

I'm Marc de Ruijter, a Dutch full-stack developer with 25+ years in IT, working remotely for EU clients. I check your Supabase, Firebase or Neon app against the points above, for a fixed price, in Dutch or English. You get a plain list of what is open and what to fix first.

See how to hire me or send me a message.