Patch vulnerability that allowed self-promotion
This commit is contained in:
1 parent
37a2209871
commit
02094904be
1 file changed
+5
@@ -94,6 +94,11 @@ export async function patchHandler(req: NextApiRequest) {
|
||||
if (!isAdmin && query.userId !== req.userId) throw new HttpError({ statusCode: 403, message: "Forbidden" });
|
||||
|
||||
const body = await schemaUserEditBodyParams.parseAsync(req.body);
|
||||
// disable role changes unless admin.
|
||||
if (!isAdmin && body.role) {
|
||||
body.role = undefined;
|
||||
}
|
||||
|
||||
const userSchedules = await prisma.schedule.findMany({
|
||||
where: { userId: query.userId },
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user