Fix admin bootstrap security and search injection vulnerabilities#15
Merged
Conversation
- claimAdminBootstrap now checks/inserts the admin role via the service-role client. The user-scoped client is blinded by the `roles read self` RLS policy and reported 0 admins to any non-admin caller, allowing privilege escalation after an admin already existed. - Strip PostgREST filter metacharacters from the admin account search term to prevent filter injection via the interpolated `.or()` clause. https://claude.ai/code/session_01TSEwzP9iRBZiLkmCV2RGWx
Untrack .env, .env.development and .env.production and ignore local environment files going forward. .env.example remains tracked as the documented template. The committed keys were publishable (Supabase anon, Stripe publishable) and not secrets, but env files should not be in VCS. https://claude.ai/code/session_01TSEwzP9iRBZiLkmCV2RGWx
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.
What does this PR add?
Fixes critical security vulnerabilities in admin account management and search functionality, plus removes accidentally committed environment files.
Type
version)Changes
Security Fixes
Admin Bootstrap Privilege Escalation (
claimAdminBootstrap)roles read self), allowing any authenticated user to claim admin if none existsSearch Filter Injection (
listAccounts).or()filter%,,,(,),*) that could be exploited for filter injection attacksRemoved Committed Secrets
.env,.env.development, and.env.productionfiles containing Supabase and Stripe API keys.gitignoreto prevent future commits of environment files.env.examplefor referenceNotes for reviewers
https://claude.ai/code/session_01TSEwzP9iRBZiLkmCV2RGWx