Skip to content

Commit c0d105e

Browse files
authored
fix: require uid for booking cancellation on web cancel route (calcom#28868)
1 parent 74936a3 commit c0d105e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

apps/web/app/api/cancel/route.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ async function handler(req: NextRequest) {
2222
}
2323
const bookingData = bookingCancelWithCsrfSchema.parse(appDirRequestBody);
2424

25+
// Integer IDs are sequential/guessable — only accept high-entropy UIDs on this route
26+
if (!bookingData.uid) {
27+
return NextResponse.json(
28+
{ success: false, message: "uid is required for booking cancellation" },
29+
{ status: 400 }
30+
);
31+
}
32+
2533
const csrfError = await validateCsrfToken(bookingData.csrfToken);
2634
if (csrfError) {
2735
return csrfError;
@@ -38,8 +46,11 @@ async function handler(req: NextRequest) {
3846
identifier,
3947
});
4048

49+
// Strip integer id to ensure lookup is always by uid
50+
const { id: _id, ...safeBookingData } = bookingData;
51+
4152
const result = await handleCancelBooking({
42-
bookingData,
53+
bookingData: safeBookingData,
4354
userId: session?.user?.id || -1,
4455
userUuid: session?.user?.uuid,
4556
actionSource: "WEBAPP",

0 commit comments

Comments
 (0)