- Notifications
You must be signed in to change notification settings - Fork11.2k
fix: improve access control in booking operations#25054
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix: improve access control in booking operations#25054
Conversation
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
No issues found across 1 file
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
apps/api/v2/src/ee/bookings/2024-08-13/services/bookings.service.ts OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…ation- Remove problematic import of BookingRepository from @calcom/features- Implement authorization check inline using checkUserHasAccessToBooking helper method- Replicates the authorization logic from BookingRepository.doesUserIdHaveAccessToBooking- Fixes runtime module resolution error in NestJS buildCo-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
vercelbot commentedNov 10, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The latest updates on your projects. Learn more aboutVercel for GitHub. |
…authorization"This reverts commitb4f8f11.
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.
No issues found across 4 files
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.
No issues found across 1 file
github-actionsbot commentedNov 10, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
E2E results are ready! |
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.
No issues found across 2 files
fd390f9 intomainUh oh!
There was an error while loading.Please reload this page.
What does this PR do?
This PR adds authorization checks to the booking reassignment endpoints in the Platform API v2 to ensure that only authorized users (booking organizers, team admins, or org admins) can reassign bookings.
Link to Devin run:https://app.devin.ai/sessions/6c99f3b7ed764eb5ac23b5c3c422c6b7
Requested by: Volnei Munhoz (volnei@cal.com) /@volnei
Changes Made
BookingsService.reassignBooking()methodBookingsService.reassignBookingToUser()methodBookingRepository.doesUserIdHaveAccessToBooking()to verify the requesting user has permission to modify the booking403 Forbiddenwhen authorization failsThe authorization check verifies that the user is either:
This follows the same authorization pattern used in the TRPC round-robin reassignment handler.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Prerequisites
Test Case 1: Unauthorized Reassignment (Should Fail)
403 ForbiddenresponseTest Case 2: Authorized Reassignment (Should Succeed)
200 OKresponse with reassigned bookingAPI Endpoints to Test
POST /v2/bookings/{bookingUid}/reassign(automatic reassignment)POST /v2/bookings/{bookingUid}/reassign/{userId}(manual reassignment to specific user)Important Review Points
Authorization Logic Completeness - Does
BookingRepository.doesUserIdHaveAccessToBooking()correctly handle all legitimate access scenarios? Review the implementation atpackages/features/bookings/repositories/BookingRepository.ts:194-224Breaking Changes - Are there any legitimate use cases where users should be able to reassign bookings they don't directly own that this change might break?
Edge Cases - How does this handle:
Error Handling - Is
403 Forbiddenthe appropriate status code, or should we use404 Not Foundto avoid leaking information about booking existence?Testing - Since no automated tests were added (no existing test infrastructure for API v2 services), manual testing is critical before merge.
Checklist