DeepSeek V4.1 Flash · Balanced

add-guest-management-functionality-to-existing-bookings-cal-com

cal.com · TypeScript · M · 100–299 lines · 6 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
4 of 8
Comments published
8
Comments matching a bug
4
Comments not matching
4
Cost of this PR
$0.117

Published comments (8)

highbugpackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:46-48

Team admins rejected because admin/owner checks are combined with && — Since `isTeamAdmin` already matches ADMIN or OWNER, the `&&` with `isTeamOwner` rejects admins who are not owners. Use `||`, or just `isTeamAdmin`, so team admins can add guests.

highbugpackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:44-56

addGuests allows adding guests to cancelled or rejected bookings — Without a `booking.status` check, a cancelled or rejected booking gets new attendees and a CONFIRMED invite, resurrecting it in every calendar. Reject `CANCELLED` and `REJECTED` bookings before adding guests.

highsecuritypackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:70-78

Guest email blacklist and duplicate checks are case-sensitive — Because `blacklistedGuestEmails` is lowercased but `guest` is not, changing the casing bypasses `BLACKLISTED_GUEST_EMAILS`. Lowercase both sides as in checkIfBookerEmailIsBlocked.ts, and normalize the attendee duplicate comparison too.

highsecuritypackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:50-56

Attendees can append guests to someone else's booking — The `isAttendee` clause lets any attendee append arbitrary addresses to someone else's booking, sending invites and branded emails as the organizer. Restrict this mutation to `isOrganizer` or `isTeamAdminOrOwner`, or require organizer confirmation.

highbugapps/web/components/booking/BookingListItem.tsx:193-201

Add guests action bypasses disableGuests and seatsPerTimeSlot — Guests can be added to event types with `disableGuests` or `seatsPerTimeSlot`, bypassing those constraints and creating seatless `Attendee` rows. Guard both the `add_members` action and `addGuestsHandler` against both fields.

mediumbugpackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:74-106

Non-atomic duplicate attendee check allows concurrent duplicate guests — The `booking.attendees.some` check and `createMany` are not atomic, so concurrent calls insert duplicate attendee rows. Run the check and insert in a transaction with a unique index on (bookingId, email), or lock per booking.

mediumbugpackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:165-168

sendAddGuestsEmails receives raw guests instead of filtered uniqueGuests — Passing raw `guests` to `sendAddGuestsEmails` sends a second full confirmation to addresses already filtered out of `uniqueGuests`. Pass `uniqueGuests` instead.

mediumbugpackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:74-78

Deduplicate guest emails inside the addGuests request payload — `uniqueGuests` never dedupes against itself, so repeated emails in one payload are inserted twice by `createMany` and get two invites. Dedupe `guests` through a `Set` before filtering.

Gold bugs found (4)

highisTeamAdminOrOwner combines isTeamAdmin and isTeamOwner with &&, so only team owners pass; team admins who are not organizer or attendee are wrongly rejected with FORBIDDEN.
highThe guest blacklist is lowercased but incoming guest emails are compared without normalization, so a blacklisted address submitted with different casing bypasses BLACKLISTED_GUEST_EMAILS and is added and emailed.
mediumThe server never deduplicates the guests array, so a request with the same email twice inserts duplicate attendee rows for the booking.
mediumThe handler passes the unfiltered guests list to sendAddGuestsEmails, which uses it to pick who gets AttendeeScheduledEmail, so existing attendees included in the request receive a new-booking confirmation instead of the add-guests email.

Gold bugs missed (4)

highEventManager is created with the requesting user's credentials, so when a non-organizer adds guests the organizer's calendar event is not updated (or the wrong account is used) for references without a credentialId.
mediumsendAddGuestsEmails ignores the event type's disableStandardEmails settings, so hosts and attendees receive add-guests emails even when standard emails are disabled.
mediumThe add-guests handler omits booking.iCalUID from the CalendarEvent, so the add-guests emails' .ics attachments use booking.uid as UID and recipients' calendars treat them as a new event rather than an update of the original booking invite.
highGuest email uniqueness is checked case-sensitively, so case variants of the same address are accepted as distinct guests (and slip past the lowercased blacklist).