diff --git a/models/action.go b/models/action.go
index 01a6a9170..f39729869 100644
--- a/models/action.go
+++ b/models/action.go
@@ -8,6 +8,7 @@ package models
import (
"encoding/json"
"fmt"
+ "html"
"path"
"regexp"
"strconv"
@@ -580,7 +581,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit, bra
}
refMarked[issue.ID] = true
- message := fmt.Sprintf(`%s`, repo.Link(), c.Sha1, c.Message)
+ message := fmt.Sprintf(`%s`, repo.Link(), c.Sha1, html.EscapeString(c.Message))
if err = CreateRefComment(doer, refRepo, issue, message, c.Sha1); err != nil {
return err
}
diff --git a/models/webhook_telegram.go b/models/webhook_telegram.go
index 9aef0e3ec..7976d14c5 100644
--- a/models/webhook_telegram.go
+++ b/models/webhook_telegram.go
@@ -7,6 +7,7 @@ package models
import (
"encoding/json"
"fmt"
+ "html"
"strings"
"code.gitea.io/gitea/modules/git"
@@ -169,7 +170,7 @@ func getTelegramIssuesPayload(p *api.IssuePayload) (*TelegramPayload, error) {
func getTelegramIssueCommentPayload(p *api.IssueCommentPayload) (*TelegramPayload, error) {
url := fmt.Sprintf("%s/issues/%d#%s", p.Repository.HTMLURL, p.Issue.Index, CommentHashTag(p.Comment.ID))
- title := fmt.Sprintf(`#%d %s`, url, p.Issue.Index, p.Issue.Title)
+ title := fmt.Sprintf(`#%d %s`, url, p.Issue.Index, html.EscapeString(p.Issue.Title))
var text string
switch p.Action {
case api.HookIssueCommentCreated: