GLM-5.3 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 Opus 5.5.
- Gold bugs found
- 6 of 18
- Comments published
- 8
- Comments matching a bug
- 6
- Comments not matching
- 2
- Cost of this PR
- $0.093
Published comments (8)
isTeamAdminOrOwner uses &&, collapsing admin check to owner-only — Team admins who aren't owners get FORBIDDEN and can't add guests, because `isTeamAdmin` already matches ADMIN and OWNER roles, making the `&&` an owner-only check. Join the two calls with `||` instead.
Adding guests bypasses seat capacity checks and creates no BookingSeat rows — Attendees are inserted without checking remaining capacity or creating `BookingSeat` rows, so seat-limited event types can be overbooked and added guests have no seat record. Validate remaining capacity before inserting and create matching `BookingSeat` rows.
Guest email comparison is case-sensitive, letting blacklist and dedup checks be bypassed — A case variant like `Foo@x.com` bypasses a `foo@x.com` blacklist entry and slips through dedup against existing attendees, producing duplicate attendee rows and invites. Normalize both sides of both checks with `.toLowerCase()`.
Unbounded guests array allows mass email spam and resource exhaustion — A single request can insert thousands of attendee rows and fan out that many emails, letting the API be abused as a spam relay. Add an upper bound like `.max(20)` to the `guests` array.
Guests can be added to non-confirmed bookings via addGuests mutation — Guests land on CANCELLED, REJECTED, or PENDING bookings and receive a confirmed ics email for an event that isn't accepted, a state the UI never allows. Reject the mutation unless `booking.status` is ACCEPTED.
Team-member notification loop in sendAddGuestsEmails is unreachable — `calendarEvent.team?.members` is always undefined because the only caller builds its `CalendarEvent` without a `team` property, so team members never receive this email. Populate `evt.team` from the booking's event type, or drop the dead branch.
onSuccess does not reset isInvalidEmail, so error banner persists across dialog opens — After one failed validation, the error banner stays set and shows again the next time the dialog opens for unrelated input. Reset `isInvalidEmail` in `onSuccess`, as the cancel button already does.
sendAddGuestsEmails receives raw guests instead of uniqueGuests — Pre-existing attendees filtered out of the insert match in email-manager.ts and receive a full re-confirmation email instead of the intended guests-added notice. Pass `uniqueGuests` as the second argument.