cal.diy icon indicating copy to clipboard operation
cal.diy copied to clipboard

Security Concern: Prisma queries may expose sensitive user data through include patterns

Open soumojit-D48 opened this issue 6 months ago • 0 comments

Issue Summary

Prisma queries in tRPC routers use include patterns that fetch ALL fields from related models, including sensitive data like credential.key (encrypted API keys). This violates the project's architectural guidelines and creates both security and performance issues.

Steps to Reproduce

  1. Make an API request to any endpoint using the booking authorization procedure in packages/trpc/server/routers/viewer/bookings/util.ts
  2. Inspect the API response
  3. Observe that user data includes all fields from related models without explicit field selection

Actual Results

  • API responses include all fields from related models (e.g., user.credentials)
  • Sensitive encrypted data (credential.key) may be exposed in API responses
  • Larger than necessary response payloads

Expected Results

  • API responses should only include explicitly selected fields
  • Sensitive data like credential.key should never be returned in API responses
  • Prisma queries should use select instead of include as per project guidelines

Technical details

  • This is a server-side issue in tRPC routers
  • Affects multiple files in the codebase

soumojit-D48 avatar May 14 '26 20:05 soumojit-D48