You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
π Bug: Work item create/update via API silently drops assignees who aren't active project members (returns 200/201, no error)Β #9517
Creating or updating a work item through the API with an assignees list returns success even when some or all of those ids aren't active project members with role >= 15. The invalid ids are quietly filtered out β no error, nothing in the response saying the assignment was rejected. We hit this twice in production automation; both times the API reported success and the work item just came back unassigned, so we didn't find out until someone noticed the work item had no owner.
What makes it surprising is that the same serializer does raise a ValidationError for an invalid state or parent. Assignees (and labels) are the odd ones out.
To reproduce
Project P, and a user U who is in the workspace but not a member of P. A project Guest (role 5) works too, since the filter is role__gte=15.
POST /api/v1/workspaces/<slug>/projects/<P>/issues/ with {"name": "test", "assignees": ["<U-id>"]}
Response is 201 with "assignees": [].
Same on PATCH of an existing work item: 200, assignees unchanged.
Where
apps/api/plane/api/serializers/issue.py, IssueSerializer.validate() (around L106-113 on 3985693) β the queryset narrows the submitted list rather than validating it, so non-matching ids are dropped:
# Validate assignees are from projectifdata.get("assignees", []):
data["assignees"] =ProjectMember.objects.filter(
project_id=self.context.get("project_id"),
is_active=True,
role__gte=15,
member_id__in=data["assignees"],
).values_list("member_id", flat=True)
labels just below does the same, and apps/api/plane/app/serializers/issue.py has the same shape for assignee_ids.
Roles are ((20, "Admin"), (15, "Member"), (5, "Guest")) (apps/api/plane/db/models/project.py:21), so role__gte=15 means a project Guest is silently dropped as well, not just a non-member.
Expected behavior
Either raise a ValidationError naming the ids that aren't assignable (consistent with how state and parent are handled), or surface the rejected ids in the response. Silent is the hard part β an automated caller has no way to tell its assignment didn't take.
Happy to put up a PR if that's useful β I'd just want your call on direction first, since raising is the more consistent fix but it's a behaviour change for existing callers. Thanks!
Activity
fix(api): validate assignees/labels in IssueSerializer instead of silβ¦
fix(api): validate assignees/labels in IssueSerializer instead of silβ¦
fix(api): validate assignees/labels in IssueSerializer instead of silβ¦