Repository navigation
[WEB-8291] fix: gate project invitation list/retrieve/destroy to project admins - #9444
Conversation
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Pull request overview
This PR hardens app API authorization around two previously vulnerable endpoints: project invitation list/retrieve/delete (GHSA-r68c-48rr-m67f / WEB-8291) and draft-to-issue conversion ownership scoping (GHSA-vfqm-7rh7-84hq / WEB-8289).
Changes:
- Restricts
ProjectInvitationsViewsetlist/retrieve/destroyactions to project admins via@allow_permission([ROLE.ADMIN]). - Scopes
WorkspaceDraftIssueViewSet.create_draft_to_issuedraft lookup tocreated_by=request.userand returns 404 when the draft isn’t owned by the caller. - Adds contract test coverage for both authorization/ownership scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/api/plane/app/views/project/invite.py | Gates invitations list/retrieve/destroy to project admins to prevent cross-project invite/token disclosure and deletion. |
| apps/api/plane/app/views/workspace/draft.py | Prevents non-owners from converting (and thereby consuming/migrating assets from) another user’s draft. |
| apps/api/plane/tests/contract/app/test_project_invite_list_scope_app.py | Contract regression tests ensuring non-members get 403 and project admins can still list invites. |
| apps/api/plane/tests/contract/app/test_draft_to_issue_owner_scope_app.py | Contract regression tests ensuring only the draft owner can convert; non-owners receive 404 and cannot steal assets. |
…ect admins (GHSA-r68c-48rr-m67f) ProjectInvitationsViewset declared no permission_classes (inheriting IsAuthenticated) and only decorated create with @allow_permission([ADMIN]). The default list/retrieve/destroy actions were ungated and get_queryset was scoped only by URL slug + project_id, so any authenticated user could read another project's pending invitations — including invitee email and the raw token (re-exposing what #9305 stripped from the public path) — and delete them. Gate list/retrieve/destroy with @allow_permission([ROLE.ADMIN]), matching create (project admin, or a workspace-admin who is a project member). The workspace sibling WorkspaceInvitationsViewset was already admin-gated. Also drop a pre-existing unused User import in the same file. Adds contract regression tests (fail-before verified): a non-member of the project is rejected with 403 on list/retrieve/destroy (invite left intact), with a positive control confirming a project admin can still list. Co-authored-by: Plane AI <noreply@plane.so>
82a315e to
e78665f
Compare
|
Good catch @copilot — that was a branching mistake, not intended scope. Fixed by rebasing
The draft-to-issue change stays tracked/reviewed independently in #9443. 4/4 invite contract tests still green; PR is mergeable. |
Confirmed — the branch now contains only the WEB-8291 project-invitation changes ( |
Explanations kept unchanged; only the IDs are removed. Co-authored-by: Plane AI <noreply@plane.so>
|
React Doctor skipped this pull request — it changed no React files. Reviewed by React Doctor for commit |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (3)
apps/api/plane/app/views/project/invite.py:65
retrieve()should forward*args, **kwargsto DRF’s parent implementation. This avoids subtle issues if DRF/mixins start relying on passed kwargs (even thoughself.kwargsis set).
@allow_permission([ROLE.ADMIN])
def retrieve(self, request, slug, project_id, pk):
return super().retrieve(request)
apps/api/plane/app/views/project/invite.py:69
destroy()should forward*args, **kwargsto DRF’s parent implementation for consistency with DRF’s expected calling convention and to reduce risk of future breakage.
@allow_permission([ROLE.ADMIN])
def destroy(self, request, slug, project_id, pk):
return super().destroy(request)
apps/api/plane/app/views/project/invite.py:62
- The overridden action doesn’t forward
*args, **kwargsto DRF’slist(). It works today becauseself.kwargsis already set, but forwarding preserves DRF’s expected calling convention (e.g., format suffixes / future mixins) and matches patterns used elsewhere in the codebase.
This issue also appears in the following locations of the same file:
- line 63
- line 67
@allow_permission([ROLE.ADMIN])
def list(self, request, slug, project_id):
return super().list(request)
…nvite-list-admin-scope
* [INFRA-1114] fix(security): keep magic-code regeneration cap after verify exhaustion Burn the code instead of deleting the Redis record when the verify attempts run out, so the per-email regeneration count still applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1114] fix(security): track issued magic codes in an atomic counter Cap codes issued per email with a dedicated `magic_<email>:issued` counter, incremented atomically in initiate() (INCR + first-time EXPIRE). The window is a fixed 600s from the first code and is not extended by later requests; the limit stays at 4 codes per window. The cap no longer depends on the token record, so verify exhaustion goes back to deleting the token and its verify counter. A successful sign-in clears the issued counter. current_attempt is dropped from the stored value. Tests reset the issued counter wherever magic-link state is cleared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1114] fix(security): address review Count each magic-code verify attempt atomically before comparing the code, so no more than MAX_VERIFY_ATTEMPTS comparisons are made per token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1114] fix(security): address review feedback - Keep current_attempt: 0 in the magic-code token record so pods on the previous release can still read it during a rolling deploy. - Assert that later code requests do not extend the TTL of the issued-code counter, so the issue window stays fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1132] test: address review 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> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…space (#10042) * [INFRA-1138] fix(security): require workspace admin to PUT/PATCH the workspace WorkSpaceBasePermission allowed the Member role for PUT/PATCH, so PUT reached the undecorated update() action. It now requires Admin, matching partial_update; the unused duplicate in plane.utils.permissions gets the same change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1138] fix: address review Make deleted_at read-only in WorkSpaceSerializer so an update cannot set it, and reword the test module docstring as a neutral statement of the rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…0044) * [INFRA-1159] fix(security): serve assets inline only for the stored safe image type S3Storage.generate_presigned_url now honours inline only when the stored object's Content-Type is an allow-listed image and pins it via ResponseContentType; anything else downloads. Callers pass storage_metadata instead of client-editable attributes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1159] fix: address review Decide inline disposition from the asset's claimed type instead of storage_metadata; S3Storage pins that allow-listed image type as the response Content-Type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1159] fix(security): address review feedback - Pass the asset name as the filename from the static and Spaces asset endpoints, so a download keeps its name and extension. - Add disposition tests for the Spaces EntityAssetEndpoint and the v1 GenericAssetEndpoint (png inline, svg attachment), and assert the filename on the static endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1159] fix(security): address review feedback - S3Storage uses the asset name as the download filename only when it is a non-empty string (otherwise a random name), and treats a non-string type as missing (attachment), so non-string attributes no longer fail the presigned URL - Test: static asset with a numeric name or type still redirects Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…0043) * [INFRA-1157] fix(security): bound password input scored by zxcvbn Add is_password_strong() helper that scores only the first 128 characters, and route every zxcvbn caller (sign-up, password set/change/reset, instance admin sign-up, reset_password command) through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1157] fix: address review Score the first and the last ZXCVBN_MAX_LENGTH characters and accept the password if either window is strong; add a unit test that only the password helper imports zxcvbn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…points (#10045) * [INFRA-1115] fix(security): enforce guest page visibility in ProjectPagePermission Apply the guest_view_all_features rule centrally so page description and version endpoints follow it, not just PageViewSet.retrieve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1115] test: address review Reword the guest page access test module docstring as a neutral statement of the guest_view_all_features rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1115] fix(security): address review feedback - Cover page retrieve in the guest own-page and guest_view_all_features positive cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…tes (#10064) * [INFRA-1116] fix(security): restrict user-scoped FKs on users/me updates Notification preference user/workspace/project fields are now read-only. User avatar_asset/cover_image_asset accept only the user's own asset of the matching entity type, and replacing an avatar/cover deletes only the user's own asset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1116] fix(security): address review Use matching entity types for the foreign-asset test so it checks ownership alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1116] fix(security): address review feedback - Clear the avatar link in delete_old_avatar when the linked asset is not the user's own, leaving the asset untouched - Add a test for the login avatar sync with storage mocked Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…elds (#10063) * [INFRA-1208] fix(security): limit public comment writes to content fields Public board comment create and edit now pass only comment_html and comment_json to the serializer; actor, access, issue and parent stay server-controlled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1208] fix(security): address review Limit app comment updates to content and access fields, including the activity payloads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1208] fix(security): address review feedback - Comment update activity: record a change only when comment_html is in the payload and differs. - Space comment PATCH: capture current_instance before saving. - App comment create: apply the same writable-field allowlist as partial_update (hoisted to COMMENT_WRITABLE_FIELDS) and pass the filtered data to model_activity. - Tests for all three. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Sriram Veeraghanta <veeraghanta.sriram@gmail.com>
…0065) * [INFRA-1174] fix(security): scope project stats and grouping keys Project stats follow the project list visibility rules, the advance analytics overview counts members only of the caller's projects in the workspace, and workspace-level issue grouping builds project/state/cycle/module/label keys from the caller's projects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1174] fix(security): address review feedback - issue_group_values raises ValueError when called with neither project_id nor user - Add a unit test for it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1174] fix(security): address review feedback - Public board grouping (space issue_group_values) takes project, state, label, cycle and module keys only from the board's project. - Test: public issues endpoint grouped by project/state/cycle returns only keys from the board's project. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…n see (#10066) * [INFRA-1163] fix(security): scope favorites to entities the caller can see Favorite creation now requires the entity to be in the URL workspace/project and visible to the caller; entity_data resolves under the same rule (get_favorite_entities). Covers INFRA-1163, INFRA-1170, INFRA-1172, INFRA-1185, INFRA-1186. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1163] fix(security): address review Resolve workspace view favorites via workspace membership and report the favorite's project for multi-project pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1163] fix(security): address review feedback - Favorite PATCH only accepts name, sequence and parent, so the favorited entity can't be changed after creation - Add a test that PATCHing entity_type/entity_identifier leaves the row unchanged while sequence still updates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…10067) * [INFRA-1166] fix(security): apply guest_view_all_features in search Search issue, page, view and intake queries now apply the guest rule per result project, inside the caller's membership join, matching the list views. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1166] fix(security): address review Keep private pages owner-only in global search, matching the page list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1166] fix(security): address review Keep private project views owner-only in global search, as the view list does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…10068) * [INFRA-1149] fix(security): apply entity role rules to asset changes Confirm, update and delete on the generic asset routes now follow the rule of the asset's entity: workspace admin for the logo, project admin for the cover, project admin or uploader for attachments, member or uploader otherwise (INFRA-1149, INFRA-1197). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1149] fix(security): address review Rename asset role tests after the permission rule each one covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1149] fix(security): address review feedback - Asset restore applies the same role rule as update/delete (can_modify_asset) - Add a test: a project guest can't restore another user's deleted attachment, the uploader can - Tests assign the response before asserting on its status instead of making requests inside assert Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1149] fix(security): address review feedback - The legacy asset delete and restore routes (by asset path) apply can_modify_asset, like the v2 routes. - can_modify_asset: the uploader shortcut requires an active role in the asset's project, if it has one. - Tests: legacy delete/restore follow the role rules; an uploader with an inactive project membership cannot delete or restore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…10069) * [INFRA-1158] fix(security): require a non-empty matching OAuth state Add validate_oauth_state, which pops the session state and accepts the callback only when both values are non-empty and match (constant time). Use it in all eight app and space OAuth callbacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1158] fix(security): address review Fall back to the app base host in the Gitea callback when the session has no host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1158] fix(security): address review feedback - validate_oauth_state compares first and removes the stored state only on a match, so a mismatched callback no longer drops a pending login's state - Test: a mismatched callback followed by the matching one logs in - Add the app GitLab and Google callbacks to the state test matrix - Compare the parsed scheme and host in the app-host redirect test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… app (#10070) * [INFRA-1180] fix(security): bring v1 API permissions in line with the app v1 cycle delete is limited to project admins or the cycle creator, and a cycle update without owned_by keeps the current owner. v1 label writes require project admin. v1 project-member add requires an active workspace membership. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1180] fix(security): address review Check the target's active workspace membership on every member PATCH, and keep an explicit null cycle owner assigning the requester. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1180] fix(security): address review feedback - ProjectAdminPermission (both copies) now also admits a workspace admin who is a project member at any role, matching allow_permission. - v1 cycle delete reuses ProjectAdminPermission for its admin check. - Tests: a workspace admin with project role member can create labels and delete cycles; one outside the project cannot create labels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…nts (#10071) * [INFRA-1146] fix(security): scope public Space asset uploads to comment images Public asset uploads now require comments enabled on the board, accept only COMMENT_DESCRIPTION, and bind only to the caller's own EXTERNAL comment on it. The bulk endpoint binds only the caller's own comment images to such a comment (INFRA-1144). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1146] fix(security): address review Treat an empty comment id on upload as unbound and refuse bulk binding when board comments are disabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
#10072) * [INFRA-1165] fix(security): reset role when rejoining a public project Self-joining a public project reactivated an inactive ProjectMember row with its previous role. Reactivation now sets the workspace role a new joiner gets, and only touches inactive rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1165] fix(security): address review feedback - Rejoin reactivation now also sets updated_by and updated_at, since .update() skips the model's save() hooks. - Test asserts updated_by on the reactivated membership. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ted writes (#10073) BaseSessionAuthentication.enforce_csrf now refuses unsafe requests whose Origin is not the request's own host, a configured base URL, or a CORS/CSRF trusted origin. Requests without an Origin header (non-browser clients) and safe methods are unaffected. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
dheeru0198
left a comment
There was a problem hiding this comment.
Review against current preview (6c16585)
Looks good with a couple of nits. The invite guard is still needed on preview.
- minor
apps/api/plane/app/views/project/invite.py:55,apps/api/plane/tests/contract/app/test_project_invite_list_scope_app.py:9: Suggest rewording the comment and test docstring to state the authorization rule being enforced rather than describing the prior gap. - minor
apps/api/plane/tests/contract/app/test_project_invite_list_scope_app.py:83: Negative tests cover a non-member only. Suggest adding a case for an ordinary project member without admin rights, expecting 403 on list, retrieve and delete. - nit
apps/api/plane/app/views/project/invite.py:169: Preview now contains #10072's role reset in this file. Rebase and preserve it; the merge appears conflict-free.
Notes from an automated review (Claude Code + Codex), checked against current preview.
…10061) * [INFRA-1195] fix(security): verify Redis TLS certificates by default rediss:// connections (redis_instance and the django-redis cache) now verify the server certificate and hostname. REDIS_SSL_CA_CERTS sets a custom CA bundle and REDIS_SSL_CERT_REQS=none turns verification off. Also covers INFRA-1210. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1195] fix(security): address review Honour ssl_cert_reqs from REDIS_URL when deciding hostname checks, and document mounting a custom CA bundle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1195] fix(security): address review feedback - AIO: document REDIS_SSL_CERT_REQS and REDIS_SSL_CA_CERTS in variables.env and the README, including a -v mount for the CA bundle. - AIO start.sh: pass both through from the container environment, so -e values are not replaced by the plane.env defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1195] fix(security): address review feedback - REDIS_SSL_CERT_REQS=optional keeps hostname checking on; only none turns it off. - Tests: mapping for optional expects ssl_check_hostname=True, and a connection built with optional has check_hostname=True. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…nstall (#10074) * [INFRA-1160] fix(security): generate object-storage credentials per install install.sh/swarm.sh generate random MinIO credentials on install and replace the template placeholders on upgrade; the CLI compose no longer falls back to them. setup.sh generates the pair for source builds, and settings drop the fallback and log a critical warning when MinIO runs with the placeholder pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1160] fix(security): address review feedback - The API warns when AWS_SECRET_ACCESS_KEY is the template value, whatever the access key is. - install.sh and swarm.sh rotate whenever the secret is the template value (or empty), and ignore quotes from older templates when comparing. - docker-compose.yml keeps the access-key/secret-key fallbacks for MinIO and the API, so installs upgraded with an older setup.sh, or with blank keys, still start; the API warning covers them. - README: download the latest setup.sh before upgrading. - Test: custom access key with the template secret logs the warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1160] fix(security): address review feedback - Reword the comment above the storage credential warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ate limits (#10075) * [INFRA-1189] chore(security): make proxy hop count configurable for rate limits Add an optional NUM_PROXIES setting and pass TRUSTED_PROXIES/NUM_PROXIES through the CLI compose. Defaults are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [INFRA-1189] fix(security): address review feedback - NUM_PROXIES accepts at most 3 digits, so an oversized value is ignored with a warning instead of failing settings load. - variables.env ships NUM_PROXIES= uncommented, so an upgrade keeps an operator's value; an empty value is still treated as unset. - README: "leaving NUM_PROXIES empty" matches the shipped template. - Test: a 5000-digit value keeps DRF's default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- Reword the invitation permission comment, the join-endpoint comment and the test docstrings to state the access rule. - Add a test that an active project member without the admin role gets 403 on list, retrieve and delete, and the invitation is kept.
- Reword the join comment in UserProjectInvitationsViewset to state that membership writes use only the validated project IDs.
932beba to
d409b05
Compare
cc9faeb to
7805576
Compare
dheeru0198
left a comment
There was a problem hiding this comment.
Approving: review points addressed and re-verified; CI green.
…ect admins (makeplane#9444) * [WEB-8291] fix: gate project invitation list/retrieve/destroy to project admins * chore(security): drop advisory identifiers from code comments * [WEB-8291] fix: address review feedback (cherry picked from commit 0d7b541)
Summary
Fixes the confirmed-vulnerable half of WEB-8291 (HIGH, CWE-862) — the project-invitation-list authorization bypass.
ProjectInvitationsViewsetdeclared nopermission_classes(inheritingIsAuthenticated) and only decoratedcreatewith@allow_permission([ROLE.ADMIN]). The defaultlist/retrieve/destroyactions were therefore ungated, andget_querysetwas scoped only by URLslug+project_id— not by the caller's membership. The serializer (ProjectMemberInviteSerializer,fields="__all__") returnsemailandtoken.Impact (before fix): any authenticated user could
GET /api/workspaces/<slug>/projects/<project_id>/invitations/(and/<pk>/) for a project they don't belong to and read every pending invite's rawtoken+ inviteeemail(re-exposing what #9305 stripped from the public path), and couldDELETEarbitrary project invitations.Fix
Gate
list/retrieve/destroywith@allow_permission([ROLE.ADMIN]), matchingcreate(project admin, or a workspace-admin who is a project member — the decorator's existing semantics). This mirrors the workspace siblingWorkspaceInvitationsViewset, which was already admin-gated (WorkSpaceAdminPermission).Chose the method decorator over a class-level
ProjectAdminPermissiondeliberately: a class-level permission would have tightenedcreate(blocking the workspace-admin-project-member fallback that@allow_permissionallows), a behavior change. The decorator keeps all four actions consistent.Also removes a pre-existing unused
Userimport in the same file.Tests
New contract suite
plane/tests/contract/app/test_project_invite_list_scope_app.py(fail-before verified — the 4 negative tests return 200/204 without the fix):Verification
ruff check: cleanmanage.py check(test settings): no issuespytest(new suite + related invite/join suites): 17/17 green; fail-before verified🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests