Claude Opus 5.5 · 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
5
Comments matching a bug
4
Comments not matching
1
Cost of this PR
$0.931

Published comments (5)

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

Team admins who are not owners are wrongly denied adding guests — `isTeamAdmin` already returns true for both ADMIN and OWNER roles, so also requiring `isTeamOwner` with `&&` gives FORBIDDEN to admins who aren't owners. Use `||`, or call `isTeamAdmin` on its own.

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

Blacklisted guest emails bypass filter via case differences — A blacklisted address typed in another case, like `Bad@X.com`, still receives booking emails because `BLACKLISTED_GUEST_EMAILS` entries are lowercased but `guest` is not. Lowercase `guest` before both the blacklist check and the attendee-duplicate check.

highbugpackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:158-165

Calendar update uses the requester's credentials instead of the organizer's — When an attendee or team admin adds guests, the external calendar event is never updated, or the update throws, because `getUsersCredentials(ctx.user)` lacks access to the organizer's calendar. Build `EventManager` from `booking.user.credentials` instead.

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

sendAddGuestsEmails receives unfiltered guests, so existing attendees get new invites — Existing attendees included in the request get a full 'scheduled' invite instead of the 'guests added' notice. Pass `uniqueGuests` to `sendAddGuestsEmails` instead of the raw `guests` input.

mediumsecuritypackages/trpc/server/routers/viewer/bookings/addGuests.schema.ts:5

Unbounded `guests` array allows mass email spam via addGuests — Any booking attendee can submit thousands of addresses, making the server create attendee rows and email each one, which turns the mail sender into a spam tool. Add a `.max()` limit to the `guests` array.

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 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.
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.

Gold bugs missed (4)

mediumThe server never deduplicates the guests array, so a request with the same email twice inserts duplicate attendee rows for the booking.
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).