LeakPatrol › Guides

Is your Supabase storage bucket public? What anyone can see, and the fix

By LeakPatrol · Updated 20 November 2026

AI builders love public storage buckets. They make image uploads "just work": no policies, no signed URLs, no errors. That is fine for logos and avatars. It is not fine when the same bucket holds ID photos, invoices, contracts or anything a user uploaded expecting it to stay private. Here is what a public bucket really exposes and how to check yours in two minutes.

What "public" means in Supabase Storage

The 2-minute check

  1. In Supabase, open Storage. Buckets marked Public are readable by anyone with a link.
  2. For each public bucket, ask: would a user be upset if a stranger saw these files? Avatars and product photos: fine. Passports, payslips, medical files, private chat attachments: not fine.
  3. Open Storage → Policies (or the SQL editor) and look at select policies on storage.objects. A policy for anon or public that only checks the bucket name lets anyone list the bucket.
  4. Check the Security Advisor in your Supabase dashboard; it flags several storage and RLS problems.

The fix

  1. Keep public buckets for public things only. Logos, marketing images, avatars that are shown to everyone anyway.
  2. Move private uploads to a private bucket. Create a new bucket with Public off, and store files under the user's id, for example <user-id>/invoice.pdf.
  3. Add owner-only policies so users can read and upload only their own folder:
create policy "Users read own files"
on storage.objects for select to authenticated
using (
  bucket_id = 'private-uploads'
  and (storage.foldername(name))[1] = (select auth.uid())::text
);

create policy "Users upload to own folder"
on storage.objects for insert to authenticated
with check (
  bucket_id = 'private-uploads'
  and (storage.foldername(name))[1] = (select auth.uid())::text
);
  1. Show files with signed URLs that expire, instead of permanent public links:
const { data } = await supabase.storage
  .from('private-uploads')
  .createSignedUrl(`${user.id}/invoice.pdf`, 60); // valid for 60 seconds
  1. Remove broad select policies from public buckets. Public files load from their URL without one, so the policy mostly adds the ability to list everything.
  2. Move the old files. Copy sensitive files from the public bucket to the private one, update the paths in your database, then delete the public copies. Links that were shared or indexed stop working once the files are gone.

A prompt to paste into Lovable, Bolt or Cursor

Audit my Supabase Storage setup:
1. List every bucket, whether it is public, and what the app stores in it.
2. Anything user-uploaded and private (documents, IDs, invoices,
   attachments) must go in a private bucket, under the user's id folder.
3. Add select and insert policies on storage.objects so users can only
   access their own folder. No select policy for anon on any bucket.
4. Replace getPublicUrl for private files with createSignedUrl.
5. Give me a migration plan for files already in public buckets.

LeakPatrol's free read-only scan checks your live site from the outside for public files, leaked keys and Supabase tables that answer without a login. Related: storage upload "row-level security" errors and the Lovable data exposure study.

Check your app in a minute

Free, read-only, no sign-up. Every problem comes with a plain-English fix and a prompt for your AI tool.

Get the 10-point checklist

Every check we run on AI-built apps, with how to do each one yourself. Straight to your inbox.

Questions

Can anyone see files in a public Supabase bucket?

Anyone who has or guesses a file URL can download it without logging in. If there is also a broad select policy on storage.objects, anyone with your publishable key can list every file in the bucket.

Do public Supabase buckets need a select policy?

No. Public files load from their public URL without one. A broad select policy on a public bucket mainly lets people list all files, so remove it unless you need listing and can scope it.

How do I make Supabase storage files private?

Use a bucket with Public turned off, store files under the user id folder, add select and insert policies that check the folder matches auth.uid(), and show files with createSignedUrl.

Is it safe to use a public bucket for avatars?

Usually yes, if avatars are shown to other users anyway. Keep documents, IDs, invoices and private attachments in a private bucket.

More guides