Claude Opus 5.5 · Heavy

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

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

The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.

Gold bugs found
5 of 8
Comments published
7
Comments matching a bug
5
Comments not matching
2
Cost of this PR
$3.002

Published comments (7)

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

EventManager uses the caller's credentials instead of the booking organizer's — When an attendee or team admin adds guests, the organizer's calendar events can't be updated, or the wrong account's calendars get used. Build the `EventManager` from `booking.user` and its credentials instead of `ctx.user`.

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

isTeamAdminOrOwner uses && so it requires both admin and owner — A team admin who isn't also an owner, or an owner who isn't an admin, gets FORBIDDEN despite being allowed. Combine `isTeamAdmin` and `isTeamOwner` with `||` instead of `&&`.

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

Case-sensitive email comparison bypasses guest blacklist and duplicate check — Submitting `Blocked@Example.com` bypasses `BLACKLISTED_GUEST_EMAILS`, and case variants of existing attendees get added again. Lowercase `guest` and `attendee.email` before comparing.

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

Unbounded `guests` array allows mass attendee creation and email spam — Any attendee can create unlimited attendee rows in one request and make the server email arbitrary addresses, which enables spam from the app's domain. Add a `.max(...)` limit to the `guests` array.

mediumbugpackages/trpc/server/routers/viewer/bookings/addGuests.handler.ts:55

Permission error uses missing locale key "you_do_not_have_permission" — `AddGuestsDialog` shows this through `t(err.message)`, and the key is missing from the en `common.json` locale file, so users see the raw `you_do_not_have_permission` string. Add the key to the locale files or reuse an existing permission-error key.

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

Duplicate guest emails can create duplicate attendee rows — Repeated or differently cased emails in `guests`, or two concurrent requests, can insert duplicate Attendee rows through `createMany`, because `uniqueGuests` only filters out existing attendees and blacklisted emails. Deduplicate case-insensitively within `guests` and recheck existing attendees inside a transaction at insert time.

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

Raw `guests` passed to `sendAddGuestsEmails` instead of `uniqueGuests` — Existing attendees whose emails appear in the input get the new-booking `AttendeeScheduledEmail` instead of the guests-added notice. Pass `uniqueGuests` to `sendAddGuestsEmails` instead of `guests`.

Gold bugs found (5)

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.
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 (3)

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