Add missing relations to vote_response FGA type#131
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 21 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated the OpenFGA authorization model (minor version bump) for the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
b72764d to
2fa3f59
Compare
There was a problem hiding this comment.
Pull request overview
Updates the OpenFGA authorization model to add missing vote_response relations so lfx.fga-sync.update_access can write the tuples emitted by voting-service without failing validation.
Changes:
- Add
projectrelation tovote_response. - Add
writerrelation (allowing direct assignment and deriving fromowner). - Add
viewerrelation (allowing explicit users/wildcard and deriving fromauditor).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@charts/lfx-platform/templates/openfga/model.yaml`:
- Around line 310-315: The model adds new relations (see define project, define
owner, define writer, define auditor, define viewer) but the authorization model
version remains 10.0.0; bump the model's semantic version by incrementing the
minor component (e.g., change 10.0.0 to 10.1.0) in the model.yaml header so the
relation additions are tracked as a minor version change per the in-file
versioning guidance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2939f0fc-58d4-4a8f-83b2-8cc4b525dc0d
📒 Files selected for processing (1)
charts/lfx-platform/templates/openfga/model.yaml
Address review comments from copilot-pull-request-reviewer, coderabbitai[bot]: - model.yaml: bump model version 10.0.0 → 10.1.0; adding relations requires a minor bump per in-file guidelines (per copilot-pull-request-reviewer, coderabbitai[bot]) - model.yaml: fix viewer type restriction ordering to [user, user:*] matching existing pattern at lines 165/186/207 (per copilot-pull-request-reviewer) Resolves 3 review threads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Issue: LFXV2-1555 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Review Feedback AddressedCommit: 1cc8e30 Changes Made
Threads Resolved3 of 3 unresolved threads addressed. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add project, writer, and viewer relations to vote_response to match what the voting-service sends via lfx.fga-sync.update_access. These missing relations caused 2,658 failed batch writes per 24h. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Issue: LFXV2-1555 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Reserve 10.1.0 for executive_director changes (PR #132). vote_response relation additions land as 10.2.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Issue: LFXV2-1555 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Adding writer relation to vote_response requires a minor bump. 10.2.0 is reserved for executive_director (PR #132). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Issue: LFXV2-1555 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
92da98e to
05fa20c
Compare
|
@bramwelt I've approved this, but I wonder if the better fix would be changing the fga-sync rules sent by the Vote service? Based on my audit, there are no endpoints that actually enforce "writer" level permissions. And nobody should be able to change a vote except the person who cast it, right? I see that it doesn't inherit from anything ... so it doesn't exactly make sense from a product perspective. Am I authorizing another person to change my vote? (except you're not, since writers can't do anything according the RuleSets...) ... so... I'm making it possible to grant read access to somebody other than the owner, but calling it write access ... the optics just don't look good. CC @andrest50 who shows up in the "blame" for the removed comment. |
|
Closing in favor of: linuxfoundation/lfx-v2-voting-service#30 |
Summary
Adds
project,writer, andviewerrelations to thevote_responseOpenFGA type to match what the voting-service sends vialfx.fga-sync.update_access.Problem
vote_responsewas missing three relations that the voting-service writes as FGA tuples:vote_response#projectrelation 'vote_response#project' not foundvote_response#viewerrelation 'vote_response#viewer' not foundvote_response#writerrelation 'vote_response#writer' not foundThis caused 2,658 failed batch writes per 24h in production. The entire batch failed, leaving affected
vote_responseobjects with no FGA tuples.Change
type vote_response relations define vote: [vote] + define project: [project] # owner is the user who cast this response define owner: [user] - # we don't need to create a "writer" relation that is defined as just "owner": - # we just use the "owner" relation in our access checks! + define writer: [user] or owner define auditor: owner or auditor from vote + define viewer: [user:*, user] or auditorConsistent with the
voteandsurveytype patterns.Related
Closes LFXV2-1555