GuardCue

Guide · Supabase

Supabase public vs private bucket: is your storage safe?

A public bucket lets anyone with a file’s link download it, no sign in needed. A private bucket lets in only the people your rules allow. Use public for your own images, like your logo, and private for anything your users upload. But private is not safe on its own: on our own test app, a bucket set to private still let a stranger list and download its files, because its rule let everyone read.

What is the difference between a public and a private bucket?

A bucket is a folder for files in Supabase Storage. Supabase makes new buckets private unless you choose otherwise.

Which one should I use?

Why “make the bucket public” is the risky fix

When an upload or a download fails, an AI tool may suggest making the bucket public, because the error goes away. It goes away because every file in that bucket can now be downloaded by anyone who has or finds its link. For a bucket of users’ documents, that is a data leak. If uploads fail with “new row violates row-level security policy”, the safe fix is a rule, not a public bucket: here is that fix.

Why a private bucket can still be open

We tested this on our own Lovable test app. Its uploads bucket is private: the public link to a file was refused. But using only the public key that sits in every Supabase website, the same key any visitor’s browser has, we could list the files and download one. The bucket had a rule that let everyone read. Private only means “the rules decide”, so a rule that says “everyone” makes it as open as a public one, and a stranger can even see every file name.

The safe setup

Private buckets for user files, with rules that let each person reach only their own folder. Paste this into Lovable, Claude, Bolt, Cursor or whichever tool built your app:

Check my Supabase Storage setup. Any bucket that holds files people upload (photos, documents, receipts) must be private. On storage.objects, add policies so a signed in user can upload, read and delete only files inside a folder named with their own user id, using (storage.foldername(name))[1] = auth.uid()::text. Remove any storage policy that lets everyone or anonymous users read. Keep only the app’s own public images, like the logo and product photos, in a public bucket. Show private files with signed links. Then list every bucket, whether it is public, and every storage policy.

One more key to keep out of your website: the service role (secret) key ignores every storage rule. Check whether a key is safe to show.

How do I check my buckets?

  1. In the Supabase dashboard, open Storage. Each bucket shows whether it is public.
  2. For each private bucket, open its policies and look for any rule for reading that applies to everyone or to anonymous users.
  3. Copy the link of a file that should be private, open it in a private browser window while signed out, and make sure it does not download.

GuardCue checks your storage buckets for you once you have proved the site is yours (from the Launch Check), because testing someone’s storage is not something we do to a stranger’s app. The free check already shows what a stranger can reach from your web address alone.

GuardCue checks apps built with Claude, Lovable, Bolt or any other AI tool and explains what it finds in plain English. Related: row level security explained.