[x]):Create README.md or other markdown file containing a link to some gitea API endpoint:
[I might be a misleading, yet harmless looking link. Click me to learn more](/user/logout)
API endpoints are normal GET requests, not protected by auth (normal session id used).
Markdown is rendered in normal (non-sandboxed) DOM.
ideally all three
Same bug for images. Note that the user does not even has to click the image, loading the page will execute the injected API code.
Testcase: create README.md containing an image with URL to API endpoint, log in, visit repository page, do something else and realise that gitea has logged you out:

Yes this should be cleaned up but no harming actions can be done as GET requests are only for getting data not doing actions (except for logout url)
@lafriks: Are you sure? The team/org router go suggested otherwise; logout was used above only as harmless example
Maybe some collaboration possible: https://github.com/gogs/gogs/issues/5355#issuecomment-410117204
@cezar97:
I complicated myself in trying to add this image that send a GET request in the repository's description. I should added it in the Markdown like you did 馃槃.
The two issues seem distinct, would need distinct fixes, if solved via sanitizing as discussed there: removing/sanitizing HTML tags from markdown wouldn't fix this one. Markdown links need special treatment unless URLs and images are completely forbidden, which is probably not desirable
I'd say, actions that can change system states, such as logout or star, shall be POST only.
@msg7086: it鈥榮 about the missing CSRF protection token, and that user-provided content is executed/rendered in the same DOM context as the gitea API calls.
CSRF on GET is technically possible, albeit sometimes considered bad practice (one might argue that token is a bit less exposed when passed in body instead of header).
Unfortunately it seems that the macaron CSRF checker does not support CSRF on GET (is this correct? I might be wrong here).
Sending post from simple link URL is possible via jquery $.post(...).
This could possibly be used as minimally invasive hotfix: Replace all GET API actions fav/watch/logout/org.action/etc by href="javascript:$.post(url, CSRF-token-string)", and do not accept GET anywhere in the gitea/router except for landing pages and repo-over-http.
Thanks for pointing out. Yes CSRF is also needed in this particular case. Just that my reply was focusing on best practices about HTTP verbs (e.g. RESTful style) and not about XSS protection.
Cheers
@lafriks : related, with example: https://github.com/gogs/gogs/issues/5367
One more to check, this one had affected gitlab too:
server-side request forgery (SSRF) vulnerability in migrate https://github.com/gogs/gogs/issues/5372
Fixed by #10462, #10465, #10582
Most helpful comment
I'd say, actions that can change system states, such as logout or star, shall be POST only.