Skip to content

Commit 1cf247e

Browse files
christopherholland-workdaychristopherholland-workday
andauthored
Fix Mass Assignment in Assistants Endpoints (#6128)
Co-authored-by: christopherholland-workday <christopher.holland+evisort@workday.com>
1 parent 2555f10 commit 1cf247e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/server/src/controllers/assistants/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const createAssistant = async (req: Request, res: Response, next: NextFunction)
3535
const newAssistantCount = 1
3636
await checkUsageLimit('flows', subscriptionId, getRunningExpressApp().usageCacheManager, existingAssistantCount + newAssistantCount)
3737

38-
body.workspaceId = workspaceId
3938
const apiResponse = await assistantsService.createAssistant(body, orgId, workspaceId)
4039

4140
return res.json(apiResponse)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ const createAssistant = async (requestBody: any, orgId: string, workspaceId: str
140140
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Error creating new assistant - ${getErrorMessage(error)}`)
141141
}
142142
const newAssistant = new Assistant()
143-
Object.assign(newAssistant, requestBody)
143+
Object.assign(newAssistant, stripProtectedFields(requestBody))
144+
newAssistant.workspaceId = workspaceId
144145

145146
const assistant = appServer.AppDataSource.getRepository(Assistant).create(newAssistant)
146147
const dbResponse = await appServer.AppDataSource.getRepository(Assistant).save(assistant)

0 commit comments

Comments
 (0)