Supabase RLS explained for vibe coders
Row-level security decides which database rows a caller can read or change. In a Supabase app, the browser's public key identifies the project; correctly configured policies enforce the user's access.
Check your app free, first fix freeThink of RLS as a database permission check attached to each row, not a login screen. A signed-in user still needs permission for the requested operation. Model private, shared and public data separately, test both an owner and a non-owner, and verify inserts and updates as well as reads.
Why a working login is not enough
Authentication answers who is calling. Authorization answers what that identity may do. You can have working sign-in and still let every authenticated user read every order because a policy grants access without checking ownership. The application appears correct during a one-account demo because there is no second user to expose the mistake.
Start with an access model for each table. A profile might be partly public while its billing information remains private. A project might belong to a team rather than a single user. Describe these distinctions before asking a builder to generate policies. The database cannot infer your business rules from a pleasant interface.
Learn the two sides of a row policy
For reads and existing-row operations, USING decides which rows the caller can target. WITH CHECK controls whether a proposed new row is permitted for inserts and updates. An update policy that checks the old owner but not the new owner can permit unintended reassignment. Review the complete operation, not just the clause that makes one query succeed.
-- Illustration for a private, single-owner table.
-- Confirm schema, column, roles and existing policies first.
alter table public.notes enable row level security;
create policy "read own notes" on public.notes
for select to authenticated
using ((select auth.uid()) = user_id);This example intentionally covers SELECT only. It does not create a complete write policy, preserve team workflows automatically or remove an already-permissive policy. Inspect existing rules before applying changes. Multiple permissive policies can combine in ways that leave access broader than the new rule suggests.
Test with three callers and known synthetic data
Create a test note owned by account A. As A, verify the note remains usable. As B, request that known note through the actual application path. Finally, check anonymous access if the table should be private. Use test records rather than browsing customer data.
A denied query from B is useful evidence for that path and operation. It does not establish that delete operations, exports, storage objects or server endpoints obey the same rule. List those separately so a passing read test is not accidentally generalized to every feature.
Interpret the outside scan conservatively
An authorized public scan may identify the project's public client configuration and use supported count-only signals to assess anonymous exposure. It does not need row contents to report a positive count. An empty table, an unreadable configuration or an unsupported response can leave the answer unknown.
RLS also does not protect a browser that was given a privileged service-role key. That credential bypasses the restriction you intended to test. Keep it on an appropriately authorized trusted server, and rotate it if it was shipped publicly.
Turn the check into a release decision
Keep a small record of the production URL, the time you checked it, the exact finding and the action you took. A local preview and a deployed application can have different environment variables, response headers and database projects. After a repair, deploy the intended version and check the public address again. Do not assume that changing a repository file changed the live system.
Read coverage as carefully as the score. A timed-out asset, an ambiguous backend configuration or a request that could not safely establish access should remain unknown. It should not disappear from your release notes merely because there is no red finding. If a check was not completed, decide who will review it and what additional evidence is needed.
ProofForge's free report includes the first fix. The $9 Fix Report unlocks all findings' available repair guidance and builder prompts, with a PDF and private report link. Fix + Guard costs $29 once and adds builder rules, on-demand deploy-hook scans for 30 days and four weekly rechecks you start yourself. These are different deliverables, not different promises that an application is completely secure.
Keep private report URLs out of public issues and commits. If you need shareable evidence, use the owner-verification and publication flow for an eligible receipt. A signature protects the recorded assessment against undetected changes; it does not make the assessment exhaustive, prove a business outcome, or show that a later deployment still matches an earlier result.
Questions builders ask
Does turning RLS on create all needed policies?
Is USING true always wrong?
Can the service role bypass RLS?
Related checks and fixes
Continue with a related guide
Sources
Scan your app free
See what your live app ships to every visitor, with the first fix free. A clean scan is not a full audit. Run it only on an app you own or have permission to test.
Scan your app free