Availability is checked before creation
Why it matters
Without a server-side availability check before insertion, two users submitting the booking form within milliseconds of each other will both receive success responses for the same slot. Frontend availability guards are client-controlled and can be bypassed entirely with a direct API call. OWASP A04 (Insecure Design) classifies trusting client-side state for server decisions as a structural flaw. A double-booked appointment slot means one customer shows up to find their slot occupied — a support and refund incident that a single server-side query would have prevented entirely.
Severity rationale
Critical because the absence of server-side availability enforcement directly produces confirmed double-bookings, a business-critical data integrity failure that requires manual remediation for every occurrence.
Remediation
Add the availability query in your booking API handler or service layer (e.g., src/app/api/bookings/route.ts) before the insert, not in a React component.
// Server-side only — never trust the client's slot state
const conflict = await db.booking.findFirst({
where: {
slotId: requestedSlotId,
status: { not: 'CANCELLED' }
}
});
if (conflict) throw new ConflictError('Slot unavailable');
const booking = await db.booking.create({ data: { ...bookingData } });
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Booking Flow & Lifecycle Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-20 — Improper Input Validation
- owasp:2021 · A04 — Insecure Design
- iso-25010:2011 · functional-suitability.functional-correctness
Taxons
History
- 2026-04-18·v1.0.0·Initial import from booking-flow-lifecycle·automated