Bug: comments, ratings and tags expose other users' email and role #22

Closed
opened 2026-09-27 18:41:31 +00:00 by araemer · 1 comment
Owner

Problem

Several DTOs embed the full UserDto of another user, which includes their email and role. Everyone who can see the resource receives that data:

DTO Field File
CommentDto createdByUser api-contract/src/comments.ts
RatingDto createdByUser api-contract/src/ratings.ts
TagDto createdByUser api-contract/src/tags.ts
MealPlanShareDto sharedWithUser api-contract/src/meal-plans.ts (tracked in recipe-app#46)

Anyone reading a recipe's comments or ratings can see the commenter's email address.

Fix

Switch these fields to CompactUserDto (id, user name, first and last name, avatar; no email, no role), introduced with spec 001. This follows the new convention in docs/api-conventions.md, "Other users are exposed as CompactUserDto".

This is a contract change: recipe-backend has to map to CompactUserDto, and recipe-app has to stop relying on email/role from these fields (check where they are displayed).

The meal plan share part is also covered by recipe-app#46; whichever is done first should do it, and the other just verifies.

Found during the cross-cutting architecture discussion of spec 001.

## Problem Several DTOs embed the full `UserDto` of *another* user, which includes their **email and role**. Everyone who can see the resource receives that data: | DTO | Field | File | |---|---|---| | `CommentDto` | `createdByUser` | `api-contract/src/comments.ts` | | `RatingDto` | `createdByUser` | `api-contract/src/ratings.ts` | | `TagDto` | `createdByUser` | `api-contract/src/tags.ts` | | `MealPlanShareDto` | `sharedWithUser` | `api-contract/src/meal-plans.ts` (tracked in recipe-app#46) | Anyone reading a recipe's comments or ratings can see the commenter's email address. ## Fix Switch these fields to `CompactUserDto` (id, user name, first and last name, avatar; no email, no role), introduced with spec 001. This follows the new convention in `docs/api-conventions.md`, "Other users are exposed as CompactUserDto". This is a contract change: recipe-backend has to map to `CompactUserDto`, and recipe-app has to stop relying on email/role from these fields (check where they are displayed). The meal plan share part is also covered by recipe-app#46; whichever is done first should do it, and the other just verifies. Found during the cross-cutting architecture discussion of spec 001.
Author
Owner

Solved with pr 46

Solved with pr 46
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
araemer/recipe-platform#22
No description provided.