PatchPaste · Guides
Last updated 29 October 2026
Is my Supabase storage bucket public?
Your app lets users upload photos, IDs or documents. Can a stranger open them? The answer depends on one bucket setting and a few policies, not on your app code.
Public is fine for files meant to be seen, like blog images or public profile pictures. It's a problem for ID photos, invoices, private photos, voice notes or anything a user uploads expecting only them (or their group) to see it.
Public vs private, in plain words
| Public bucket | Private bucket | |
|---|---|---|
| Who can download a file? | Anyone with the link | Only users your policies allow, or anyone holding a signed link before it expires |
| Do policies apply to downloads? | No | Yes |
| Do policies apply to uploads, deletes and moves? | Yes | Yes |
| Good for | Logos, blog images, public avatars | User documents, private photos, anything personal |
Two details people miss:
- Buckets are private by default (Supabase docs). If yours is public, someone switched it on. Often it's the AI editor, to make an image load.
- Uploads are blocked until you add policies. Supabase “does not allow any uploads to buckets without RLS policies” (Supabase docs: Storage access control). So when an upload fails, an AI tool may “fix” it with
with check (true). If that policy isn't limited to signed-in users and one bucket, it lets anyone, even logged-out visitors, upload files.
The 2-minute check
- Look at the bucket list. In the Supabase dashboard, open Storage. Each bucket shows whether it's public. For every public bucket, ask: would I be fine if a stranger saw every file in here?
- Open a file link while logged out. In your live app, right-click an uploaded image or file and copy its address. Open it in a private window. If the link contains
/storage/v1/object/public/, it comes from a public bucket and will load for anyone. - Read your storage policies. In the SQL editor, run:
select policyname, cmd, roles, qual, with_check from pg_policies where schemaname = 'storage' and tablename = 'objects';
Look fortruein thequalorwith_checkcolumn, and for policies on theanonorpublicrole. Those let people without an account read or write files.
How to make user files private
1. Switch the bucket to private. In Storage, edit the bucket and turn off public access. Public links to its files stop working, so your app needs step 3.
2. Let each user reach only their own files. A common pattern is to upload each file into a folder named after the user's ID, then check that folder in the policy. Adapted from Supabase's docs:
-- Users can upload only into their own folder create policy "Upload to own folder" on storage.objects for insert to authenticated with check ( bucket_id = 'user-files' and (storage.foldername(name))[1] = (select auth.jwt()->>'sub') ); -- Users can read only files they uploaded create policy "Read own files" on storage.objects for select to authenticated using ( bucket_id = 'user-files' and (select auth.jwt()->>'sub') = owner_id );
Change user-files to your bucket's name. If files are shared by a group (an event or a team), the read policy should check that the user belongs to that group instead. If your app overwrites files (upsert), it also needs select and update policies.
3. Show files with signed links, not public links. For a private bucket, your app asks Supabase for a link that works for a limited time, with createSignedUrl. After it expires, the link stops working. Signed-in users can also download with download, which checks your policies (Supabase docs).
4. Keep the service key out of the browser. Supabase says service keys “entirely bypass RLS policies” for Storage (Supabase docs). If your AI tool used it to make uploads work, the policies above don't matter. It belongs only in server code, like an Edge Function. See what to do if your service_role key is exposed.
A prompt you can paste into Lovable, Bolt or Cursor
Make the user-files storage bucket private. Store each upload under a folder named with the signed-in user's ID. Add RLS policies on storage.objects so users can only upload to and read from their own folder in that bucket. Show files with createSignedUrl instead of public URLs. Do not use the service_role key in the frontend, and do not add any policy that uses true.
Then test it: sign in as a second test user and try to open the first user's file. It should fail. Also try it logged out.
Quick checklist
- Only files meant for everyone are in public buckets
- No
using (true)orwith check (true)storage policies for anon or public - Every storage policy names a bucket and checks the user
- Private files are shown with signed links
- No service_role or secret key in the browser
Tables have the same trap. See why using (true) makes your data public and the pre-launch checklist.
Storage bucket FAQ
What is the difference between a public and a private Supabase bucket?
In a public bucket, anyone with a file's link can download it, with no login and no policy check. In a private bucket, every download goes through your RLS policies on storage.objects, or needs a signed link that only works for a limited time.
Is a public bucket always a mistake?
No. Public is the right choice for files everyone should see, like logos, blog images or public profile pictures. It's a mistake for files that belong to one user or one group, like ID photos, invoices or private photos.
Can people list every file in my public bucket?
Listing still goes through your policies on storage.objects. But anyone with a file's link can download it, and links get shared, cached and posted. Don't count on links being hard to guess.
I use a private bucket. Am I safe?
Only if your policies are tight. A select policy with using (true) on storage.objects lets everyone it applies to read every file. Run the pg_policies query on this page to check.
Does the service key follow storage policies?
No. Supabase says service keys entirely bypass RLS policies for Storage. Keep that key in server code only, like an Edge Function, never in the browser.
Does PatchPaste check my storage buckets?
No. PatchPaste's free scan looks at your live app from the outside: secret keys (including Supabase admin keys) in the JavaScript your site sends, common Supabase tables readable with your public key, exposed .env, .git and source map files, and security headers. It doesn't list or download storage files, so use the 2-minute check on this page for buckets.
Check the rest of your live app free
PatchPaste doesn't check storage buckets, so use the steps above for those. Paste your URL to check for leaked secret keys, common Supabase tables strangers can read (at most one row, never stored), exposed files and missing headers. The report is free.
Want to see one first? View a sample report.