Repository navigation
fix: drop TRUNCATE and unused DELETE grants, make public_* views read-only - #123
Open
thomgabriel wants to merge 1 commit into
Open
thomgabriel wants to merge 1 commit into
thomgabriel wants to merge 1 commit into
Conversation
…-only public_profiles is an auto-updatable view owned by postgres, so the insert/update/delete the default ACL gave authenticated let any signed-in user rewrite or delete another participant's users row past RLS.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @thomgabriel's task in 25s —— View job Safe to merge. No defects found. What I checked:
Not verified: I didn't run the migration or the before/after impersonation tests. The numbering gap at 00068 is intentional per the PR description. |
This branch was successfully deployed
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.
Trims the privileges anon and authenticated got from Supabase's default ACL (
arwdDxtmfor tables created by postgres). 00025 only took insert/update/delete back from anon.team_members, which has the only DELETE policy (team_members_leader_delete). Every app delete goes through the service role or a SECURITY DEFINER RPC (remove_team_member,leave_team,delete_team,decline_pending_membership), and no other policy allows a DELETE, so these grants only ever matched 0 rows. A user-scoped DELETE on those tables now returns 403 instead of silently doing nothing.public_*views keep only SELECT. This fixes a live hole:public_profilesis an auto-updatable view owned by postgres (BYPASSRLS), and authenticated held INSERT/UPDATE/DELETE on it. SoPATCHorDELETE /rest/v1/public_profiles?id=eq.<uuid>with any user's token rewrote or deleted another participant'susersrow past RLS. Edge logs (24h retention) show only GETs on the view, and noauth.usersrow is missing itspublic.usersmirror, so nothing was deleted this way.rand authenticatedarw. CLAUDE.md notes that a DELETE policy needs its grant, and that a new view needsrevoke all+grant select.Numbered 00069 because 00068 (
perk_applications) is taken by the in-flight Helius perk branch. Already applied todqxeukfkjnoqljovkageasleast_privilege_table_grants.Verified by impersonating real participants in rolled-back DO blocks, run against identical fixtures before and after the migration. A Colosseum team was reopened inside the transaction so team writes could match:
remove_team_member/leave_teampublic_profiles: update / insert / deletedelete from startups/truncate startupsas authenticatedpublic_submissionsThe
security_definer_viewadvisor still flags the four views. That is by design: they expose whitelisted columns to anon, and they are now read-only.