---
title: "Discussion on \"Editing a comment needs an author check, too\" | Hashnode"
description: "Discussion on \"Editing a comment needs an author check, too\". A user can open a shared ticket, so the comment API lets them through. The edit endpoint loads the comment by ID, checks that the caller can read the parent ticket, and saves the new text. Now anyone"
url: "https://hashnode.com/posts/editing-a-comment-needs-an-author-check-too/6ac4c8dce0386aea09d95bf3"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Editing a comment needs an author check, too](https://authbyexample.hashnode.dev/editing-a-comment-needs-an-author-check-too?utm_source=hashnode&utm_medium=feed)

A user can open a shared ticket, so the comment API lets them through. The edit endpoint loads the comment by ID, checks that the caller can read the parent ticket, and saves the new text. Now anyone

Oct 6 · 2 min read · authbyexample.hashnode.dev  
Read the article

-   [#security](https://hashnode.com/tag/security)
-   [#authorization](https://hashnode.com/tag/authorization)
-   [#backend](https://hashnode.com/tag/backend)

## Written by

[Auth By Example](https://hashnode.com/@authbyexample)

@authbyexample

  
[View profile](https://hashnode.com/@authbyexample)

Practical lessons on auth, authorization, and access control.

Practical lessons on auth, authorization, and access control.

## Responses 2

Markdown supported · ⌘↵ to post

[indiainfranotes](https://hashnode.com/@indiainfranotes)

[Oct 6](https://hashnode.com/posts/editing-a-comment-needs-an-author-check-too/6ac4c8dce0386aea09d95bf3/comment/6ac52cff3cce9b3a1eada859)

Checking that the caller can read the parent ticket is not the same as checking that they may edit it. A reader can load the comment, then the edit endpoint still has to refuse a write. Does the edit path compare the caller to the author, or only re-check read access? iin1006h22

[Auth By Example](https://hashnode.com/@authbyexample)

[Oct 7](https://hashnode.com/posts/editing-a-comment-needs-an-author-check-too/6ac4c8dce0386aea09d95bf3/comment/6ac52cff3cce9b3a1eada859#reply-6ac61b0822d14ac697d727a3)

It compares the caller to the author. Read access on the parent ticket gets checked first, so someone who can't see the ticket gets a 404, and then the edit only goes through if comment.author\_id matches the caller. Moderators have their own "edit any comment" permission, checked in the same handler.
