Repository navigation
[WEB-10177] fix: validate the entity an asset is bound to - #10323
Conversation
Asset upload, bulk-bind and duplicate now keep the asset in the URL workspace and only bind it to an issue, comment or page of that workspace and project (or, on the workspace route, of a project the caller is an active member of), to the caller's own draft, or to the caller as user.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
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) This comment was auto-generated by Plane |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
sriramveeraghanta
left a comment
There was a problem hiding this comment.
LGTM. can_bind_asset covers workspace upload, project upload, bulk-bind and duplicate, and the web upload paths (issue, intake, archived, drafts, comments, pages) still bind. Non-blocking, both pre-existing: comment create passes the issue id as entityId to bulk-bind, so images in new comments never get bound; a PROJECT_COVER upload on the project route passes project_id twice (TypeError). Still worth the manual upload pass the description asks for.
…10323) Asset upload, bulk-bind and duplicate now keep the asset in the URL workspace and only bind it to an issue, comment or page of that workspace and project (or, on the workspace route, of a project the caller is an active member of), to the caller's own draft, or to the caller as user. (cherry picked from commit ef55909)
Description
The asset upload endpoints built a
FileAssetfrom a client-suppliedentity_identifierwith no scope check. An asset row could be bound to a work item, comment, page, draft or user the caller has no access to, and for a workspace logo the identifier could override the workspace.get_entity_id_fieldno longer returnsworkspace_id; the workspace is always the URL workspace.can_bind_assetnext tocan_modify_asset, called in the workspace upload, project upload, bulk-bind and duplicate endpoints:This is wider than the original report (workspace and project upload): bulk-bind and duplicate had the same unvalidated binding, so they use the same helper.
Behavior change:
Invalid entity identifier.Not changed: a restricted guest can still bind to another member's work item or comment inside their own project.
Type of Change
Screenshots and Media (if applicable)
Test Scenarios
plane/tests/contract/app/test_asset_upload_entity_binding_app.py(S3 mocked): identifiers from another workspace or project are rejected on each endpoint, a workspace logo upload cannot create a row in another workspace, and normal same-project uploads still succeed. 12 passed; 9 fail without the fix.Please check manually, since this touches every editor upload path:
References
Created with Claude Code
Summary by CodeRabbit