fix: remove console.log data leaks and improve type safety in tRPC routers#29529
fix: remove console.log data leaks and improve type safety in tRPC routers#29529lucadapice wants to merge 1 commit into
Conversation
- Remove two console.log statements dumping private hashed link data in update.handler.ts (fixes production data leakage) - Replace console.log(e) with structured logger.error in getScheduleByEventTypeSlug.handler.ts - Fix @ts-expect-error by typing reduce accumulator as Record<string, unknown> in update.handler.ts - Narrow Prisma include to select in duplicate.handler.ts: team and webhooks now fetch only required fields Fixes calcom#29500 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Welcome to Cal.diy, @lucadapice! 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 Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR updates three event handler files across the TRPC server. The schedule handler now imports and uses the shared logger utility for error reporting instead of console.log. The duplicate handler optimizes its Prisma query by selectively fetching only IDs for related team and webhooks data. The update handler removes debug logging statements and improves type safety by explicitly typing the updatedValues accumulator, eliminating a TypeScript suppression comment. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
|
|
Summary
Fixes security and code quality issues reported in #29500 across tRPC routers in
packages/trpc/server/routers/viewer/:console.logstatements dumping private hashed link data to stdout in production (update.handler.tslines 611, 615)console.log(e)with the project's structuredlogger.erroringetScheduleByEventTypeSlug.handler.ts, also adding the missing import@ts-expect-errorby typing thereduceaccumulator asRecord<string, unknown>inupdate.handler.ts— no suppression neededincludetoselectinduplicate.handler.ts:teamnow selects onlyid(the only field used downstream),webhooksselects onlyid(it was fetched only to be excluded from the spread)Test plan
console.logoutput for private links in dev logsCloses #29500