GPT-6.1 Sol · 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
$1.191

Published comments (5)

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

Team administrators are incorrectly forbidden from adding booking guests — An `ADMIN` who is neither the organizer nor an attendee receives `FORBIDDEN` because `isTeamAdminOrOwner` requires both predicates to pass. Use `isTeamAdmin` directly, since it authorizes both `ADMIN` and `OWNER` memberships, or combine it with `isTeamOwner` using OR.

highsecuritypackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:74-77

Guest email casing bypasses the blacklist — An authorized attendee can invite a blocked address by changing its capitalization because `blacklistedGuestEmails.includes(guest)` compares the original casing against lowercase entries. Normalize guest addresses before blacklist comparison and persistence.

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

Duplicate guest inputs and concurrent requests create duplicate attendees — Repeated emails in `uniqueGuests` create duplicate attendee rows and invitations; concurrent requests do too because `Attendee` lacks booking/email uniqueness. Deduplicate normalized inputs server-side and enforce booking/email uniqueness atomically during insertion.

mediumbugpackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:137-138

Guest notifications omit the booking's persisted calendar identity — When `booking.iCalUID` is omitted, `generateIcsString` falls back to `booking.uid`, potentially creating a separate invitation instead of updating the existing calendar event. Preserve `booking.iCalUID` when constructing `evt`.

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

Unbounded guest additions permit quadratic notification work — An unbounded `guests` array permits large attendee inserts and concurrent notifications, with quadratic aggregate work and attachment volume because each generated ICS includes every attendee. Enforce server-side guest-count and total-attendee limits before insertion and notification fanout.

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

Gold bugs missed (4)

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.
mediumsendAddGuestsEmails ignores the event type's disableStandardEmails settings, so hosts and attendees receive add-guests emails even when standard emails are disabled.
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).