Skip to content
ShipCheck
Guides

Supabase Storage buckets: public vs private, RLS policies and signed URLs

Updated 11 November 2026

A Supabase Storage bucket is either public or private. That one setting decides whether anyone with a file URL can download it. Uploads, deletes and (for private buckets) downloads are controlled by Row Level Security policies on storage.objects, which is a different table from the ones in your public schema. AI builders often make a bucket public so images show in the app, including buckets that hold invoices, ID photos or chat attachments.

Check your own app for this, free.

Paste your live URL. ShipCheck looks for leaked API keys in your page and JavaScript, exposed files like /.env and /.git, missing security headers, SSL certificate problems, domain expiry (custom domains only) and what Google sees without running JavaScript. You'll see your score without signing up.

See an example report

Short answer

Use a public bucket only for files anyone may see: avatars, blog images, marketing assets. Anyone who has (or can guess) the URL can download them, with no login. Keep everything else in a private bucket (the default). Add RLS policies on storage.objects so each signed-in user can only upload and read files in their own folder, and serve those files with a short-lived signed URL. A public URL on a private file is a mistake; a public bucket with a user-id in the path is still public.

Public vs private

Supabase's bucket docs describe two access models. Buckets are private by default.

  • Public: access control is skipped for retrieving and serving files. Anyone who has the asset URL can open it, at:
    https://YOUR-PROJECT.supabase.co/storage/v1/object/public/BUCKET/path/to/file.jpg
    getPublicUrl() only builds that URL; it doesn't check whether the caller is allowed to see the file. Uploads, deletes, moves and copies still need RLS policies. Public buckets are cached more aggressively, which is why they're faster for genuinely public media.
  • Private: every operation, including downloads, goes through RLS on storage.objects. There is no working public URL. A user downloads a file with their signed-in request (download() with their JWT, or /storage/v1/object/authenticated/…) or you give them a time-limited signed URL.

If a file shouldn't be open to the internet, the bucket must be private. Putting the file under {userId}/… in a public bucket does not hide it.

RLS on storage.objects

Policies live on storage.objects, not on your app tables. Supabase's access-control docs say that by default Storage allows no uploads until you add policies. INSERT covers upload; overwriting with upsert also needs SELECT and UPDATE.

A typical private bucket where each signed-in user has a folder named with their user id. storage.foldername(name) returns the path as an array, so (storage.foldername(name))[1] is the first folder (for a/b/c.png that is a). The current user id is auth.uid()::text, which is the same value as auth.jwt() ->> 'sub' in Supabase's own examples:

-- Uploads only into this user's folder in a private bucket
create policy "users upload to their folder"
on storage.objects
for insert
to authenticated
with check (
  bucket_id = 'documents'
  and (storage.foldername(name))[1] = (select auth.uid()::text)
);

-- Read, replace and delete only files in that folder
create policy "users read own folder"
on storage.objects
for select
to authenticated
using (
  bucket_id = 'documents'
  and (storage.foldername(name))[1] = (select auth.uid()::text)
);

create policy "users update own folder"
on storage.objects
for update
to authenticated
using (
  bucket_id = 'documents'
  and (storage.foldername(name))[1] = (select auth.uid()::text)
)
with check (
  bucket_id = 'documents'
  and (storage.foldername(name))[1] = (select auth.uid()::text)
);

create policy "users delete own folder"
on storage.objects
for delete
to authenticated
using (
  bucket_id = 'documents'
  and (storage.foldername(name))[1] = (select auth.uid()::text)
);

Your upload path in the app must match, for example ${session.user.id}/receipt.pdf. A policy of with check (true) or a missing bucket_id check lets users write to every bucket they can reach. The same ideas as table RLS apply: grants and policies are separate, and a 42501 error means a missing grant, not "turn RLS off". See how to check table RLS, insert, update and delete policies and the 30 Oct GRANT change.

Listing can leak files even when downloads look fine

A SELECT policy on storage.objects covers more than one action: listing the bucket and reading a file. A policy that is only meant to allow downloads can also let someone list every object they can select. Supabase's docs flag this and provide storage.allow_only_operation() and storage.allow_any_operation() so you can allow, for example, a download without allowing object.list. For a public bucket you usually don't need a public SELECT policy at all: the public URL already serves the file, and a loose select policy only makes the file list easier to scrape.

Signed URLs (createSignedUrl)

For a private bucket, createSignedUrl(path, expiresIn) returns a temporary link. expiresIn is in seconds: 3600 is one hour, which is the figure in Supabase's serving docs. Use a short expiry for sensitive files (minutes, not days). You can't revoke one signed URL on its own; you have to delete, move or rename the file, or rotate the project's URL signing key (which invalidates every signed URL).

Supabase recommends creating signed URLs on a server (for example an Edge Function). A signed URL created in the browser with the user's session only works for files that user's RLS already allows, which is fine for "open my own receipt". To share a private file with someone who isn't signed in, mint the URL on the server after you've checked they should see it. Never mint signed URLs with the service_role or sb_secret_ key in frontend code: that key bypasses every Storage policy.

Upload size and MIME limits

Set these on the bucket, not only in your React form (the form can be skipped). When you create or update the bucket you can pass fileSizeLimit and allowedMimeTypes (creating buckets):

await supabase.storage.updateBucket('avatars', {
  public: true,
  fileSizeLimit: '1MB',
  allowedMimeTypes: ['image/png', 'image/jpeg', 'image/webp'],
});

Uploads that are too large or of the wrong type are rejected. The per-bucket size can't exceed the project's global limit, which is 50 MB on the Free plan and up to 500 GB on Pro and Team (file limits). Prefer an exact list of types (image/png) over a wide wildcard if you only need a few.

How to test

  1. In the dashboard, open Storage and note which buckets are marked public. Or run select id, public, file_size_limit, allowed_mime_types from storage.buckets; in the SQL editor.
  2. Pick a file that should be private and request its public URL with no login:
    curl -sI "https://YOUR-PROJECT.supabase.co/storage/v1/object/public/documents/USER_ID/secret.pdf"
    A 200 means the bucket is public (or the file is in a public path). You want 400 or 404 on a private bucket.
  3. With only your anon or publishable key, try listing:
    curl -s "https://YOUR-PROJECT.supabase.co/storage/v1/object/list/documents" \
      -H "apikey: YOUR_PUBLISHABLE_OR_ANON_KEY" \
      -H "Content-Type: application/json" \
      -d '{"prefix":"","limit":100}'
    For a private bucket you want an error or an empty list, not other people's paths. (With a legacy eyJ… anon key, also send Authorization: Bearer YOUR_ANON_KEY.)
  4. Sign in as user A and as user B. A should not list, download, overwrite or delete B's folder.
  5. Confirm the bucket's size and MIME limits reject a too-large file and a disallowed type.

Checklist

  1. Buckets that hold private files are private. Only avatars and other public media are in a public bucket.
  2. Each private bucket has INSERT/SELECT/UPDATE/DELETE policies on storage.objects, scoped to a bucket id and to the user's folder or owner_id.
  3. No policy uses true for a private bucket, and uploads from the app go to ${user.id}/….
  4. Listing as a logged-out visitor doesn't return private paths. A SELECT policy that allows downloads doesn't accidentally allow object.list for everyone.
  5. Private files are served with a short-lived signed URL, minted on the server when the recipient isn't the owner.
  6. The bucket has a file size limit and an allowed MIME list.
  7. The service_role or sb_secret_ key is not in the frontend. It bypasses Storage RLS too.

Storage is one item on the list. For tables, keys and the rest, see the pre-launch security checklist.

What ShipCheck checks here (and what it doesn't)

ShipCheck does not probe Storage buckets. It doesn't list objects, fetch file URLs or evaluate policies on storage.objects. The free scan of your live URL looks for known secret key formats in your page and JavaScript (including a service_role or sb_secret_ key, which would bypass Storage policies), public /.env and /.git files, public source maps, security headers, the HTTP to HTTPS redirect, SSL and domain expiry (custom domains only), what search engines see without JavaScript, and whether the app uses Supabase or Firebase. A read-only test of which database tables answer anonymous reads is available only after you verify you own the app (a free account is enough). That table test does not include Storage. Paid plans re-scan weekly on Solo ($12/mo) or daily on Builder ($29/mo), and they check once a day that your app is up. The checks above are still yours to run in the Supabase dashboard.

FAQ

Should my Supabase Storage bucket be public or private?

Public only if every file in it is fine for anyone on the internet to download: avatars, blog images, marketing assets. Private is the default, and it's the right choice for documents, receipts, ID photos, chat attachments and anything else that belongs to a user. A public bucket serves files to anyone who has the URL, with no login, even if the path contains a user id.

Does making a Supabase bucket public skip all security?

It skips access control for downloading and serving files. Anyone with the file URL can open it. Uploads, deletes, moves and copies still need RLS policies on storage.objects. That's why a public bucket can still reject an anonymous upload, and why a private file must not live in a public bucket.

How do I write a Supabase Storage RLS policy so users only access their own files?

Put each user's files in a folder named with their user id, and check that folder in the policy: (storage.foldername(name))[1] = (select auth.uid()::text), plus a bucket_id check. auth.jwt()->>'sub' is the same id. Add separate policies for insert, select, update and delete. Don't use with check (true) on a private bucket.

What is a Supabase signed URL and how long should it last?

createSignedUrl(path, expiresIn) returns a temporary link to a file in a private bucket. expiresIn is in seconds; 3600 is one hour. Use a short expiry for sensitive files. You can't revoke a single signed URL; you have to delete, move or rename the file, or rotate the project's signing key. Create signed URLs on the server when the recipient isn't the file's owner.

Can someone list all the files in my Supabase bucket?

Yes, if a SELECT policy on storage.objects allows it. Listing and downloading share the SELECT privilege, so a policy meant only for downloads can also expose the file list. Restrict listing with storage.allow_only_operation('object.list') (or allow_any_operation), and test a list request with only your anon or publishable key. On a public bucket, skip a public SELECT policy; the public URL already serves the file.

Does ShipCheck check my Supabase Storage buckets?

No. ShipCheck doesn't list objects, fetch file URLs or evaluate storage.objects policies. The free scan checks your live site for leaked secret keys, exposed files, source maps, security headers, the HTTPS redirect, SSL and domain expiry, and what Google sees without JavaScript. The optional table-read test (verified owners, free account) only covers database tables, not Storage.

Run the same checks on your app.

A free scan takes under a minute. No card, and no sign-up to see your score and the list of issues.

See an example report