Details
Suggested Fix
Make every single-row label lookup take the workspace predicate; verify both issue_id and label_id belong to workspace_id for the association routes.
--- a/src/praisonai-platform/praisonai_platform/services/label_service.py
+++ b/src/praisonai-platform/praisonai_platform/services/label_service.py
@@ -33,7 +33,12 @@ class LabelService:
return label
- async def get(self, label_id: str) -> Optional[IssueLabel]:
- return await self._session.get(IssueLabel, label_id)
+ async def get(self, workspace_id: str, label_id: str) -> Optional[IssueLabel]:
+ stmt = select(IssueLabel).where(
+ IssueLabel.id == label_id,
+ IssueLabel.workspace_id == workspace_id,
+ )
+ return (await self._session.execute(stmt)).scalar_one_or_none()
- async def add_to_issue(self, issue_id: str, label_id: str) -> None:
+ async def add_to_issue(self, workspace_id: str, issue_id: str, label_id: str) -> None:
+ # Verify both ids belong to workspace_id before writing the association row.
Then update the route handlers in routes/labels.py to thread workspace_id through every call. The same single-key-lookup pattern is filed separately for AgentService, IssueService, ProjectService, and CommentService — each is its own exploitable IDOR.