Skip to content

[WEB-10177] fix: validate the entity an asset is bound to - #10323

Merged
sriramveeraghanta merged 1 commit into
previewfrom
fix/web-10177-asset-entity-binding
Nov 16, 2026
Merged

sriramveeraghanta merged 1 commit into
previewfrom
fix/web-10177-asset-entity-binding

Conversation

@pablohashescobar

@pablohashescobar pablohashescobar commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Description

The asset upload endpoints built a FileAsset from a client-supplied entity_identifier with 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_field no longer returns workspace_id; the workspace is always the URL workspace.
  • New can_bind_asset next to can_modify_asset, called in the workspace upload, project upload, bulk-bind and duplicate endpoints:
    • work item, comment or page: must be in the URL workspace and the URL (or destination) project; on the workspace route, in a project the caller is an active member of
    • draft: must be the caller's own
    • user asset: only the caller's own id
    • an empty identifier leaves the asset unbound, as the web app relies on

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:

  • Uploads with an out-of-scope identifier return 400 Invalid entity identifier.
  • Bulk-bind returns 204 without binding when the entity is out of scope. This is deliberate: the web app calls it inside the work item create flow, where a 4xx would surface as a failed create after the work item was saved.

Not changed: a restricted guest can still bind to another member's work item or comment inside their own project.

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

  • New 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:

  • Upload an image in a work item description, a comment, a page and a draft.
  • Create a work item with an image added before the first save (bulk-bind).
  • Copy an image between two work items (duplicate).

References

  • WEB-10177

Created with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Asset uploads and duplication now reject targets outside the permitted workspace or project, and uploads targeting another user’s avatar are rejected.
    • Bulk associations to invalid targets leave assets unbound instead of linking them incorrectly.
    • Workspace-logo uploads remain associated with the workspace in the URL, even when a different workspace identifier is supplied.
    • Valid issue associations continue to work, while uploads with no target remain unbound.

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.
Copilot AI balanced review requested due to automatic review settings November 15, 2026 23:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@makeplane

makeplane Bot commented Nov 15, 2026

Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Asset uploads, bulk associations, and duplication now validate supported entity bindings against workspace, project, and caller scope. Workspace logos use the URL workspace instead of a workspace entity binding.

Changes: Asset Binding Validation

Layer / File(s) Summary
Entity binding rules
apps/api/plane/app/views/asset/v2.py
The new can_bind_asset helper checks ownership and workspace/project scope for supported entity types. It also rejects deleted page targets.
Upload validation
apps/api/plane/app/views/asset/v2.py
Workspace and project asset uploads reject invalid bindings before asset creation. Workspace-logo uploads use the URL workspace instead of an entity binding.
Association and duplication validation
apps/api/plane/app/views/asset/v2.py, apps/api/plane/tests/contract/app/test_asset_upload_entity_binding_app.py
Bulk association leaves assets unbound when a recognized target fails validation. Duplication rejects invalid destination bindings before creating a duplicate. Contract tests cover upload, bulk association, and duplication cases.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: Minimal · up to df7a8

This change restricts asset uploads, bulk association and duplication to entities within the caller's workspace and project scope. No concrete defect was established in review, and contract tests cover the main allowed and rejected cases. The risk of merging is low.

Pre-merge checks: Passed 4

Check name Status Explanation
Description check Passed The description covers the problem, the changes, the behavior changes (400 on upload, 204 on bulk-bind), known limitations (restricted guests), test scenarios with counts, manual test steps, and the W…
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.
Title check Passed The title names the main change: asset binding is now validated against the target entity. The raw summary shows the changes add ownership and scope checks (can_bind_asset) to upload, bulk-bind, and d…
Full details: Description check

Explanation

The description covers the problem, the changes, the behavior changes (400 on upload, 204 on bulk-bind), known limitations (restricted guests), test scenarios with counts, manual test steps, and the WEB-10177 reference. The Type of Change section is filled in. The Screenshots section still contains the template placeholder comment, which is acceptable because screenshots are marked as optional, not required. The template's HTML comments are not an issue.

Full details: Title check

Explanation

The title names the main change: asset binding is now validated against the target entity. The raw summary shows the changes add ownership and scope checks (can_bind_asset) to upload, bulk-bind, and duplicate endpoints, and the PR objectives describe the same goal of preventing out-of-scope bindings. The title is short, specific, and uses the repository's ticket-and-type convention. It does not mention the security framing, but that is acceptable.

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: bc748482-8c62-4a71-b151-cf7f237693f5
Commits

Reviewing files that changed from the base of the PR and between 290383d and df7a8f9.

Files selected for processing: 2

  • apps/api/plane/app/views/asset/v2.py
  • apps/api/plane/tests/contract/app/test_asset_upload_entity_binding_app.py

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

@pablohashescobar pablohashescobar changed the title [WEB-10177] fix(security): validate the entity an asset is bound to [WEB-10177] fix: validate the entity an asset is bound to Nov 16, 2026

@sriramveeraghanta sriramveeraghanta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sriramveeraghanta
sriramveeraghanta merged commit ef55909 into preview Nov 16, 2026
19 of 20 checks passed
@sriramveeraghanta
sriramveeraghanta deleted the fix/web-10177-asset-entity-binding branch November 16, 2026 20:19
Pawel-Kranzberg pushed a commit to klazwi/pi-plane that referenced this pull request Nov 18, 2026
…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)
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.

3 participants