Skip to content
All rules

SB-BUCKET-PUBLIC

Public storage bucket holding user content

Severity
Medium
Confidence
Medium (to verify)
Stack
Supabase
Runs
On by default

What the CLI looks for

A storage bucket created as public whose name suggests user content (uploads, documents, invoices, avatars…).

Why it matters

Files in a public bucket can be read by anyone with the URL, with no policy check. That is fine for logos and marketing images, and risky for documents your users upload.

How to fix it

Make the bucket private, serve files through signed URLs and add a policy that limits access to each user's folder.

update storage.buckets set public = false where id = 'documents';

create policy "Owners read their files" on storage.objects
  for select to authenticated
  using (
    bucket_id = 'documents'
    and (storage.foldername(name))[1] = (select auth.uid())::text
  );