Skip to content

fix(security): require project membership for v1 attachment upload - #10369

Merged
sriramveeraghanta merged 1 commit into
previewfrom
fix/v1-attachment-creator-membership
Nov 23, 2026
Merged

sriramveeraghanta merged 1 commit into
previewfrom
fix/v1-attachment-creator-membership

Conversation

@sriramveeraghanta

@sriramveeraghanta sriramveeraghanta commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Description

In the v1 API, user_has_issue_permission returned True for a work item's creator before checking ProjectMember. The attachment upload (POST .../attachments/) and upload confirm (PATCH .../attachments/{id}/) endpoints called it with allow_creator=True, so a creator whose project membership was removed or deactivated could still upload attachments to their work items with an API token.

  • Remove the creator shortcut from user_has_issue_permission, along with its issue and allow_creator parameters. Every caller now relies on the active-membership query, so a later caller can't reintroduce the bypass through the old allow_creator=True default.
  • Active creators are unaffected: upload and confirm already allow admin, member and guest roles.
  • The GET endpoints already passed allow_creator=False; only their arguments change.

#10058 fixed the same pattern in the app API's allow_permission decorator; 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

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

  • Creator whose project membership is inactive: POST an attachment to their own work item → 403, no FileAsset created.
  • Same user: PATCH to confirm an existing pending attachment → 403, is_uploaded stays false, no activity queued.
  • Active member creator: POST an attachment to their own work item → 200.
  • New TestAttachmentUploadCreatorMembership in plane/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

  • Access Changes
    • Attachment uploads, upload confirmations, listings, and downloads now require active project membership, including for the work-item creator.
    • Creators who are no longer active project members are denied access to these attachment actions.
    • Existing visibility restrictions for guest users remain in place.

…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.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Attachment upload, listing, download, and confirmation checks now require active project membership. Contract tests cover creator uploads and confirmation when membership is active or removed.

Changes: Attachment authorization

Layer / File(s) Summary
Active membership permission rule
apps/api/plane/api/views/issue.py
The shared permission helper removes the creator bypass. It checks active project membership and can restrict access by role.
Attachment endpoint checks
apps/api/plane/api/views/issue.py, apps/api/plane/tests/contract/api/test_api_write_roles.py
Upload and confirmation require active membership in the admin, member, or guest roles. Listing and download use the membership check. Contract tests verify creator upload and confirmation behavior across membership states.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: 🛡️security

Suggested reviewers: narayanbavisetti

Merge Risk: Minimal · up to cef17

This closes an authorization gap where a work-item creator without active project membership could upload or confirm attachments through the v1 API. The change is small and covered by contract tests, and no remaining merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the v1 attachment upload now requires active project membership, which removes the creator bypass. It uses the conventional fix(security) prefix and matches the change…
Description check Passed The description follows the template. It covers the change, marks the Bug fix type, and gives concrete test scenarios and a reference to #10058. It omits a Screenshots entry, but the template marks th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the v1 attachment upload now requires active project membership, which removes the creator bypass. It uses the conventional fix(security) prefix and matches the changeset, so it passes.

Full details: Description check

Explanation

The description follows the template. It covers the change, marks the Bug fix type, and gives concrete test scenarios and a reference to #10058. It omits a Screenshots entry, but the template marks that section as applicable only when relevant. The description also explains the behaviour change clearly.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d9e5c843-bd4a-4555-ae91-2bbb1d8d121b
Commits

Reviewing files that changed from the base of the PR and between 5ecdaa0 and cef17e3.

Files selected for processing: 2

  • apps/api/plane/api/views/issue.py
  • apps/api/plane/tests/contract/api/test_api_write_roles.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@sriramveeraghanta
sriramveeraghanta merged commit 57a876d into preview Nov 23, 2026
19 of 20 checks passed
@sriramveeraghanta
sriramveeraghanta deleted the fix/v1-attachment-creator-membership branch November 23, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants