Skip to content

Restore storage.objects policies lost in the dev2 move - #7

Merged
ralyodio merged 1 commit into
masterfrom
fix/restore-dev2-lost-auth-storage
Sep 26, 2026
Merged

ralyodio merged 1 commit into
masterfrom
fix/restore-dev2-lost-auth-storage

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

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 (public etc.) only. pg_dump files a policy under its table's schema, so every RLS policy ON storage.objects was lost, while the media bucket (copied as data) survived. With RLS on and no policy, storage.objects denies 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 EXISTS then CREATE POLICY). 5 policies on storage.objects:

  • from 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"
  • from 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.* or storage.* 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

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>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

3 finding(s)

HIGH/CRITICAL: 1 | LOW: 2

Severity Rule Location
HIGH js-ssrf-outbound-request apps/web/src/app/api/media/[...path]/route.ts:28
LOW secret-generic-credential packages/supabase/supabase/config.toml:271
LOW secret-generic-credential packages/supabase/supabase/config.toml:303

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 0d219fe into master Sep 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant