Abbi Labs

Guides

Supabase public profiles: how to hide email and other private columns (RLS can't)

By Abbi Labs · Last updated 5 December 2026

Scan your app free — see which of your Supabase tables a signed-out stranger can read right now.

Abbi Labs checks your live site from the outside: Supabase tables readable with your public key (flagged critical when they have columns like email or phone), secret keys in the JavaScript, exposed .env and .git files, security headers, CORS, cookie flags and TLS certificate expiry. Read-only. No sign-up for the quick check.

No app handy?

Example result · our deliberately broken demo app

6 issues found: 3 critical, 1 high, 1 medium, 1 low

  • Critical: Stripe live secret key in public JavaScript
  • Critical: /.env file readable by anyone
  • High: Git repository exposed (/.git/HEAD)

The demo's problems are planted on purpose. Paste your own URL above to see yours.

No sign-up. Read-only public-resource and protocol metadata checks. No model prompts or tool execution. Scan only sites you own or are allowed to test.

Run on every deploy or use from Cursor / Claude Code via MCP →

Weekly AI-app security checklist

One short email a week: a practical check for apps built with Supabase, Next.js and AI tools (RLS, leaked keys, headers and more). Unsubscribe anytime.

Most AI-built apps with user accounts end up with a profiles table. Then a feature needs other people's names and avatars (a leaderboard, comments, a team page, a public profile URL), the query fails, and the fix your AI tool suggests is a policy like this:

create policy "Profiles are viewable by everyone"
on public.profiles for select
to anon, authenticated
using (true);

Names and avatars now show up. So does everything else in the table, for anyone. If profiles also has email, phone, full_name, stripe_customer_id, date_of_birth or an address, those are now public too, even though no page in your app displays them.

That's because Row Level Security works on rows. Supabase's Column Level Security docs put it plainly: RLS "doesn't give you control over which columns they can access within rows." Your page asks for select=username,avatar_url, but your public key is in your JavaScript, and anyone can send the same request with select=*.

1. The 3-minute check from the outside

Do this on your own app only.

  1. Open a page that shows other users' profiles in a private window (signed out if the page allows it, otherwise as a fresh test account).
  2. DevTools > Network, filter on rest/v1, find the profiles request. Right-click > Copy as cURL.
  3. In the copied command change the select= value to * (and add &limit=3), then run it in a terminal.

Or build it by hand with the public key from your frontend:

curl 'https://<project-ref>.supabase.co/rest/v1/profiles?select=*&limit=3' \
  -H "apikey: <your public anon or publishable key>"

If you see emails, phone numbers or Stripe ids for people other than you, they're public. Repeat with a signed-in test account's token in an Authorization: Bearer header if your policy is to authenticated, because with open sign-ups "authenticated" means anyone with an email address.

2. Find every table with the same problem (SQL Editor)

List policies that let rows through to everyone:

select tablename, policyname, roles, cmd, qual
from pg_policies
where schemaname = 'public'
  and cmd in ('SELECT', 'ALL')
  and (qual = 'true' or roles && array['anon', 'public']::name[]);

Then, for each table it returns, see which columns those roles can actually read:

select column_name,
       has_column_privilege('anon', 'public.profiles', column_name, 'SELECT') as anon_can_read,
       has_column_privilege('authenticated', 'public.profiles', column_name, 'SELECT') as authenticated_can_read
from information_schema.columns
where table_schema = 'public' and table_name = 'profiles'
order by ordinal_position;

Any personal column showing true on a table with a public-read policy is exposed. Don't forget tables that look harmless but carry a copied email, like team_members, comments with an author email, or waitlist.

3. The fix: split private columns into their own table

Keep profiles to what you're happy for anyone to see, and move the rest into a table where each user can only read their own row:

create table public.profile_private (
  id uuid primary key references auth.users (id) on delete cascade,
  phone text,
  stripe_customer_id text,
  date_of_birth date
);
alter table public.profile_private enable row level security;

create policy "Users read own private profile"
on public.profile_private for select to authenticated
using ((select auth.uid()) = id);

grant select on public.profile_private to authenticated;

-- copy existing values, then drop them from the public table
insert into public.profile_private (id, phone, stripe_customer_id, date_of_birth)
select id, phone, stripe_customer_id, date_of_birth from public.profiles;

alter table public.profiles
  drop column phone,
  drop column stripe_customer_id,
  drop column date_of_birth;

Notes:

4. Drop the email copy if you can

The most common leaked column is an email that was copied from Auth into profiles by the sign-up trigger. Supabase Auth already keeps it in auth.users, which the public API doesn't expose. The signed-in user can get their own with supabase.auth.getUser(), and your server can look anyone up with the secret key. If nothing in the browser needs other people's emails, delete the column and remove it from the trigger.

5. Other options, and their catches

6. Test it again

Re-run the curl from step 1 with select=*, signed out and with a test account. You should only see the public columns. Then call profile_private as test user A and confirm you get A's row only, never B's. The SQL Editor runs as postgres and bypasses RLS, so test as a real user (see testing RLS as a real user).

A prompt for Lovable, Bolt or Cursor

List every table in my Supabase public schema that has a SELECT policy with using (true) or one that applies to anon. For each, list the columns and flag anything personal or business-sensitive (email, phone, names, addresses, dates of birth, Stripe or payment ids, tokens). Write a migration that moves the flagged columns into a separate <table>_private table keyed by the user id, with RLS on and a SELECT policy so each signed-in user can only read their own row, copies the existing data across, and drops the columns from the public table. Don't use views or column-level grants. Update the app code that reads those columns, and update the auth.users trigger if it writes them. Then give me curl commands with only the public key and select=* to prove the private columns no longer come back.

What an outside scan can and can't see

Abbi Labs reads your live site from the outside and never writes to your database. It requests select=* with limit=1 on Supabase tables referenced in your JavaScript (plus common table names) using only your public key, signed out. If rows come back it reports the table as readable by anyone, and marks it critical when Supabase's public API description lists personal columns such as email, phone, full_name or stripe_customer_id (column names only, no data stored). It can't see what signed-in users can read, so a to authenticated using (true) policy needs the test above. The free Supabase RLS policy checker (runs in your browser) flags using (true) policies and RLS that's off from your pasted policies.

Scan your app free

FAQ

Can an RLS policy hide a column?

No. Supabase's Column Level Security docs say RLS gives you control over who can access rows, but "doesn't give you control over which columns they can access within rows." If a SELECT policy lets a role read a row, that role can read every column in it that it has the SELECT privilege on.

My frontend only selects username and avatar_url. Isn't that enough?

No. The select list is chosen by whoever sends the request. Your public key is in your site's JavaScript, so anyone can call /rest/v1/profiles?select=* themselves. Only the database (policies plus privileges) decides what comes back.

Should I just revoke SELECT on the email column?

It works, with two catches from Supabase's docs: column privileges are an advanced feature they don't recommend for most users, and a role with a restricted column can't use select * on that table any more (including supabase-js .select() with no arguments). Privileges are per role, not per row, so users also can't read their own email from that table. A separate private table is usually simpler.

Do I even need email in profiles?

Often not. Supabase Auth already stores the user's email in auth.users, and the signed-in user can read their own via supabase.auth.getUser(). Copying it into a public table is a common AI-generated pattern that only adds risk. If your server needs it, read it with the secret key on the server.

What about a view with only the public columns?

A plain view runs with its owner's rights and skips RLS on the underlying table, which is why Supabase's Security Advisor flags it as a Security Definer View. It can be used deliberately to expose only safe columns, but then the base table must not be readable by anon or authenticated, and the advisor warning stays. The advisor's suggested fix, creating the view with (security_invoker = true), clears the warning but hides nothing on its own: the view then runs as the caller, so the caller needs SELECT on those columns of the base table and can query the base table directly too. It only helps together with the column privileges below. The split-table fix avoids that trade-off.

Does Abbi Labs check this?

Partly. The free outside scan requests select=* with limit=1 on Supabase tables it finds in your site's JavaScript (plus common names) using only your public key, signed out. If rows come back, it reports the table as readable by anyone and marks it critical when Supabase's public API description shows personal columns such as email, phone, full_name or stripe_customer_id (column names only; it stores a yes/no, not your data). It can't test what signed-in users see, so a policy for authenticated with using (true) still needs the signed-in test on this page.

Related

Weekly AI-app security checklist

One short email a week: a practical check for apps built with Supabase, Next.js and AI tools (RLS, leaked keys, headers and more). Unsubscribe anytime.