-
Notifications
You must be signed in to change notification settings - Fork 168
feat: add RLS policies to organizations table #1522
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
feat: add RLS policies to organizations table #1522
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/1745584509-add-rls-to-organizations-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 d2c1b05)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>
This migration adds comprehensive RLS policies on the organizations table, including SELECT, INSERT, UPDATE, and DELETE for authenticated users and service_role. The most significant concern is the overly permissive INSERT policy with WITH CHECK (true) and potential performance issues from subqueries. Overall, the migration is well structured with proper transaction wrapping and consistent naming, but clarifications on business rules and performance benchmarks would further improve its safety. ER Diagram:
|
|
||
ALTER TABLE "public"."organizations" ENABLE ROW LEVEL SECURITY; | ||
|
||
CREATE POLICY "authenticated_users_can_select_org_organizations" |
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 and update only organizations they are members of, and they can create new organizations without restriction.
- No service role policies are defined for this table yet.
If you're curious where this table is used, try grepping for.from('organizations')
in the codebase.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
- Add service_role policies for SELECT, INSERT, UPDATE, DELETE operations - Add missing DELETE policy for authenticated users - Addresses PR feedback from NoritakaIkeda Co-Authored-By: noritaka.ikeda@route06.co.jp <noritaka.ikeda@route06.co.jp>
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.
I'm not sure if it will work properly since organization_members is not running in the same transaction, but it looks good for once!
Add RLS policies to organizations table
Description
This PR implements Row Level Security (RLS) policies for the organizations table according to the ADR on applying RLS to all tables with organization-based policies.
Changes
Related Issues
ADR: Apply RLS to All Tables with Organization-based Policies
Link to Devin run
https://app.devin.ai/sessions/dc858d720b6746b49b672101a932e353
Requested by
noritaka.ikeda@route06.co.jp