fix(db): harden transfer_app against app id enumeration#1680
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc784596f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| REVOKE ALL ON FUNCTION public.transfer_app( | ||
| p_app_id character varying, | ||
| p_new_org_id uuid | ||
| ) FROM anon; |
There was a problem hiding this comment.
Revoke transfer_app from PUBLIC to block anonymous execution
This migration only revokes transfer_app from anon, but PostgreSQL function privileges are also inherited from the PUBLIC pseudo-role; because this function was historically granted without a preceding REVOKE ... FROM PUBLIC (see existing grants in 20250530233128_base.sql), anonymous callers can still execute it via PUBLIC, so the intended RPC hardening is ineffective in production-like databases.
Useful? React with 👍 / 👎.
d6c4024 to
9a414d1
Compare
|



Summary (AI generated)
public.transfer_appviaREVOKE ALL ... FROM anonin a new migration.transfer_appto return a uniform error message for non-existent apps and unauthorized requests when called without valid user context.Motivation (AI generated)
transfer_appwas previously callable by the anonymous/publiable role, allowing unauthenticated callers to infer validapp_idvalues from distinct error payloads. This is a confidentiality/tenant-enumeration risk.Business Impact (AI generated)
Test Plan (AI generated)
bunx sqlfluff lint --dialect postgres supabase/migrations/20260224120000_fix_transfer_app_security.sqlrest/v1/rpc/transfer_apprequests cannot transfer or enumerate app IDs.Generated with AI