LeakyVibe

Guides · Updated 2026-10-31

Is my Supabase Storage bucket public? How to check and lock it down

Short answer: A Supabase Storage bucket is public when its "public" setting is on. Then anyone who has a file's URL can download it, with no login and no access check. Buckets are private by default, but AI-built apps often switch them to public so images "just work". To check, look at the Public badge in Storage in the dashboard, or run select id, public from storage.buckets. Public is fine for avatars and blog images. For anything personal (IDs, invoices, voice notes, documents), use a private bucket, policies that let each user reach only their own folder, and short-lived signed URLs.

Does your app have this problem? Free scan, 15 sec, no sign-up

or watch it scan our demo app ▶

Public vs private buckets: what each one means

Every Supabase Storage bucket has an access model (https://supabase.com/docs/guides/storage/buckets/fundamentals):

  • Private (the default): every operation, downloads included, goes through access control with Row Level Security (RLS) policies on the storage.objects table. A file can only be fetched by a signed-in user whose policies allow it, or through a signed URL.
  • Public: downloads skip access control entirely. Supabase's docs say it plainly: "anyone who possesses the asset URL can readily access the file." Uploading, deleting, moving and copying are still checked by policies.

Public file URLs follow a fixed pattern: https://<project>.supabase.co/storage/v1/object/public/<bucket>/<file path> (https://supabase.com/docs/guides/storage/serving/downloads). If file names are guessable, like user-123/passport.jpg or invoice-0042.pdf, someone can try names until they hit real files.

Public is the right choice for things meant to be seen: profile pictures, product photos, blog images. It's the wrong choice for anything a user uploads privately: ID documents, invoices, contracts, medical files, voice notes, chat attachments.

1. Check which buckets are public (1 minute)

In the Supabase dashboard, open Storage: public buckets are marked as public. Or run this in the SQL Editor. The storage.buckets table holds each bucket's settings (https://supabase.com/docs/guides/storage/schema/design):

select id, public, file_size_limit, allowed_mime_types
from storage.buckets
order by public desc, id;

For each row with public = true, ask one question: would it be a problem if a stranger opened any file in this bucket? If yes, that bucket should be private.

2. Check whether anyone can list the files

A public bucket doesn't need a SELECT policy for its URLs to work. But a broad SELECT policy on storage.objects (for example using (bucket_id = 'avatars') or using (true)) lets anyone with your public key list every file in the bucket, so they no longer have to guess names. Supabase's Security Advisor flags this as "public bucket allows listing" (lint 0025, https://supabase.com/docs/guides/database/database-advisors).

To see the Storage policies you have:

select policyname, roles, cmd, qual, with_check
from pg_policies
where schemaname = 'storage' and tablename = 'objects'
order by policyname;

Look for SELECT or ALL policies whose qual is just a bucket_id check or true, and whose roles include {public} or {anon}. For a public bucket, the usual fix is to drop that policy: Supabase notes that public URLs keep working without it.

3. Lock a private bucket to each user's own files

If a bucket holds personal files, make it private (toggle Public off in the bucket's settings), then give each user a folder named after their user id and write policies that only allow that folder. These follow Supabase's examples (https://supabase.com/docs/guides/storage/security/access-control); replace user-files with your bucket id:

create policy "Users upload to their own folder"
on storage.objects for insert to authenticated
with check (
  bucket_id = 'user-files' and
  (storage.foldername(name))[1] = (select auth.jwt() ->> 'sub')
);

create policy "Users read their own files"
on storage.objects for select to authenticated
using (
  bucket_id = 'user-files' and
  (select auth.jwt() ->> 'sub') = owner_id
);

Then upload with a path like `${user.id}/${fileName}`. Notes:

  • With no policies at all, Storage doesn't allow uploads to a bucket. Avoid the shortcut many AI tools take: a policy with with check (true) for everyone, which lets anyone upload anything.
  • Overwriting a file (upsert) also needs SELECT and UPDATE policies, not just INSERT.
  • Your server can skip all of this with the secret (service_role) key, because it bypasses RLS. That key must never be in the browser or in the app.

4. Use short signed URLs to share private files

To show a private file, create a signed URL: supabase.storage.from('user-files').createSignedUrl(path, 60) gives a link that works for 60 seconds. Keep in mind (https://supabase.com/docs/guides/storage/serving/downloads):

  • Anyone who has a signed URL can use it until it expires. It does not check who is logged in.
  • You can't revoke a single signed URL. To kill one, delete, move or rename the file. To kill all of them, rotate the URL signing key in the dashboard.
  • Rotating your API keys or JWT secret does not invalidate signed URLs.

So keep expiry short (seconds to minutes for downloads) and create a fresh one each time. AI-written code often sets a year "so links don't break", which turns a private file into a long-lived public link.

5. Limit what can be uploaded

Checks in your upload form run in the browser, so anyone can skip them. Set limits on the bucket itself: a maximum file size and a list of allowed file types, such as image/png and image/jpeg (https://supabase.com/docs/guides/storage/uploads/file-limits). There's also a global size limit in Storage settings (up to 50 MB on the Free plan); per-bucket limits can't be higher than it. This stops someone from filling your storage with huge files or uploading an .html page to a public bucket.

Quick checklist

  1. List buckets with public = true and confirm each one only holds files meant for everyone.
  2. Make buckets with personal files private.
  3. Drop broad SELECT policies on public buckets so their files can't be listed (Security Advisor lint 0025).
  4. Give each user a folder named after their user id and policies that only allow that folder.
  5. Use signed URLs with short expiry for private files.
  6. Set a max file size and allowed file types on every bucket that accepts uploads.
  7. Keep the secret (service_role) key on the server only.

Your database tables need the same check. How to tell if a Supabase table is public: https://leakyvibe.com/guides/how-to-check-if-supabase-table-is-public

The free LeakyVibe scan at the top of this page checks your live site from the outside for secret keys in public JavaScript and Supabase tables that answer the public key. It's a fast first check, not a full audit: it can't see your dashboard, your server, or files behind a login.

Official sources (checked 2026-10-31): Supabase, "Storage Buckets" (https://supabase.com/docs/guides/storage/buckets/fundamentals), "Storage Access Control" (https://supabase.com/docs/guides/storage/security/access-control), "Serving assets / downloads" (https://supabase.com/docs/guides/storage/serving/downloads), "Limits" (https://supabase.com/docs/guides/storage/uploads/file-limits), "The Storage Schema" (https://supabase.com/docs/guides/storage/schema/design), "Performance and Security Advisors" (https://supabase.com/docs/guides/database/database-advisors); Supabase splinter lint 0025_public_bucket_allows_listing.

Check your app for this now

Free scan · about 15 seconds · no sign-up

Passive, read-only checks. Only scan apps you own or have permission to test.