⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
fix(api): check column ownership before the WIP limit on bulk issue update (#350)
Egor Vasilyev8e33c04ece1a
diff --git a/apps/api/src/modules/issues/__tests__/integration/issues.test.ts b/apps/api/src/modules/issues/__tests__/integration/issues.test.tsindex 6ef4406c..3465c6b6 100644--- a/apps/api/src/modules/issues/__tests__/integration/issues.test.ts+++ b/apps/api/src/modules/issues/__tests__/integration/issues.test.ts@@ -1332,6 +1332,27 @@ describe('issues', () => {expect(list.find((i) => i.id === issue.id)?.columnId).toBe(columnId);});+ it("does not reveal another project's full column through the WIP check", async () => {+ const { asOwner, columnId } = await setupProject();+ const foreign = await foreignProject(asOwner);+ await asOwner+ .projects({ projectKey: 'OPS' })+ .issues.post({ columnId: foreign.columnId, title: 'Occupant' });+ await asOwner+ .projects({ projectKey: 'OPS' })+ .columns({ columnId: foreign.columnId })+ .patch({ name: 'Ops Secret Lane', wipLimit: 1, wipMode: 'hard' });+ const issue = (await createIssue(asOwner, columnId)).data!;++ // The column check runs before the WIP check, so a full foreign column is+ // refused as a foreign column, not as a full one.+ const res = await asOwner+ .projects({ projectKey: 'MKT' })+ .issues.bulk.patch({ ids: [issue.id], patch: { columnId: foreign.columnId } });+ expect(res.status).toBe(400);+ expect(JSON.stringify(res.error?.value)).not.toContain('Ops Secret Lane');+ });+it("rejects a bulk add of another project's label", async () => {const { asOwner, columnId } = await setupProject();const foreign = await foreignLabel(asOwner);diff --git a/apps/api/src/modules/issues/service.ts b/apps/api/src/modules/issues/service.tsindex 1aa239e3..1bb342e3 100644--- a/apps/api/src/modules/issues/service.ts+++ b/apps/api/src/modules/issues/service.ts@@ -1253,8 +1253,10 @@ export async function bulkUpdateIssues(const valid = await issuesInProject(projectId, ids);// The whole batch is checked against the limit before any of it is written:// per-issue checks inside the loop would move issues until the column filled up- // and then fail, leaving the move half-applied.+ // and then fail, leaving the move half-applied. The column is checked first so+ // the WIP message never names a column outside this project.if (patch.columnId !== undefined) {+ await assertColumn(projectId, patch.columnId);const incoming = await countEnteringColumn(valid, patch.columnId);if (incoming > 0) await assertWipLimit(patch.columnId, incoming);}