Prevents directory traversal in Supabase Storage via path validation functions and storage RLS.
97
97%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Prevents directory traversal in Supabase Storage via path validation functions and storage RLS.
This tile enforces tenant-isolated file storage by creating a Postgres validation function (storage.validate_path) and attaching RLS policies to storage.objects. Every file operation is scoped to the authenticated user's tenant prefix, blocking traversal attacks at the database level.
storage.validate_path(path text, expected_tenant_id uuid) RETURNS boolean.., ./, or //.expected_tenant_id.SECURITY DEFINER with search_path = storage, public.| Operation | Condition |
|---|---|
| INSERT | storage.validate_path(name, auth.uid()) = true |
| SELECT | starts_with(name, auth.uid()::text || '/') |
| DELETE | starts_with(name, auth.uid()::text || '/') |
All paths MUST follow: {tenant_id}/{category}/{filename}
storage schema MUST be enabled on the target project.