fix(security): prevent IDOR in updateWrongAssignmentReportStatus with team membership check (#29957) - #30005
Conversation
… team membership check (calcom#29957)
|
Welcome to Cal.diy, @jihadMo! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe report status handler now verifies that the requesting user has an accepted membership in the report’s team. Users without membership receive a Merge Risk: ⚪ Minimal · up to The change restricts wrong-assignment report updates to accepted team members and returns the appropriate authorization error for foreign-team access. No actionable merge-blocking risk remains based on the supplied evidence. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #29957
Summary of Changes
prisma.membership.findFirst({ where: { userId: user.id, teamId: report.teamId, accepted: true } })) inpackages/trpc/server/routers/viewer/bookings/updateWrongAssignmentReportStatus.handler.ts.TRPCErrorwith codeFORBIDDENif the caller is not an accepted member of the team associated with the wrong-assignment report.Verification
NOT_FOUND.FORBIDDEN.