This issue has been created
There is 1 update, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-0d51b27d-ec3c-41ef-a56e-309af1971a3c XWIKI-24688 Open

Comment/annotation "Delete" action mutates state via a GET-style link instead of a POST form

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-e225a8a2-7df1-4d8f-9f18-123b1333b5da Charpentier Lucas created this issue on 12/Aug/26 14:14
 
Summary: Comment/annotation "Delete" action mutates state via a GET-style link instead of a POST form
Issue Type: cid:jira-generated-image-avatar-0d51b27d-ec3c-41ef-a56e-309af1971a3c Improvement
Assignee: Unassigned
Components: Flamingo Skin
Created: 12/Aug/26 14:14
Priority: cid:jira-generated-image-static-minor-08528289-8ace-4776-869b-092f13b2bca4 Minor
Reporter: Charpentier Lucas
Description:

The "Delete" action for comments and annotations (AnnotationCode.Macros#displayAnnotationToolboxFromReference,
and the equivalent in flamingo's commentsinline.vm) is a plain `<a href="...">` link to the `objectremove`
action, gated only by a confirmation modal (Bootstrap `#deleteModal`) whose confirm button navigates the
browser to that link's href. The link itself performs the actual mutation (deleting the comment/annotation
object) as a simple GET-style navigation, protected only by a `form_token` carried in the query string.

This was flagged during review of PR #5928 (https://github.com/xwiki/xwiki-platform/pull/5928#discussion_r3735753256):
using a link to modify server-side state is bad practice; a proper HTML `<form method="POST">` should be
used instead. The reviewer noted this pattern is already used pervasively across the codebase (comments,
annotations, and elsewhere), so it's a pre-existing issue, not something introduced by that PR - it should be
tracked and fixed on its own rather than folded into an unrelated UI-focused PR.

Proposed fix: convert the Delete confirmation flow to submit a real POST form (hidden inputs for
`form_token`, `classname`, `classid`, `xredirect`) instead of navigating a plain link, for both the
annotation toolbox (AnnotationCode.Macros) and the standard Comments viewer (commentsinline.vm) delete
actions. Worth checking whether other state-mutating links in the same areas (e.g. the annotation Edit
action, which navigates to a save/edit URL) should be reconsidered at the same time.

 
 

1 update

 
cid:jira-generated-image-avatar-e225a8a2-7df1-4d8f-9f18-123b1333b5da Changes by Charpentier Lucas on 12/Aug/26 14:15
 
Description: The "Delete" action for comments and annotations (AnnotationCode.Macros#displayAnnotationToolboxFromReference,
and the equivalent in flamingo's commentsinline.vm) is a plain `<a href="...">` link to the `objectremove`
action, gated only by a confirmation modal (Bootstrap `#deleteModal`) whose confirm button navigates the
browser to that link's href. The link itself performs the actual mutation (deleting the comment/annotation
object) as a simple GET-style navigation, protected only by a `form_token` carried in the query string.

This was flagged during review of PR #5928 (https://github.com/xwiki/xwiki-platform/pull/5928#discussion_r3735753256):
using a link to modify server-side state is bad practice; a proper HTML `<form method="POST">` should be
used instead. The reviewer noted this pattern is already used pervasively across the codebase (comments,
annotations, and elsewhere), so it's a pre-existing issue, not something introduced by that PR - it should be
tracked and fixed on its own rather than folded into an unrelated UI-focused PR.


Proposed fix: convert the Delete confirmation flow to submit a real POST form (hidden inputs for
`form_token`, `classname`, `classid`, `xredirect`) instead of navigating a plain link, for both the
annotation toolbox (AnnotationCode.Macros) and the standard Comments viewer (commentsinline.vm) delete
actions. Worth checking whether other state-mutating links in the same areas (e.g. the annotation Edit
action, which navigates to a save/edit URL) should be reconsidered at the same time.
 
 

1 comment

 
cid:jira-generated-image-avatar-e225a8a2-7df1-4d8f-9f18-123b1333b5da Charpentier Lucas on 12/Aug/26 14:15
 

Proposed fix: convert the Delete confirmation flow to submit a real POST form (hidden inputs for
`form_token`, `classname`, `classid`, `xredirect`) instead of navigating a plain link, for both the
annotation toolbox (AnnotationCode.Macros) and the standard Comments viewer (commentsinline.vm) delete
actions. Worth checking whether other state-mutating links in the same areas (e.g. the annotation Edit
action, which navigates to a save/edit URL) should be reconsidered at the same time.