Amazon Ergo 1.0 · 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 Opus 5.5.
- Gold bugs found
- 7 of 18
- Comments published
- 7
- Comments matching a bug
- 7
- Comments not matching
- 0
- Cost of this PR
- $1.544
Published comments (7)
Team admins are denied by the && permission check — Team admins can see the action but then receive `FORBIDDEN`, because `isTeamAdminOrOwner` is true only for owners. Use `||` so the check matches `isUserTeamAdminOrOwner`, or rely on `isTeamAdmin` alone.
Blacklisted guests can bypass the check with different casing — A differently cased address such as `Blocked@Example.com` bypasses `BLACKLISTED_GUEST_EMAILS`, because `includes(guest)` is case-sensitive. Normalize `guest` with `toLowerCase()` before the blacklist and attendee comparisons, as in `checkIfBookerEmailIsBlocked`.
addGuests does not reject CANCELLED or REJECTED bookings — Direct calls can add attendees, update the calendar event, and send ICS emails for `CANCELLED` or `REJECTED` bookings because `booking.status` is never checked. Reject bookings whose status is not `ACCEPTED` server-side rather than relying on the UI.
Submitted guests array is not deduped, creating duplicate attendee rows — `uniqueGuests` only excludes existing attendees and blacklisted addresses, so duplicate entries in a direct API request create duplicate attendee rows and emails. Dedupe `guests` with `Array.from(new Set(guests))` before filtering.
Raw guest input sends duplicate confirmations to existing attendees — Existing attendees named in the request receive a second full booking confirmation because `sendAddGuestsEmails(evt, guests)` uses the raw input to select `AttendeeScheduledEmail`. Pass `uniqueGuests` so only newly added guests receive that email.
Add-guests emails ignore event-type email disable settings — Event types that disable standard host or attendee emails still send add-guests notifications and ICS files because `sendAddGuestsEmails` ignores their metadata. Pass the event type metadata and gate organizer and attendee emails with `eventTypeDisableHostEmail` and `eventTypeDisableAttendeeEmail`.
Unbounded guests array allows oversized add-guest requests — An attendee can submit an unbounded `guests` array, causing oversized writes, calendar updates, and one email per guest plus notifications to existing attendees and team members. Cap it with `.max(100)` and consider rate limiting the mutation.