Next.js + Expo + Supabase starter with RLS and exact grants checked on every change #52309
Replies: 2 comments
|
The revoke-all-then-grant-per-table default is the right call. Two things sit outside RLS, so they could be worth a test in the harness:
One more check that lives outside the repo: after deploy, look at the live site's JS bundle and response headers for a service_role key or other secrets, since generated apps drift over time. I build DeployVet, which does that kind of outside-in check on a live URL. The free check is here if it is useful: https://deployvet.com/?utm_source=github&utm_medium=reply&utm_campaign=firstcustomer |
|
The part worth calling out is the revoke-then-exact-grants habit — it removes the whole class of "the migration ran, then the first API call fails with 42501" that the October 30 Supabase change made everyone feel. Tables created with explicit grants behave the same whether the default-grant behavior changes or not, which is the only durable answer to that class of problem. If you want that invariant enforced in CI rather than trusted from the agent, an earlier version of what I use checks the One addition to your checklist from the other direction: |
Uh oh!
There was an error while loading. Please reload this page.
I built a CLI that scaffolds a Next.js web app and an Expo mobile app on one Supabase backend, with checks that a coding agent (Claude Code) and CI must pass before a change lands.
On the Supabase side:
org_id, withFORCE ROW LEVEL SECURITYand one policy per operation.anon,authenticatedandservice_role, then grants only what its policies need, so new tables don't rely on the default grants that change on 30 October.service_rolestays in Edge Functions, and the server usesgetUser(), nevergetSession().Try it:
npx next-expo-supabase-agent-harness@latest initRepo: https://github.com/BhodiSea/next-expo-supabase-agent-harness
Docs: https://bhodisea.github.io/next-expo-supabase-agent-harness/
Feedback welcome, especially from anyone running RLS-heavy apps in production.
All reactions