-
Notifications
You must be signed in to change notification settings - Fork 149
Add RLS policies to invitations table #1520
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
Add RLS policies to invitations table #1520
Conversation
Co-Authored-By: noritaka.ikeda@route06.co.jp <noritaka.ikeda@route06.co.jp>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Updates to Preview Branch (devin/1745584435-add-rls-to-invitations-table) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
CI Feedback 🧐(Feedback updated until commit 1260960)A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
Co-Authored-By: noritaka.ikeda@route06.co.jp <noritaka.ikeda@route06.co.jp>
ALTER TABLE "public"."invitations" ENABLE ROW LEVEL SECURITY; | ||
|
||
-- Policies for authenticated users | ||
CREATE POLICY "authenticated_users_can_select_org_invitations" |
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.
- Authenticated users can view, create, update, and delete invitations only within organizations they are members of.
- Service role can fully manage invitations without restriction.
Currently, broader permissions are granted because full feature implementation is still in progress.
If you're curious where this table is used, try grepping for.from('invitations')
in the codebase.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
This migration adds RLS policies for the invitations table with both authenticated and service_role roles, but duplicates are visible between the schema file and a dedicated migration file. The primary concern is migration safety and potential data integrity issues due to duplicate policy definitions and lack of explicit transaction wrapping, which could lead to runtime conflicts and performance slowdowns. On the positive side, the new policies follow naming conventions and enhance security controls, reinforcing organization-based access as per project guidelines. ER Diagram:
|
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.
👍
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.
👍🏻
Description
This PR adds RLS (Row Level Security) policies to the invitations table which already has an organization_id column. It follows the pattern established for other tables with organization-based security.
What was added
Link to Devin run
https://app.devin.ai/sessions/baba505ac02a479fbea6339c2f8a25f9
Requested by: noritaka.ikeda@route06.co.jp