SupabaseS
Supabase3y ago
Tobi

Restrict read access to public Bucket possible?

Is it possible to restrict read/select access to a public bucket?

The behaviour I would like to achieve is that I store an image url in a profile table. Once a user retrieves that data and wants to access the image url, the RLS policy should check that the user is authenticated. Is that possible?

I am not sure if I understand the docs correct. There it is stated that public buckets always bypass the select policies. On the other hand, private buckets urls are only valid for a time x. So if I store a private url in a database table, that url might me invalid if another authenticated user feteches it. If I store it as public url, every anon user can retrieve it?

What is the solution here?
Was this page helpful?