This one came up while we were finishing a paid AI app for a founder. Free users got 3 credits, paying users got a subscription, and Stripe handled the money. It all worked. You could sign up, use your credits, upgrade, and see the premium features.

Then we read the database policies one by one, which is the boring part nobody does in the preview.

The policy

There was a rule on the profiles table called “users can update own profile”. It sounds harmless. It’s the kind of policy that gets added early so people can change their name or their picture.

The trouble was that the same row held the credit balance and the subscription status, and the rule did not limit which columns a user could change. So any signed in user could send one request straight to Supabase, skip the app entirely, and set their credits to 999999 and their status to active. No payment and no Stripe involved.

Nobody had done it. But the app was about to launch, and it only takes one curious user with the browser tools open.

Why the preview never shows this

When you test your own app, you use the app. You click the buttons it gives you. A bug like this lives outside the buttons. The front end never sends that request, so clicking around will never find it. You only find it by reading the policies, or by trying requests the app would never make.

The fix

We dropped that update policy. Credits, plan and status are now only written by the server, after Stripe confirms a payment through its webhook. Users can still change their own name and settings, through a path that cannot touch those columns.

The rule we use now: if a column decides what someone gets for free, the user should never be able to write to it, even on their own row.

Check yours in ten minutes

  • Open the Supabase dashboard and look at every table with an UPDATE or INSERT policy.
  • For each one, look at what columns live on that table. Plan, role, credits, is_admin, balance and status are the usual suspects.
  • If a user can update the row, assume they can update every column on it.
  • Move those columns to a table only the server writes, or block changes to them with a trigger.

If that turns up something you are not sure about, send us the app. Reading the policies is the first part of every Production Check we do. Book a 30 minute call.