Repository navigation
fix(security): require project membership for v1 attachment upload - #10369
Conversation
…load user_has_issue_permission let a work item's creator through before checking ProjectMember, so the v1 attachment upload (POST) and upload confirm (PATCH) endpoints stayed writable after the creator was removed from the project. Drop the creator shortcut from the helper; every caller now relies on the active-membership query. Active creators still pass via allowed_roles.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Description
In the v1 API,
user_has_issue_permissionreturnedTruefor a work item's creator before checkingProjectMember. The attachment upload (POST .../attachments/) and upload confirm (PATCH .../attachments/{id}/) endpoints called it withallow_creator=True, so a creator whose project membership was removed or deactivated could still upload attachments to their work items with an API token.user_has_issue_permission, along with itsissueandallow_creatorparameters. Every caller now relies on the active-membership query, so a later caller can't reintroduce the bypass through the oldallow_creator=Truedefault.allow_creator=False; only their arguments change.#10058 fixed the same pattern in the app API's
allow_permissiondecorator; this covers the separate v1 helper.Behaviour change: a user without an active project membership now gets 403 on attachment upload and upload confirm, even for work items they created.
Type of Change
Screenshots and Media (if applicable)
Test Scenarios
POSTan attachment to their own work item → 403, noFileAssetcreated.PATCHto confirm an existing pending attachment → 403,is_uploadedstays false, no activity queued.POSTan attachment to their own work item → 200.TestAttachmentUploadCreatorMembershipinplane/tests/contract/api/test_api_write_roles.py: the two inactive-creator tests fail without the fix.plane/tests/contract/api plane/tests/unit: 1015 passed.References
🤖 Generated with Claude Code
Summary by CodeRabbit