GLM-5.3 · 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
- 8
- Comments matching a bug
- 4
- Comments not matching
- 4
- Cost of this PR
- $0.912
Published comments (8)
Team permission check uses && so admins (non-owners) are denied adding guests — Team admins get `FORBIDDEN` on their own team's booking because `isTeamAdmin && isTeamOwner` demands both roles. Use `||` — or just `isTeamAdmin`, which already returns true for ADMIN or OWNER.
Guest emails bypass blacklist and duplicate check due to case-sensitive comparison — A mixed-case guest like `Spam@Example.com` slips past the lowercased `blacklistedGuestEmails` and receives the full booking details and video link. Compare against `guest.toLowerCase()`, and normalize the `booking.attendees` duplicate check the same way.
No booking status check allows adding guests to cancelled/rejected bookings — Attendee rows are created, CONFIRMED ics attachments are emailed, and calendar updates run against deleted events, since `booking.status` is never checked. Throw `BAD_REQUEST` unless the status is `ACCEPTED`, before any state changes.
Guests array is not deduplicated, allowing duplicate Attendee rows — Submitting the same email twice in `guests` inserts two identical Attendee rows — the model has no unique constraint — causing duplicate emails and calendar entries. Dedupe case-insensitively before `createMany`; the server schema in `addGuests.schema.ts` drops the client-side uniqueness refine.
sendAddGuestsEmails receives raw guests, re-sending scheduled email to existing attendees — An existing attendee who is re-submitted still gets `AttendeeScheduledEmail` instead of the add-guests notification, since `sendAddGuestsEmails` in `email-manager.ts` treats raw `guests` as new. Pass `uniqueGuests` so only added guests are notified.
Unbounded `guests` array enables resource exhaustion and mail bombing — One authorized request with thousands of emails triggers an unbounded `createMany`, a huge email fanout, and a bloated calendar update — a repeatable mail-bombing vector from any attendee account. Bound the `guests` array in `ZAddGuestsInputSchema` with `.max(25)`.
evt CalendarEvent never sets team, so team members never get add-guests emails — Team members silently miss the add-guests notification: `sendAddGuestsEmails` in `email-manager.ts` only notifies when `calEvent.team?.members` is populated, leaving that loop dead code. Populate `evt.team` from `booking.eventType.team` with its members, as `handleCancelBooking.ts` does.
Stale validation error banner reappears when dialog is reopened — Since the dialog stays mounted in `BookingListItem`, one failed validation makes the error banner reappear on every reopen, even after a successful add. Clear `isInvalidEmail` in `onSuccess`, and reset both it and `multiEmailValue` when closing via `onOpenChange`.