mirror of
https://github.com/makeplane/plane.git
synced 2026-07-09 20:10:06 +02:00
[WEB-8066] harden: scope asset project-membership check to the asset's workspace
Address Copilot review: filter ProjectMember by workspace_id=asset.workspace_id in addition to project_id, mirroring allow_permission's PROJECT branch. Prevents a member of the same project in a different workspace from passing the check if an asset row is ever inconsistent (asset.workspace_id != project.workspace_id). Co-authored-by: Plane AI <noreply@plane.so>
This commit is contained in:
@@ -324,8 +324,14 @@ class WorkspaceFileAssetEndpoint(BaseAPIView):
|
||||
"""
|
||||
if asset.project_id is None:
|
||||
return None
|
||||
# Scope the membership lookup to the asset's workspace as well as its
|
||||
# project, mirroring allow_permission's PROJECT branch. This prevents a
|
||||
# member of the same project in a different workspace from passing the
|
||||
# check should an asset row ever be inconsistent (asset.workspace_id !=
|
||||
# asset.project.workspace_id).
|
||||
is_project_member = ProjectMember.objects.filter(
|
||||
member=request.user,
|
||||
workspace_id=asset.workspace_id,
|
||||
project_id=asset.project_id,
|
||||
is_active=True,
|
||||
).exists()
|
||||
|
||||
Reference in New Issue
Block a user