Supabase vs Convex: policies on tables or checks in functions, and what leaks

Supabase exposes your Postgres tables to the browser and relies on row level security policies to filter every query. Convex exposes no table: the browser can only call the functions you write, and each public function must check the caller itself. On Supabase the typical leak is a table with no policy. On Convex it is a public function with no auth check, or one that trusts an argument such as a user id.

The team behind Keybrum's attacksUpdated 9 min read

In short

  • On Supabase, the browser queries tables directly with a public key. Row level security, written in SQL, is the access control.
  • On Convex, the browser calls functions. Convex's docs state that functions are public by default and that public functions can be called by anyone.
  • Convex has no row level security to forget. It has an auth check to forget, in every public query, mutation, action and HTTP action.
  • The Convex docs warn against access control based on an argument that could be spoofed, such as an email. Read the identity from ctx.auth.getUserIdentity().
  • Logic that a client must never call belongs in an internal function on Convex, and behind a secret key on your own server on Supabase.
On this page

Supabase vs Convex: where the access check lives

Supabase vs Convex is usually argued on SQL against TypeScript, or on realtime features. For the app you ship, the more useful question is where the access check lives, because that is where it gets forgotten.

Supabase gives the browser a public key and a Data API over your Postgres tables. Any visitor can send their own queries. What they get back is decided by grants and row level security (RLS) policies attached to each table. Convex takes the opposite route. The browser never queries a table. It calls functions that you write in TypeScript and that run on Convex's servers, and each function decides what to return.

By default your Convex functions are public and accessible to clients.
Internal Functions, Convex Docs

Convex's own documentation draws the contrast. It says Convex does not need an opinionated authorization framework like RLS, which it describes as required by client-oriented databases such as Firebase or Supabase. The most common way to authorize, it says, is to write code that checks whether the user is logged in at the start of each public function. That is a real advantage: the rule is ordinary code, next to the query. It also means nothing stops a function from shipping without the check.

SupabaseConvex
What the browser reachesTables, views, database functions and storage, through the Data APIThe public functions you export: queries, mutations, actions, HTTP actions
What is public in the bundleThe project URL and the publishable (or anon) keyThe deployment URL and the names of the functions the app calls
Where access is decidedRLS policies and grants, per table, in SQLCode inside each function, in TypeScript
State with nothing writtenRLS on, no policy: nothing readable. RLS off with grants: everything readableA public function with no check runs for anyone who calls it
How to keep logic privateRun it on your server with a secret keyDeclare it as an internal function
Typical leakA table with RLS off, or a policy of trueA public function with no auth check, or one that trusts an argument

Supabase: every table is an endpoint

On Supabase, creating a table can create an API. Supabase's docs warn that a table in an exposed schema without RLS is readable and writable by any role with a grant on it. Once RLS is enabled, no data is accessible with a publishable key until you create policies. The safe state exists. The problem is that RLS is switched on per table, and a table created by a migration or a coding agent does not get it unless the SQL says so.

Supabase has been closing this by default. New projects created after the rollout that began on 30 May 2026 no longer grant the API roles access to new tables automatically, and existing projects were scheduled to follow on 30 October 2026. Tables that already existed keep their grants, so an app built before mid-2026 still depends on RLS alone.

  • RLS off: the public key reads and writes the whole table.
  • A policy of `true`: RLS is on, the dashboard looks fine, and every caller still gets every row.
  • A policy for `authenticated` with no owner check: any stranger who signs up reads everyone's data.
  • An owner-only update policy: users can edit their own row, including role or plan columns they should not touch.

The Supabase RLS guide has the policies to paste for each case, and Supabase security covers storage, functions and Realtime, which each have their own door.

Convex: every exported function is an endpoint

On Convex, the list of things a stranger can call is the list of public functions in your convex/ folder. Convex's best practices page gives the reason twice: public functions can be called by anyone, including potentially malicious attackers trying to break your app. The functions are also reachable outside your app. Convex documents an HTTP API where a POST to /api/query, /api/mutation or /api/action on your deployment URL runs a function by its path, and authentication on it is optional.

So the function names in your JavaScript bundle are a map of your backend, in the same way table names are on Supabase. Three mistakes follow from that.

  • No auth check. A query written during prototyping returns all rows of a table. The app only calls it from a page behind a login, and the function itself asks nothing.
  • Trusting an argument. The function takes userId or email from the client and returns that user's data. Convex's docs say not to use an argument that could be spoofed for access control checks.
  • Public when it should be internal. A function meant to be called by a cron job, a scheduler or another function is exported as public. Convex recommends internal functions for any logic that should not be called from a client, and says scheduled and ctx.run* calls should reference internal.*, not api.*.
ts
import { query } from "./_generated/server";
import { v } from "convex/values";

// Leaks: public, no identity check, trusts the caller's argument
export const listForUser = query({
  args: { userId: v.string() },
  handler: async (ctx, args) => {
    return await ctx.db
      .query("orders")
      .withIndex("by_owner", (q) => q.eq("ownerId", args.userId))
      .collect();
  },
});

// Holds: the owner comes from the verified identity
export const listMine = query({
  args: {},
  handler: async (ctx) => {
    const identity = await ctx.auth.getUserIdentity();
    if (identity === null) throw new Error("Not signed in");
    return await ctx.db
      .query("orders")
      .withIndex("by_owner", (q) => q.eq("ownerId", identity.tokenIdentifier))
      .collect();
  },
});
Convex's docs guarantee tokenIdentifier, subject and issuer on the identity. Store one of them as the owner when you create the record.

How to check a Convex app

  1. 1

    List your public functions

    Search the convex/ folder for functions built with query, mutation, action and httpAction. Everything not built with the internal variants is callable from the internet.

  2. 2

    Check each one for an identity check

    Each public function should either call ctx.auth.getUserIdentity() and refuse a null result, or be public on purpose, like a product list. Convex's best practices also ask for an argument validator on every public function.

  3. 3

    Check what internal code calls

    Search for ctx.runQuery, ctx.runMutation, ctx.runAction and ctx.scheduler, and open crons.ts. Convex's guidance is that these reference internal.* functions.

  4. 4

    Call one of your own functions with no token

    Use the HTTP API against your own deployment, as below. A private function should answer with an error.

bash
# 1. Public functions and identity checks
grep -rnE "= (query|mutation|action|httpAction)\(" convex/
grep -rn "getUserIdentity" convex/

# 2. Internal calls that point at public functions
grep -rnE "ctx\.(runQuery|runMutation|runAction|scheduler)" convex/ | grep "api\."

# 3. Your own deployment, with no Authorization header
curl -s "YOUR_DEPLOYMENT_URL/api/query" \
  -H "Content-Type: application/json" \
  -d '{"path":"orders:listMine","args":{},"format":"json"}'
Run it against your own deployment only. The deployment URL is on the Settings page of the Convex dashboard. orders:listMine is the file name and the export name.

How to check a Supabase app

The Supabase audit is two queries in the SQL editor of your own project, then a test from outside. The first query lists tables with RLS off. The second lists policies that pass for every caller.

sql
select c.relname as table_name
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public' and c.relkind = 'r' and not c.relrowsecurity;

select tablename, policyname, cmd, roles
from pg_policies
where schemaname = 'public' and (qual = 'true' or with_check = 'true');
Read-only. The free Supabase RLS checker reads the result for you.

This is the one place where Supabase is easier to audit: the whole access model of a project fits in the answer to two queries. On Convex, the audit is a code review of every public function.

Which one should you choose?

Pick Supabase if you want Postgres, SQL and a database you can query from anything. You accept that every table needs a policy, and that a forgotten one is public. Pick Convex if you prefer to write your backend as TypeScript functions and to keep authorization in code you can read and test like the rest of the app. You accept that every public function needs its own check, and that nothing reminds you when one is missing unless you add the lint rules Convex suggests.

Coding agents change the balance a little. An agent that adds a table on Supabase often forgets RLS. An agent that adds a function on Convex often forgets the identity check, or passes a user id from the client. The mistake changes shape and stays the same size. Both platforms use a separate provider or module for sign-in. If you are choosing one, see Clerk vs Supabase Auth.

What Keybrum tests on each, and what it does not

Keybrum is the automated pentest we build for apps made with AI. It attacks a live app from outside, once its owner has proved ownership.

  • On Convex: it calls every function named in your app's code with no session. Queries are read. When the deployment answers that a function is a mutation, it calls that mutation with a placeholder id that matches no record. A finding needs private-looking data to come back, or the mutation to return success.
  • On Supabase: it lists the tables the public key can reach, reads ten rows and counts the rest, tries inserts and updates that are rolled back, calls exposed database functions, lists storage buckets and subscribes to Realtime changes, with no session and then as a new account.

The limits matter here. A Convex deployment sits on Convex's domain, so Keybrum attacks it only when the backend itself is tied to your proven ownership. Otherwise the report says it was not tested and why. It only calls functions whose names appear in your code. The Convex attack runs with no session: it does not compare two signed-in accounts on Convex functions, so a function that checks for a session but returns another user's record is yours to review. Deletes are never tested.

A one-time report on one app is €49. Plans start at €29 a month excluding VAT and attack again on every deploy.

Questions

Is Convex more secure than Supabase?

Neither is safer by design. Convex removes the risk of a table exposed without a policy, because the browser cannot query tables. It replaces it with the risk of a public function without an auth check. The result depends on your code or your policies.

Does Convex have row level security?

Not as a built-in database feature. Convex's docs say it does not need an authorization framework like RLS, and that the common way to authorize is to check the user at the start of each public function. Access rules are TypeScript code inside your functions.

Are Convex functions public?

Yes, by default. The Convex docs say functions are public and accessible to clients unless you declare them as internal functions, which can only be called by other functions. Treat every public query, mutation, action and HTTP action as an endpoint anyone can call.

Is the Convex deployment URL a secret?

No. The client needs it to connect, so it ships in your frontend, like the Supabase project URL. Convex's HTTP API accepts calls to public functions on that URL with or without a user token, which is why each function has to check the caller.

How do I restrict a Convex function to signed-in users?

Call ctx.auth.getUserIdentity() at the top of the handler and throw when it returns null. Then scope the query to that identity and ignore any user id sent as an argument. For logic no client should call, use an internal function.

Can a coding agent get this right on its own?

Sometimes. Agents often produce a working feature with a missing policy or a missing identity check, because the app works either way. Ask the agent to list every public function or table and state the access rule for each, then test the deployed app from outside.

Sources

  1. 1.Internal Functions, Convex Docs
  2. 2.Best Practices, Convex Docs
  3. 3.Auth in Functions, Convex Docs
  4. 4.Authentication, Convex Docs
  5. 5.Convex HTTP API, Convex Docs
  6. 6.Row Level Security, Supabase Docs
  7. 7.Breaking change: tables not exposed to the Data and GraphQL API automatically, Supabase

Your app is public. So are its mistakes.

Check what any attacker can already see in it, free, in ten seconds. The full attack, with proof and fixes: €49 once, or €29 a month on a plan.

or continue with Google or GitHub