-
Notifications
You must be signed in to change notification settings - Fork 38
fix 181: Admin API Exposed in Client Code #198
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
base: main
Are you sure you want to change the base?
Conversation
|
@Karelaking is attempting to deploy a commit to the Divya Tiwari's projects Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for tiwaridivya25-devconnect ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Thanks for creating a PR for your Issue!
|
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.
Pull request overview
Fixes a client-side security issue by removing use of Supabase Admin API calls from CreateConversationModal and replacing them with a non-admin query intended to respect database RLS, plus some small safety/formatting tweaks.
Changes:
- Replaced
supabase.auth.admin.listUsers()with aProfilestable query for user selection. - Added a backend-availability guard before attempting to fetch users.
- Mapped profile rows into the component’s local
Usershape and tightened formatting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const mappedUsers = (data || []).map(profile => ({ | ||
| id: profile.id, | ||
| email: '', // Email not exposed for privacy | ||
| user_metadata: { | ||
| full_name: profile.full_name, |
Copilot
AI
Jan 29, 2026
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.
Profiles are mapped with email: '' for privacy, but the component later searches and renders user.email as if it’s meaningful. This makes email search ineffective and can yield blank UI output. Consider either (1) removing email-based filtering/rendering when email is empty, or (2) adding a non-sensitive, non-empty identifier (e.g., username) to the fetched profile fields and using that instead.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
📝 Description
Fix critical security vulnerability in
CreateConversationModalthat exposed admin API to client-side code. Replaced dangeroussupabase.auth.admin.listUsers()call with secureProfilestable query that respects RLS policies. Also added null-safety guards toResetPasswordPageto prevent crashes when Supabase is unavailable.🎯 Type of Change
🔗 Related Issues
Closes #181
📋 Changes Made
supabase.auth.admin.listUsers()with secureProfilestable query inCreateConversationModalResetPasswordPagefrom demo mode/missing env crashes🧪 Testing
Testing Steps:
🎨 Screenshots/Demo
N/A - Security fix (no visual changes)
📦 Dependencies
✅ Checklist
Code Quality
npm run lintand fixed all issuesTesting & Functionality
Documentation
Git & Commits
Breaking Changes
📝 Additional Context
Security Issue Details
CRITICAL VULNERABILITY (Fixed):
CreateConversationModalwas usingsupabase.auth.admin.listUsers()on the client sideSecurity Fix Applied:
Profilestable queryAdditional Improvements:
🔍 Reviewer Notes
Please review:
🚀 Deployment Notes
Required Database Table:
Ensure the
Profilestable exists with proper RLS policies (seedatabase-schema-messaging.sql):