Skip to content

Commit 3f7a3ba

Browse files
committed
fix(security): close folder workspace bypass when workspaceId is falsy
1 parent 80e7843 commit 3f7a3ba

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,11 @@ export async function executeMoveWorkflow(
524524
for (const workflowId of workflowIds) {
525525
try {
526526
const { workspaceId } = await ensureWorkflowAccess(workflowId, context.userId, 'write')
527-
if (folderId && workspaceId && !(await verifyFolderWorkspace(folderId, workspaceId))) {
528-
failed.push(workflowId)
529-
continue
527+
if (folderId) {
528+
if (!workspaceId || !(await verifyFolderWorkspace(folderId, workspaceId))) {
529+
failed.push(workflowId)
530+
continue
531+
}
530532
}
531533
assertWorkflowMutationNotAborted(context)
532534
await updateWorkflowRecord(workflowId, { folderId })

0 commit comments

Comments
 (0)