Skip to content

Commit 544c80a

Browse files
authored
fix(orchestrator):Fix instance fetching to respect permissions (#671)
Signed-off-by: Lior Soffer <liorsoffer1@gmail.com>
1 parent a999fd7 commit 544c80a

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator-backend': patch
3+
---
4+
5+
Fix instance fetching to respect permissions

workspaces/orchestrator/docs/rbac-policy.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ p, role:default/workflowAdmin, orchestrator.workflow, read, allow
99
p, role:default/workflowAdmin, orchestrator.workflow.use, update, allow
1010
p, role:default/workflowAdmin, orchestrator.workflowAdminView, read, allow
1111

12+
p, role:default/workflowDenied, orchestrator.workflow, read, deny
13+
p, role:default/workflowDenied, orchestrator.workflow.use, update, deny
14+
1215
g, user:development/guest, role:default/workflowUser
1316
g, user:default/rgolangh, role:default/workflowAdmin
1417
g, user:default/mareklibra, role:default/workflowAdmin

workspaces/orchestrator/plugins/orchestrator-backend/src/service/DataIndexService.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ export class DataIndexService {
232232
if (pagination) pagination.sortField ??= FETCH_PROCESS_INSTANCES_SORT_FIELD;
233233

234234
const processIdNotNullCondition = 'processId: {isNull: false}';
235-
const definitionIdsCondition = definitionIds
236-
? `processId: {in: ${JSON.stringify(definitionIds)}}`
237-
: undefined;
235+
const definitionIdsCondition =
236+
definitionIds && definitionIds.length > 0
237+
? `processId: {in: ${JSON.stringify(definitionIds)}}`
238+
: undefined;
238239
const type = 'ProcessInstance';
239240
const filterCondition = filter
240241
? buildFilterCondition(

workspaces/orchestrator/plugins/orchestrator-backend/src/service/router.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,9 @@ function setupInternalRoutes(
801801
allWorkflowIds,
802802
);
803803

804+
if (!authorizedWorkflowIds || authorizedWorkflowIds.length === 0)
805+
res.json([]);
806+
804807
const result = await routerApi.v2.getInstances(
805808
buildPagination(req),
806809
getRequestFilters(req),

0 commit comments

Comments
 (0)