Cenk Kurtoğlu©26

Supabase security · 6 minute read

Supabase Storage: a public bucket URL bypasses every RLS policy

You create a storage bucket, upload user avatars and invoices, and write RLS policies on storage.objects to keep them private. Then someone shares the bucket URL — and every object is public, regardless of your policies. A public bucket bypasses RLS entirely.

This is not a bug. It is the documented behavior of public buckets. The security boundary is the bucket's public flag, not the table policies below it.

What a public bucket means

When public = true on storage.buckets, the object URL (/storage/v1/object/public/<bucket>/<path>) serves the file to anyone who has it. No auth header, no JWT, no RLS evaluation, no row filter. The object is on the open web.

Private objects (including those in private buckets) require a valid user session and pass through storage.objects RLS policies. Public objects skip all of that.

The catalog check

Find every public bucket in your project:

select id, name, public, created_at
from storage.buckets
where public = true
order by name;

Every row returned is a bucket whose objects are reachable by anyone with the URL — even if you wrote restrictive policies onstorage.objects.

For the full surface, list all buckets and note which are public:

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

The safe pattern: private bucket + signed URLs

Keep data behind your app instead of on the open web:

  1. Create the bucket as public = false.
  2. Write storage.objects RLS policies scoped by owner (for example: auth.uid() = owner_id).
  3. Generate signed URLs from server-side code (Edge Function or backend) with an expiration. The client never sees the object path directly; it receives a time-limited signed URL.

A signed URL is valid only for its lifetime and only for the specific object. After expiry, the URL returns 404 even if the object still exists.

Where the leak usually hides

What to audit before you ship

-- Public buckets (the gap)
select id, name, public from storage.buckets where public = true;

-- All buckets with their public flag (full surface)
select id, name, public from storage.buckets order by public desc, name;

If any bucket returns public = true and it should not be publicly readable, flip it to private and review thestorage.objects policies for the objects inside.

Pair this with the table checks from the 13-point checklist and the Realtime channel checks from the Realtime security guide. Storage is the third boundary where RLS does not apply by default.

Honest limits

These are catalog reads against the Supabase Storage schema. They cannot test whether a specific signed URL leaks, whether your Edge Function signs URLs with the right expiration, or whether a public bucket URL has already been indexed by a scraper. Those require a live request test with and without auth headers.

A nightly read-only diff over the bucket catalog reports new public buckets before they become an incident. The free starter is here:

Get the free RLS Drift Monitor (13 checks, n8n + SQL) →

If you want a person to review your bucket configuration and storage policies, that is a fixed-scope review: Supabase RLS Spot Check. Work starts only after payment is secured.

Related: Supabase Edge Functions: service_role bypasses every RLS policy · the first 15 minutes of a Supabase security audit.

Free entry

If you would rather run these checks yourself

Honest limit: a catalog check is not proof of a leak, and an empty log is not proof the key was never used. Zero findings does not mean safe. If you want a human: $29 self-run kit · $95 spot check (five tables, one working day) · $195 full audit — work starts only after payment is secured.

Template bundle

Review all 20 frontend starters in one bundle

20 editable frontend starters with live demos are $79 — one payment, no subscription.

View the Bundle — $79↗