-
Notifications
You must be signed in to change notification settings - Fork 0
fix: align final production migration history #565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
supabase/migrations/20260708150150_harden_retrieval_public_execute.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| -- Codify the migration version already recorded on production. These two | ||
| -- retrieval helpers are server-only, so their EXECUTE posture matches the | ||
| -- schema-wide service-role-only policy in supabase/schema.sql. | ||
|
|
||
| set search_path = public, extensions, pg_temp; | ||
|
|
||
| revoke execute on function public.retrieval_owner_matches(uuid, uuid) | ||
| from public, anon, authenticated; | ||
| grant execute on function public.retrieval_owner_matches(uuid, uuid) | ||
| to service_role; | ||
|
|
||
| revoke execute on function public.search_document_chunks(uuid, text, integer, uuid) | ||
| from public, anon, authenticated; | ||
| grant execute on function public.search_document_chunks(uuid, text, integer, uuid) | ||
| to service_role; |
14 changes: 14 additions & 0 deletions
14
supabase/migrations/20260709062443_reconcile_ingestion_rpc_privileges_production.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| -- Codify the migration version already recorded on production. The functions | ||
| -- are worker-only and must not retain PostgreSQL's default PUBLIC EXECUTE. | ||
|
|
||
| set search_path = public, pg_catalog, pg_temp; | ||
|
|
||
| revoke execute on function public.complete_ingestion_job(uuid, uuid, uuid, text, text) | ||
| from public, anon, authenticated; | ||
| grant execute on function public.complete_ingestion_job(uuid, uuid, uuid, text, text) | ||
| to service_role; | ||
|
|
||
| revoke execute on function public.fail_or_retry_ingestion_job(uuid, uuid, uuid, boolean, text, text, text, timestamp with time zone, text) | ||
| from public, anon, authenticated; | ||
| grant execute on function public.fail_or_retry_ingestion_job(uuid, uuid, uuid, boolean, text, text, text, timestamp with time zone, text) | ||
| to service_role; |
18 changes: 7 additions & 11 deletions
18
supabase/migrations/20260709150000_reconcile_ingestion_rpc_privileges.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,8 @@ | ||
| -- Reconcile ingestion RPC permissions (revoke execute from public) | ||
| -- Recent migration 20260708130000 dropped and recreated complete_ingestion_job and fail_or_retry_ingestion_job. | ||
| -- Since migrations run as supabase_admin on Supabase, the default privileges for role postgres | ||
| -- do not apply. We must explicitly revoke PUBLIC execution on these new signatures. | ||
| -- NEUTRALIZED 2026-07-13 -- DO NOT DELETE THIS FILE. | ||
| -- | ||
| -- Production recorded this ACL reconciliation under its generated migration | ||
| -- version, 20260709062443. That exact migration now lives in the repository. | ||
| -- Keep this later duplicate stem as a no-op so branches that previously saw it | ||
| -- retain monotonic history without applying the same grants twice. | ||
|
|
||
| set search_path = public, pg_catalog, pg_temp; | ||
|
|
||
| revoke execute on function public.complete_ingestion_job(uuid, uuid, uuid, text, text) from public, anon, authenticated; | ||
| grant execute on function public.complete_ingestion_job(uuid, uuid, uuid, text, text) to service_role; | ||
|
|
||
| revoke execute on function public.fail_or_retry_ingestion_job(uuid, uuid, uuid, boolean, text, text, text, timestamp with time zone, text) from public, anon, authenticated; | ||
| grant execute on function public.fail_or_retry_ingestion_job(uuid, uuid, uuid, boolean, text, text, text, timestamp with time zone, text) to service_role; | ||
| select 1 where false; |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Assert the complete ACL and no-op contracts.
These assertions would remain green if
service_rolegrants were removed, the revoked roles changed, or the neutralized migration retained active ACL SQL. Assert both the exactfrom public, anon, authenticatedandto service_roleclauses for all four functions, and assert the duplicate contains noset search_path,revoke execute, orgrant executestatements.Suggested assertions
📝 Committable suggestion
🤖 Prompt for AI Agents