forgejo/templates/repo/wiki
Gusted ef05332c3b
[SECURITY] Fix XSS in wiki last commit information
- On the wiki and revisions page, information is shown about the last
commit that modified that wiki page. This includes the time it was last
edited and by whom. That whole string is not being sanitized (passed
trough `Safe` in the templates), because the last edited bit is
formatted as an HTML element and thus shouldn't be sanitized. The
problem with this is that now `.Author.Name` is not being sanitized.
- This can be exploited, the names of authors and commiters on a Git
commit is user controlled, they can be any value and thus also include
HTML. It's not easy to actually exploit this, as you cannot use the
official git binary to do use, as they actually strip `<` and `>` from
user names (trivia: this behaviour was introduced in the initial commit
of Git). In the integration testing, go-git actually has to generate
this commit as they don't have such restrictions.
- Pass `.Author.Name` trough `Escape` in order to be sanitized.

(cherry picked from commit d24c37e132)

Conflicts:
	templates/repo/wiki/revision.tmpl
	templates/repo/wiki/view.tmpl
	trivial context conflict
2024-02-22 22:36:14 +01:00
..
new.tmpl Add placeholder and aria attributes to release and wiki edit page (#24031) 2023-04-10 11:56:57 -04:00
pages.tmpl Don't display creating page button in a mirror wiki repository (#24395) 2023-05-04 15:27:15 +08:00
revision.tmpl [SECURITY] Fix XSS in wiki last commit information 2024-02-22 22:36:14 +01:00
start.tmpl Improve wiki sidebar and TOC (#25460) (#25477) 2023-06-24 10:16:15 +08:00
view.tmpl [SECURITY] Fix XSS in wiki last commit information 2024-02-22 22:36:14 +01:00