Epic #705. blog-entry-component.tsaddMainComment/addMediaComment send literal authorId: "current-user-id", authorName: "Current User" (~lines 201-202, 228-229 pre-#420). Real identity is available the same way the owner-delete gate gets it (keycloak.tokenParsed?.sub) or via ProfileService.getProfile() as blog-create does.
Server-side half: the comment endpoints (POST /posts/{id}/comments, /posts/{postId}/media/{mediaId}/comments) have no [Authorize] and trust the DTO — the same provenance hole backend #423 closed for post creation. Mirror that fix: [Authorize] + author fields from claims.
Also worth deciding: should anonymous viewers see the comment input at all (the /blog route is public)?
Epic #705. `blog-entry-component.ts` `addMainComment`/`addMediaComment` send literal `authorId: "current-user-id"`, `authorName: "Current User"` (~lines 201-202, 228-229 pre-#420). Real identity is available the same way the owner-delete gate gets it (`keycloak.tokenParsed?.sub`) or via `ProfileService.getProfile()` as blog-create does.
**Server-side half:** the comment endpoints (`POST /posts/{id}/comments`, `/posts/{postId}/media/{mediaId}/comments`) have no `[Authorize]` and trust the DTO — the same provenance hole backend #423 closed for post creation. Mirror that fix: `[Authorize]` + author fields from claims.
Also worth deciding: should anonymous viewers see the comment input at all (the `/blog` route is public)?
Angular (blog-entry-component.ts): addMainComment/addMediaComment now read the real identity from keycloak.tokenParsed?.sub (line ~97), not the literal "current-user-id"/"Current User". Covered by blog-entry-component.spec.ts ("the component only reads tokenParsed.sub"). Landed with the owner-delete work, angular PR #420.
Backend (BlogController): all comment endpoints are [Authorize] and set ActorId = callerId from the Keycloak claim (6 server-anchored sites on origin/master) — same fix pattern as post creation (#423 / #716).
The client-supplied author fields are no longer trusted; comments post under the authenticated user. Closing.
(The ticket's open question — whether anonymous viewers on the public /blog route should see the comment input at all — is a UX decision, not part of this identity bug; file separately if you still want to change that.)
Verified fixed and on `master` — both halves:
- **Angular** (`blog-entry-component.ts`): `addMainComment`/`addMediaComment` now read the real identity from `keycloak.tokenParsed?.sub` (line ~97), not the literal `"current-user-id"`/`"Current User"`. Covered by `blog-entry-component.spec.ts` ("the component only reads tokenParsed.sub"). Landed with the owner-delete work, angular PR **#420**.
- **Backend** (`BlogController`): all comment endpoints are `[Authorize]` and set `ActorId = callerId` from the Keycloak claim (6 server-anchored sites on `origin/master`) — same fix pattern as post creation (#423 / #716).
The client-supplied author fields are no longer trusted; comments post under the authenticated user. Closing.
(The ticket's open question — whether anonymous viewers on the public `/blog` route should see the comment input at all — is a UX decision, not part of this identity bug; file separately if you still want to change that.)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Epic #705.
blog-entry-component.tsaddMainComment/addMediaCommentsend literalauthorId: "current-user-id",authorName: "Current User"(~lines 201-202, 228-229 pre-#420). Real identity is available the same way the owner-delete gate gets it (keycloak.tokenParsed?.sub) or viaProfileService.getProfile()as blog-create does.Server-side half: the comment endpoints (
POST /posts/{id}/comments,/posts/{postId}/media/{mediaId}/comments) have no[Authorize]and trust the DTO — the same provenance hole backend #423 closed for post creation. Mirror that fix:[Authorize]+ author fields from claims.Also worth deciding: should anonymous viewers see the comment input at all (the
/blogroute is public)?Verified fixed and on
master— both halves:blog-entry-component.ts):addMainComment/addMediaCommentnow read the real identity fromkeycloak.tokenParsed?.sub(line ~97), not the literal"current-user-id"/"Current User". Covered byblog-entry-component.spec.ts("the component only reads tokenParsed.sub"). Landed with the owner-delete work, angular PR #420.BlogController): all comment endpoints are[Authorize]and setActorId = callerIdfrom the Keycloak claim (6 server-anchored sites onorigin/master) — same fix pattern as post creation (#423 / #716).The client-supplied author fields are no longer trusted; comments post under the authenticated user. Closing.
(The ticket's open question — whether anonymous viewers on the public
/blogroute should see the comment input at all — is a UX decision, not part of this identity bug; file separately if you still want to change that.)