From 9b8ec9b85ec65605363b7b926829e16826c00467 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Sun, 12 Mar 2023 11:28:33 +0000 Subject: [PATCH] feat: validate step input in executeFlow --- packages/backend/src/graphql/mutations/execute-flow.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/graphql/mutations/execute-flow.ts b/packages/backend/src/graphql/mutations/execute-flow.ts index 5caeaa77..6b25960b 100644 --- a/packages/backend/src/graphql/mutations/execute-flow.ts +++ b/packages/backend/src/graphql/mutations/execute-flow.ts @@ -13,11 +13,13 @@ const executeFlow = async ( context: Context ) => { const { stepId } = params.input; - const { executionStep } = await testRun({ stepId }); const untilStep = await context.currentUser .$relatedQuery('steps') - .findById(stepId); + .findById(stepId) + .throwIfNotFound(); + + const { executionStep } = await testRun({ stepId }); if (executionStep.isFailed) { throw new Error(JSON.stringify(executionStep.errorDetails));