-
Notifications
You must be signed in to change notification settings - Fork 0
Add guest management functionality to existing bookings #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: guest-management-base
Are you sure you want to change the base?
Conversation
* feat: ability to add guests via app.cal.com/bookings * fix: some update * fix: minor issue * fix: final update * update * update * add requested changes * fix type error * small update * final update * fix type error * fix location * update calender event --------- Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>
| }; | ||
| input: TAddGuestsInputSchema; | ||
| }; | ||
| export const addGuestsHandler = async ({ ctx, input }: AddGuestsOptions) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Security] Missing Rate Limiting for addGuests
- Problem: The
addGuestsendpoint lacks rate limiting, making it vulnerable to abuse and potential denial of service. - Fix: Implement robust rate limiting on this endpoint to restrict the number of requests a user can make within a given timeframe.
| if (!booking) throw new TRPCError({ code: "NOT_FOUND", message: "booking_not_found" }); | ||
|
|
||
| const isTeamAdminOrOwner = | ||
| (await isTeamAdmin(user.id, booking.eventType?.teamId ?? 0)) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Bug] Incorrect Authorization Logic for Team Members
- Problem: The authorization logic
(await isTeamAdmin(...)) && (await isTeamOwner(...))is overly restrictive, andteamId ?? 0may lead to incorrect permission checks. - Fix: Change
&&to||to allow either admins or owners, and ensureteamIdis a valid identifier without defaulting to0.
|
|
||
| const isOrganizer = booking.userId === user.id; | ||
|
|
||
| const isAttendee = !!booking.attendees.find((attendee) => attendee.email === user.email); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Security] Broad Attendee Guest Management Privilege
- Problem: The
isAttendeecheck allows any attendee to add guests, which could be abused for spam or disruption. - Fix: Re-evaluate this privilege; if not intended, remove
isAttendeefrom authorization, or add safeguards like organizer approval or guest limits.
Test 10