MiniMax M3 · 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
- 3 of 8
- Comments published
- 8
- Comments matching a bug
- 3
- Comments not matching
- 5
- Cost of this PR
- $0.274
Published comments (8)
isTeamAdminOrOwner requires OWNER role due to redundant AND — `isTeamAdmin` already covers ADMIN and OWNER, so ANDing it with `isTeamOwner` collapses the gate to OWNER-only, wrongly blocking ADMIN team members in `addGuests.handler.ts`. Drop `isTeamOwner` (matching other handlers) so the name `isTeamAdminOrOwner` matches the behavior.
Case-sensitivity bypass: guest blacklist not compared case-insensitively — `blacklistedGuestEmails` is lowercased but compared against raw `guest`, so `ATTACKER@BAD.COM` bypasses a stored `attacker@bad.com` and the user gets the invite. Lowercase `guest` (or the whole `guests` array) before the `includes` check.
OrganizerAddGuestsEmail subject throws when attendees is empty — Reading `this.calEvent.attendees[0].name` throws when `attendees` is empty, aborting the organizer email. Guard it with optional chaining and fall back to `this.calEvent.organizer.name` (or team name) so the subject always renders.
onSuccess branch fails to reset stale isInvalidEmail state — A stale `isInvalidEmail` survives dialog reopen because `onSuccess` never clears it, so users see a leftover red banner over an empty input. Add `setIsInvalidEmail(false)` inside `onSuccess` to mirror the cancel-button reset.
BAD_REQUEST message says emails_must_be_unique_valid when cause is 'no new guests remain' — Throwing `emails_must_be_unique_valid` when every guest was already present mislabels the failure. Use a key like `no_new_guests_to_add` so the i18n copy matches the actual bad-request cause.
TOCTOU race in addGuests allows duplicate attendees and bypasses blacklist — Concurrent calls slip past `booking.attendees` filtering and the non-transactional `createMany` writes duplicate rows, and case-variant emails bypass the exact-match check. Wrap the filter and insert in `prisma.$transaction` (re-querying attendees inside it), add a `@@unique([bookingId, email])` constraint, and compare lowercased emails.
sendAddGuestsEmails invoked with raw input guests not uniqueGuests — `sendAddGuestsEmails(evt, guests)` passes the unfiltered input, so the email manager's `newGuests.includes` check sees attendees who weren't actually added. Pass `uniqueGuests` instead so notifications match the booking update.
Duplicate attendee dedupe ignores email case-insensitivity — Strict equality between `guest` and `attendee.email` lets `USER@EXAMPLE.COM` duplicate `user@example.com`, producing extra attendee rows and duplicate emails. Normalise with `guest.toLowerCase() === attendee.email.toLowerCase()` before the dedupe filter.