Skip to content

Commit b0eae70

Browse files
author
christopherholland-workday
committed
Add protections for loop-bound injections
1 parent 99a659d commit b0eae70

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

packages/server/src/services/evaluations/EvaluatorRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const runAdditionalEvaluators = async (
1717
selectedEvaluators: string[],
1818
workspaceId: string
1919
) => {
20-
// Validate inputs are arrays and enforce size limits
20+
// Validate that inputs are arrays
2121
if (!Array.isArray(actualOutputArray) || !Array.isArray(selectedEvaluators)) {
2222
throw new Error('Invalid input: expected arrays')
2323
}

packages/server/src/services/evaluations/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ const createEvaluation = async (body: ICommonObject, baseURL: string, orgId: str
7878
throw new Error('chatflowType must be a valid array')
7979
}
8080

81-
const simpleEvaluators = body.selectedSimpleEvaluators && body.selectedSimpleEvaluators.length > 0 ? JSON.parse(body.selectedSimpleEvaluators) : []
81+
const simpleEvaluators =
82+
body.selectedSimpleEvaluators && body.selectedSimpleEvaluators.length > 0 ? JSON.parse(body.selectedSimpleEvaluators) : []
8283
if (!Array.isArray(simpleEvaluators)) {
8384
throw new Error('selectedSimpleEvaluators must be a valid array')
8485
}
@@ -90,7 +91,8 @@ const createEvaluation = async (body: ICommonObject, baseURL: string, orgId: str
9091
}
9192

9293
if (body.evaluationType === 'llm') {
93-
const lLMEvaluators = body.selectedLLMEvaluators && body.selectedLLMEvaluators.length > 0 ? JSON.parse(body.selectedLLMEvaluators) : []
94+
const lLMEvaluators =
95+
body.selectedLLMEvaluators && body.selectedLLMEvaluators.length > 0 ? JSON.parse(body.selectedLLMEvaluators) : []
9496

9597
if (!Array.isArray(lLMEvaluators)) {
9698
throw new Error('selectedLLMEvaluators must be a valid array')

0 commit comments

Comments
 (0)