Fixes security vulnerability in workflows (#4376)

This commit is contained in:
Carina Wollendorfer authored and GitHub committed 2022-09-12 09:15:58 +02:00
1 parent a9b79eafb6
commit e6849174c1
1 file changed
+1 -4
@@ -287,13 +287,10 @@ export const workflowsRouter = createProtectedRouter()
}, },
}, },
}); });
if ( if (
newEventType && newEventType &&
newEventType.userId !== user.id && newEventType.userId !== user.id &&
newEventType?.team?.members.filter((membership) => { newEventType?.team?.members.filter((membership) => membership.userId === user.id).length === 0
membership.userId === user.id;
}).length
) { ) {
throw new TRPCError({ code: "UNAUTHORIZED" }); throw new TRPCError({ code: "UNAUTHORIZED" });
} }