Repository navigation
[INFRA-1132] fix(security): cap invitation role updates at own role - #10041
Conversation
…ter's role
WorkspaceInvitationsViewset.partial_update was served by the generic mixin, which
skipped the role cap create() enforces. It now accepts only {"role"} and rejects a
role above the requester's own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Linked to Plane Work Item(s) References This comment was auto-generated by Plane |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Reword the invitation update test docstring and one test name as a neutral statement of the role cap rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lovelace3
left a comment
There was a problem hiding this comment.
No blocking findings.
Verified:
test_workspace_invitation_update_app.py,test_workspace_app.pyandtest_workspace_member_mass_assignment_app.py: 21 passed at the head.- Falsification: with
invite.pyreverted to the merge-base, 3 of the 6 new cases fail (the Member→Admin cap and bothacceptedbodies). The other three are positive or400-either-way cases, as the PR description says. - Sibling surfaces: the v1
plane/api/views/invite.pypartial_updateis behindWorkspaceOwnerPermission(Admin only), and its serializer validatesroleand makesacceptedread-only. The project invitation routes expose no PATCH. The URL map has noputfor this viewset, so the inheritedupdatecan't be reached. rolegoes through the modelChoiceField, so out-of-range values are rejected before the cap check. The web client (invitations-list-item.tsx) sends only{role}, so its requests are unaffected.
…10041) * [INFRA-1132] fix(security): cap invitation role updates at the requester's role WorkspaceInvitationsViewset.partial_update was served by the generic mixin, which skipped the role cap create() enforces. It now accepts only {"role"} and rejects a role above the requester's own. * [INFRA-1132] test: address review Reword the invitation update test docstring and one test name as a neutral statement of the role cap rule.
…akeplane#10041) * [INFRA-1132] fix(security): cap invitation role updates at the requester's role WorkspaceInvitationsViewset.partial_update was served by the generic mixin, which skipped the role cap create() enforces. It now accepts only {"role"} and rejects a role above the requester's own. * [INFRA-1132] test: address review Reword the invitation update test docstring and one test name as a neutral statement of the role cap rule. (cherry picked from commit 03cff62)
Description
PATCH /api/workspaces/<slug>/invitations/<pk>/was served by DRF's genericpartial_update, so it saved any writable field and skipped the role cap thatcreate()applies.WorkspaceInvitationsViewset.partial_updateis now implemented explicitly.{"role": ...}payload; any other key (for exampleaccepted) returns 400 and writes nothing.create()and the role dropdown in the invitations list.Behaviour change: a Member setting a pending invitation to Admin now gets a 400. Admins, and Members choosing Member or Guest, are unaffected. The web client only sends
{role}, so nothing changes there.Type of Change
Screenshots and Media (if applicable)
Test Scenarios
accepted(alone or withrole) → 400, invitation unchanged.test_workspace_invitation_update_app.py,test_workspace_app.py,test_workspace_member_mass_assignment_app.py: 21 passed. Without the fix, 3 of the 6 new tests fail.References
🤖 Generated with Claude Code
Summary by CodeRabbit