All articles
Security··6 min read

Your row level security is correct. Your app is still wide open.

He configured the policy properly. Claude and Cursor both audited it and passed it. Strangers still gave themselves premium accounts and ran up his AI bill. The bug was not in the policy, which is exactly why nothing caught it.

A developer called Chris Raroque configured row-level security on his calorie-tracking app correctly. Users could read and write only their own data. He asked both Claude and Cursor to audit it. Both said it was fine.

Strangers still gave themselves premium accounts and unlocked unlimited use of the paid AI endpoint behind them.

Nothing about his security policy was wrong. That is the part worth sitting with, because it is the reason his tools missed it and the reason yours will too.

What actually happened

His policy said users may edit their own row. Reasonable. The problem was what was on that row. Subscription status lived there. So did the rate-limit counter.

I had RLS configured correctly where users can read and write only their own data. But I made the mistake of storing the subscription status and the rate limits on the same table, which meant that they were able to actually modify their subscription status to give themselves premium. And even worse, they were able to modify the rate limits. And then they could just hit my AI endpoint unlimited.

· Chris Raroque

Read the policy again with that in mind. Users may edit their own row is also users may edit their own billing status. Both sentences describe the same rule. Only one of them sounds like a vulnerability.

Why the AI audit passed it

This is the part that should change how you check your own work. He did the responsible thing and asked for a review:

Before you say, “Why didn't you ask Claude or Cursor to audit your RLS?” Trust me, I did. It did not catch these issues either. These tools are great at catching most RLS misconfigurations, but then when it gets to something a little more complicated, like thinking through how can RLS be manipulated so that they can abuse costs and cause financial damage, it sometimes does miss this stuff. Especially when the RLS is technically correct, but the problem is with the underlying data that you're storing.

· Chris Raroque

Ask an assistant to check your access rules and it checks your access rules. It reads the policy, confirms the policy does what the policy says, and reports success. The flaw is one level up, in the decision about which columns belong on a table the user is allowed to write. That decision does not look like a security decision, so nothing treats it as one.

He is blunt about how often he sees it:

The most common vulnerability pattern I'm seeing with RLS is storing sensitive data, like subscription status or rate limits on the user table itself. I don't know why, but Claude Code and Cursor just do not have a problem with you doing this.

· Chris Raroque

He went looking for it in other people's apps afterwards and says more than half of the ones he checked had the same hole, including apps built by experienced developers. That was an informal look at a handful of projects rather than a study, so treat the proportion loosely. The part worth keeping is that technical experience did not prevent it.

The rule this gives you

Your access policy answers one question: may this user touch this row. It cannot answer the second question, which is whether anything on that row should be under their control at all. Only your schema answers that, and nobody audits a schema for security.

So split the data by who is allowed to write it, not by what it describes:

  • Things the user owns and may change. Their name, their preferences, their content. Fine on a row they can write.
  • Things the business decides about the user. Plan tier, credits, rate limits, trial expiry, role, verification status. These belong on a table the client has no write policy on at all, updated only by your server or a webhook from your payment provider.

The second group is the one that pays for things. If a user can write it, they can award it to themselves.

How to test it in two minutes

The reason the generic audit fails is that the generic question is too kind. Is my row-level security configured correctly invites a yes. Ask the adversarial version instead, naming the outcome you are afraid of:

  • Can a signed-in user change their own subscription status, plan, or credit balance?
  • Can a signed-in user raise or reset their own rate limit?
  • Which columns on user-writable tables affect what the user is charged or what they are allowed to do?

Then stop asking and check. Sign in as a normal user, open the network tab, and attempt the update directly against your database. If the write succeeds, you have the bug, regardless of what any audit told you.

There is a useful habit here too. Point your assistant at the live configuration rather than a description of it. Both Supabase and Firebase expose their settings through an MCP server, and cloud providers expose theirs through a CLI. An assistant reading the real policies will tell you more than one reading a screenshot of them.

The wider lesson

Automated review finds the mistakes somebody thought to describe. It is good at a policy that is missing, a key that is exposed, a route with no check on it. It is weak at a design that is internally consistent and still wrong, because there is no rule being broken for it to notice.

Which means the questions worth asking are never is this correct. They are what would I do if I wanted to cheat this. Give yourself premium. Reset your own limits. Read somebody else's invoice. Those are specific enough to test, and specific is the only thing that survives an audit.

Find out which of those apply to you

Fourteen questions, about three minutes, runs entirely in your browser. You get a ranked list of what's actually open, with the fix for each.

Run the free check

Sources

Quotations from the two interviews are transcribed from the published videos and lightly condensed for readability.