Guide
Are Supabase storage buckets public, and do public buckets skip RLS?
MondayMedic checks for common public mistakes. It is not a full security audit, and a good score does not mean your app is safe.
Paste your policies into our free RLS checker.
Check your live app first. Paste your app's public link into the free MondayMedic check. It reads only public pages and scripts, takes about a minute and needs no account. It flags Supabase tables the public key can read and secret keys in the browser. It does not look inside your storage buckets, it does not change data, and it is not a full security audit.
The short answer
Buckets are private by default. A bucket you mark Public skips access control for downloads. Supabase's docs say a public bucket "effectively bypasses access controls for both retrieving and serving files", so anyone who has a file's URL can open it, logged in or not. Your RLS policies on storage.objects still apply to uploading, deleting, moving and copying, and to listing the bucket's contents, but not to downloading a file whose URL someone already has.
That's fine for avatars, logos and blog images. It's the wrong place for invoices, ID photos, contracts, medical files or anything a user uploaded expecting it to stay private. Those belong in a private bucket, served with short-lived signed URLs.
What's the difference between a public and a private bucket?
- Private bucket (the default): every operation, downloads included, goes through RLS policies on the
storage.objectstable. A file can only be fetched with a signed-in user's token that a policy allows, or with a time-limited signed URL. - Public bucket: any file can be fetched at
https://[project_id].supabase.co/storage/v1/object/public/[bucket]/[file-path]with no login and no policy check. Uploads, deletes, moves and copies still need policies.
Supabase notes public buckets are faster because they cache differently. That speed is often why an AI builder, or a quick fix to "make the images load", flips a bucket to Public.
Do public buckets skip RLS?
For downloads, yes. Supabase says public buckets don't even need a SELECT policy for people to fetch known file paths. RLS still runs for writes. Two things catch people out:
- Guessable or shared paths. If files are named in a predictable way (a user id, an order number, a date), someone who sees one URL can try others. Links also get pasted into chats, emails and screenshots.
- A broad SELECT policy on a public bucket makes it listable. Supabase's Security Advisor has a check for this (lint
0025_public_bucket_allows_listing): a public bucket plus a policy likebucket_id = 'avatars'ortruelets API clients list every file in it. The public URLs keep working without that policy, so it's usually safe to drop.
How do I check my buckets?
In the Supabase dashboard, open Storage and look at each bucket's Public label. Or run this in the SQL Editor:
-- Which buckets are public?
select id, name, public from storage.buckets order by name;
-- Which policies exist on stored files?
select policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'storage' and tablename = 'objects';
For every bucket marked public = true, ask: would I be fine if a stranger opened any file in here? If not, it should be private. Then run the Security Advisor and look for the public-bucket-listing warning.
How do I make a bucket private safely?
Switch the bucket to private in the dashboard (Storage, edit the bucket, turn Public off), or in SQL, which is the fix Supabase's lint docs give:
update storage.buckets
set public = false
where id = 'your_bucket';
Your app will need a change at the same time. Links made with getPublicUrl stop working on a private bucket. Serve files with a signed URL instead:
const { data, error } = await supabase.storage
.from('your_bucket')
.createSignedUrl('user-id/invoice.pdf', 3600) // valid for 1 hour
Then add policies so each user can only read and write their own folder. Supabase's docs use the first folder in the path as the owner:
-- Users can upload only into a folder named after their user id
create policy "own folder upload"
on storage.objects for insert to authenticated
with check (
bucket_id = 'your_bucket' and
(storage.foldername(name))[1] = (select auth.jwt()->>'sub')
);
-- Users can read only files in their own folder
create policy "own folder read"
on storage.objects for select to authenticated
using (
bucket_id = 'your_bucket' and
(storage.foldername(name))[1] = (select auth.jwt()->>'sub')
);
Note that "private" isn't the same as "private per user". A policy that lets any authenticated user read the whole bucket means every signed-up account can open everyone's files.
How do I fix it in Lovable or Bolt?
Paste a request like this into the chat:
The Supabase storage bucket "your_bucket" holds private user uploads and is
set to Public. Make it private. Store each file under a folder named after
the uploader's user id. Add storage.objects policies so authenticated users
can only insert, select, update and delete files in their own folder.
Replace getPublicUrl with createSignedUrl (short expiry) wherever these files
are shown. Do not use the service_role key in the browser.
Then test it: open a file link while logged out, and again signed in as a second user. Neither should work for someone else's file.
What about the service role key?
The service key bypasses storage policies completely, which is why Supabase says to use it only from trusted servers. If it ever ships in your front end, anyone can read, overwrite or delete every file in every bucket, private ones included. See anon key vs service_role key for how to check.
Related guides
- How to check and fix open Supabase RLS in a Lovable app
- Is the Supabase anon key safe to expose?
- Does a Supabase view bypass RLS?
- Why a new Supabase table says permission denied for table (42501)
Want a weekly look from the outside? Run the free check on your live app.
FAQ
Are Supabase storage buckets public by default?
No. Supabase buckets are private by default. A bucket only becomes public if someone, or an AI builder, sets it to Public in the dashboard or in code.
Do public Supabase buckets skip RLS?
For downloads, yes. Supabase says a public bucket bypasses access controls for retrieving and serving files, so anyone with a file's URL can open it. RLS policies on storage.objects still apply to uploads, deletes, moves, copies and listing.
Can people list all the files in a public bucket?
Not by default. Listing goes through a SELECT policy on storage.objects. But if a public bucket also has a broad SELECT policy such as bucket_id = 'avatars' or true, clients can list its contents. Supabase's Security Advisor flags this as lint 0025, public bucket allows listing.
How do I share a file from a private bucket?
Create a time-limited signed URL with createSignedUrl, or let a signed-in user download it with their own token, subject to your storage policies.
Does the MondayMedic free check look at storage buckets?
No. The free check reads your live app from the outside and flags Supabase tables the public key can read and secret keys in the browser. Use the SQL in this guide and Supabase's Security Advisor to check your buckets.