Replies: 3 comments
|
Short answer: You cannot create Why your diagnostics show what they show:
What actually works in hosted Supabase:
The practical migration workflow: # In your CI/CD (GitHub Actions, GitLab CI, etc.)
# Use the Storage Management API with a service role key
- name: Deploy Storage Policies
run: |
curl -X POST "https://${PROJECT_REF}.supabase.co/storage/v1/policies" \
-H "Authorization: Bearer ${SERVICE_ROLE_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "users_own_avatars",
"bucket_id": "avatars",
"operation": "ALL",
"definition": "(auth.uid() = owner) OR (bucket_id = 'avatars' AND auth.uid() = owner)",
"restrictive": false // only PERMISSIVE supported via API
}'For your ecommerce staging environment specifically:
What about
Bottom line: Don't fight the platform on this. Use the Dashboard or Storage API for policy management. If you need "restrictive" semantics (multiple policies must all pass), encode the logic into a single policy's Reference: Supabase Storage policy docs + community discussions (#51482, #51492, #51499 on role/permission architecture). |
|
Here are the answers to your questions regarding 1. Officially Supported Method for
|
|
A few points that should help before you apply anything. How restrictive policies combine. Postgres ORs all applicable permissive policies, ANDs all applicable restrictive policies, and requires both results to pass. If no permissive policy applies, access is denied. So a restrictive policy only narrows access that a permissive policy already grants. For Storage, that usually means pairing a permissive policy (e.g. access to a bucket) with a restrictive one (your tenant or ownership condition). (CREATE POLICY docs) Why ownership checks alone may not settle this. In stock Postgres, only the table owner can create policies, which is what your checks reflect. Supabase's Postgres images use supautils Temporary capability probe (staging only). This only checks whether your executor can create a restrictive policy on If any statement errors, run If the Migration workflow. Put the policies in a regular migration ( |
Uh oh!
There was an error while loading. Please reload this page.
Hello Supabase team,
I'm preparing a staging environment for an ecommerce application using hosted Supabase.
I need to create RLS policies with
AS RESTRICTIVE, includingUSINGandWITH CHECKexpressions, onstorage.objects.My read-only diagnostics returned:
supabase_storage_adminmember_of_owner: falseinherits_owner: falseBefore applying any migrations, I would like to confirm:
AS RESTRICTIVEpolicies onstorage.objectsin a hosted Supabase project?I do not want to use
ALTER OWNER,SET ROLE, disable RLS, or grant internal roles.No migrations have been applied yet.
Thank you.
All reactions