summaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-15 18:05:02 -0500
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-02-16 04:06:20 +0100
commit134f3e6e09ed0583bc377a08ef46a51013635a2e (patch)
tree0226e2d5ecd4bdb2ff8701d216f82fc960d90ae7 /templates/repo
parent43c94d0a6cd8daf01125df3bf895f1beb1bcd664 (diff)
downloadgitea-134f3e6e09ed0583bc377a08ef46a51013635a2e.tar.gz
gitea-134f3e6e09ed0583bc377a08ef46a51013635a2e.zip
Security: prevent XSS attach on wiki page
Reported by Miguel Ángel Jimeno.
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/wiki/view.tmpl11
1 files changed, 6 insertions, 5 deletions
diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl
index 9a1a984b63..b9aa4e9560 100644
--- a/templates/repo/wiki/view.tmpl
+++ b/templates/repo/wiki/view.tmpl
@@ -1,6 +1,7 @@
{{template "base/head" .}}
<div class="repository wiki view">
{{template "repo/header" .}}
+ {{ $title := .title | Sanitize}}
<div class="ui container">
<div class="ui grid">
<div class="ui ten wide column">
@@ -9,7 +10,7 @@
<div class="ui basic small button">
<span class="text">
{{.i18n.Tr "repo.wiki.page"}}:
- <strong>{{.title}}</strong>
+ <strong>{{$title}}</strong>
</span>
<i class="dropdown icon"></i>
</div>
@@ -20,7 +21,7 @@
</div>
<div class="scrolling menu">
{{range .Pages}}
- <div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name}}</div>
+ <div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name | Sanitize}}</div>
{{end}}
</div>
</div>
@@ -50,8 +51,8 @@
</div>
</div>
</div>
- <div class="ui header">
- {{.title}}
+ <div class="ui dividing header">
+ {{$title}}
{{if and .IsRepositoryWriter (not .Repository.IsMirror)}}
<div class="ui right">
<a class="ui small button" href="{{.RepoLink}}/wiki/{{EscapePound .PageURL}}/_edit">{{.i18n.Tr "repo.wiki.edit_page_button"}}</a>
@@ -95,7 +96,7 @@
{{.i18n.Tr "repo.wiki.delete_page_button"}}
</div>
<div class="content">
- <p>{{.i18n.Tr "repo.wiki.delete_page_notice_1" .title | Safe}}</p>
+ <p>{{.i18n.Tr "repo.wiki.delete_page_notice_1" $title | Safe}}</p>
</div>
{{template "base/delete_modal_actions" .}}
</div>