Skip to content

Commit d6fa990

Browse files
Update packages/server/src/services/variables/index.ts
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 1464fdb commit d6fa990

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • packages/server/src/services/variables

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ const updateVariable = async (variable: Variable, updatedVariable: Variable) =>
104104
throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'Cloud platform does not support runtime variables!')
105105
try {
106106
const tmpUpdatedVariable = await appServer.AppDataSource.getRepository(Variable).merge(variable, updatedVariable)
107-
tmpUpdatedVariable.workspaceId = variable.workspaceId // defense-in-depth: never trust client-supplied workspaceId
107+
const originalWorkspaceId = variable.workspaceId;
108+
const tmpUpdatedVariable = await appServer.AppDataSource.getRepository(Variable).merge(variable, updatedVariable);
109+
tmpUpdatedVariable.workspaceId = originalWorkspaceId;
108110
const dbResponse = await appServer.AppDataSource.getRepository(Variable).save(tmpUpdatedVariable)
109111
return dbResponse
110112
} catch (error) {

0 commit comments

Comments
 (0)