Repository navigation
Restore storage.objects policies lost in the dev2 move - #262
Merged
Merged
Conversation
The 2026-09-25 move to the self-hosted stack on dev2 dumped DDL for the app schemas only, so all 14 policies on storage.objects (avatars and encrypted-files buckets) were dropped. This re-creates the final state from the migrations, idempotently. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan13 finding(s) MEDIUM: 9 | LOW: 4
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
On 2026-09-25 the Supabase project moved from Supabase cloud to the self-hosted stack on dev2. The move dumped DDL for the app schemas (
publicetc.) only. pg_dump files a policy under its table's schema, so every RLS policy ONstorage.objectswas lost, while the buckets (copied as data) survived. With RLS on and no policy,storage.objectsdenies every anon/authenticated read and write, so avatar uploads and encrypted-file uploads/downloads fail for everyone. The cloud project is deleted, so the migrations are the only source of truth.What this restores
supabase/migrations/20260926210000_restore_storage_policies_lost_in_dev2_move.sql, idempotent (DROP POLICY IF EXISTSthenCREATE POLICY), final state after replaying every migration in order. 14 policies onstorage.objects:20250823223015: "Users can upload their own avatar", "Users can update their own avatar", "Users can delete their own avatar", "Anyone can view avatars"20250824005053: "Users can upload their own avatars", "Users can view all avatars", "Users can update their own avatars", "Users can delete their own avatars" (the fix drops only the plural names, so both sets existed)20250921060226: "Users can upload encrypted files", "Users can view encrypted files they have access to", "Users can delete their own encrypted files"20250926094631: "Users can upload files to encrypted-files bucket", "Users can view their own files in encrypted-files bucket", "Users can delete their own files in encrypted-files bucket"Definitions are verbatim, except that the tables inside the encrypted-files SELECT policy are schema-qualified as
public.*so the result does not depend on the search_path at apply time.The repo never created a trigger on any
auth.*orstorage.*table, so there is no trigger to restore and no backfill.Not yet applied to dev2; will be dry-run and applied from the operator session.
🤖 Generated with Claude Code