Repository navigation
Restore storage.objects policies lost in the dev2 move - #7
Merged
Merged
Conversation
The 2026-09-25 move to the self-hosted stack on dev2 dumped DDL for the app schemas only, so the media bucket's policies on storage.objects were dropped. This re-creates the final state from the repo SQL, idempotently. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan3 finding(s) HIGH/CRITICAL: 1 | LOW: 2
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 themediabucket (copied as data) survived. With RLS on and no policy,storage.objectsdenies anon/authenticated reads and writes through the API; only service-role access and public object URLs keep working. The cloud project is deleted, so the repo SQL is 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). 5 policies onstorage.objects:supabase/migrations/20260119061259_create_media_bucket.sql: "Public read access for media", "Authenticated users can upload media", "Users can update their own media", "Users can delete their own media"packages/supabase/storage.sql(a hand-run script, not a migration): "Server-side upload only" (WITH CHECK (false)). It is permissive, so it grants nothing by itself; restored so the stack matches what the cloud project most likely held.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