Bug: comments, ratings and tags expose other users' email and role #22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Several DTOs embed the full
UserDtoof another user, which includes their email and role. Everyone who can see the resource receives that data:CommentDtocreatedByUserapi-contract/src/comments.tsRatingDtocreatedByUserapi-contract/src/ratings.tsTagDtocreatedByUserapi-contract/src/tags.tsMealPlanShareDtosharedWithUserapi-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 indocs/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.
Solved with pr 46