File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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" ,
You can’t perform that action at this time.
0 commit comments