Skip to content

Commit 3602b37

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

2 files changed

Lines changed: 0 additions & 4 deletions

File tree

packages/components/evaluation/EvaluationRunner.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ export class EvaluationRunner {
8989
public async runEvaluations(data: ICommonObject) {
9090
const chatflowIds = JSON.parse(data.chatflowId)
9191

92-
// Validate chatflowIds is an actual array to prevent DoS attacks
9392
if (!Array.isArray(chatflowIds)) {
9493
throw new Error('chatflowId must be a valid array')
9594
}
9695

97-
// Validate dataset.rows is an actual array to prevent DoS attacks
9896
if (!data.dataset || !Array.isArray(data.dataset.rows)) {
9997
throw new Error('dataset.rows must be a valid array')
10098
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ const createEvaluation = async (body: ICommonObject, baseURL: string, orgId: str
7272
const row = appServer.AppDataSource.getRepository(Evaluation).create(newEval)
7373
row.average_metrics = JSON.stringify({})
7474

75-
// Parse and validate evaluator arrays to prevent DoS attacks
7675
const chatflowTypes = body.chatflowType ? JSON.parse(body.chatflowType) : []
7776
if (!Array.isArray(chatflowTypes)) {
7877
throw new Error('chatflowType must be a valid array')
@@ -143,7 +142,6 @@ const createEvaluation = async (body: ICommonObject, baseURL: string, orgId: str
143142
const apiKeys: { chatflowId: string; apiKey: string }[] = []
144143
const chatflowIds = JSON.parse(body.chatflowId)
145144

146-
// Validate chatflowIds is an actual array to prevent DoS attacks
147145
if (!Array.isArray(chatflowIds)) {
148146
throw new Error('chatflowId must be a valid array')
149147
}

0 commit comments

Comments
 (0)